Compare commits
	
		
			1 Commits
		
	
	
		
			pierremtb/
			...
			achalmers/
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 078ffa02b0 | 
| @ -1,3 +1,3 @@ | |||||||
| [codespell] | [codespell] | ||||||
| ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,atleast,ue,afterall,ser | ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,absolutey,atleast,ue,afterall | ||||||
| skip: **/target,node_modules,build,dist,./out,**/Cargo.lock,./docs/kcl/*.md,.yarn.lock,**/yarn.lock,./openapi/*.json,./packages/codemirror-lang-kcl/test/all.test.ts,tsconfig.tsbuildinfo | skip: **/target,node_modules,build,**/Cargo.lock,./docs/kcl/*.md,.yarn.lock,**/yarn.lock,./openapi/*.json,./src/lib/machine-api.d.ts | ||||||
|  | |||||||
| @ -2,8 +2,8 @@ NODE_ENV=development | |||||||
| DEV=true | DEV=true | ||||||
| VITE_KC_API_WS_MODELING_URL=wss://api.dev.zoo.dev/ws/modeling/commands | VITE_KC_API_WS_MODELING_URL=wss://api.dev.zoo.dev/ws/modeling/commands | ||||||
| VITE_KC_API_BASE_URL=https://api.dev.zoo.dev | VITE_KC_API_BASE_URL=https://api.dev.zoo.dev | ||||||
|  | BASE_URL=https://api.dev.zoo.dev | ||||||
| VITE_KC_SITE_BASE_URL=https://dev.zoo.dev | VITE_KC_SITE_BASE_URL=https://dev.zoo.dev | ||||||
| VITE_KC_SITE_APP_URL=https://app.dev.zoo.dev |  | ||||||
| VITE_KC_SKIP_AUTH=false | VITE_KC_SKIP_AUTH=false | ||||||
| VITE_KC_CONNECTION_TIMEOUT_MS=5000 | VITE_KC_CONNECTION_TIMEOUT_MS=5000 | ||||||
| # ONLY add your token in .env.development.local if you want to skip auth, otherwise this token takes precedence! | # ONLY add your token in .env.development.local if you want to skip auth, otherwise this token takes precedence! | ||||||
|  | |||||||
| @ -1,7 +1,5 @@ | |||||||
| NODE_ENV=production |  | ||||||
| VITE_KC_API_WS_MODELING_URL=wss://api.zoo.dev/ws/modeling/commands | VITE_KC_API_WS_MODELING_URL=wss://api.zoo.dev/ws/modeling/commands | ||||||
| VITE_KC_API_BASE_URL=https://api.zoo.dev | VITE_KC_API_BASE_URL=https://api.zoo.dev | ||||||
| VITE_KC_SITE_BASE_URL=https://zoo.dev | VITE_KC_SITE_BASE_URL=https://zoo.dev | ||||||
| VITE_KC_SITE_APP_URL=https://app.zoo.dev |  | ||||||
| VITE_KC_SKIP_AUTH=false | VITE_KC_SKIP_AUTH=false | ||||||
| VITE_KC_CONNECTION_TIMEOUT_MS=15000 | VITE_KC_CONNECTION_TIMEOUT_MS=15000 | ||||||
|  | |||||||
							
								
								
									
										35
									
								
								.eslintrc
									
									
									
									
									
								
							
							
						
						| @ -5,39 +5,16 @@ | |||||||
|     }, |     }, | ||||||
|     "plugins": [ |     "plugins": [ | ||||||
|       "css-modules", |       "css-modules", | ||||||
|       "jest", |  | ||||||
|       "jsx-a11y", |  | ||||||
|       "react", |  | ||||||
|       "react-hooks", |  | ||||||
|       "suggest-no-throw", |       "suggest-no-throw", | ||||||
|       "testing-library", |  | ||||||
|       "@typescript-eslint" |  | ||||||
|     ], |     ], | ||||||
|     "extends": [ |     "extends": [ | ||||||
|       "plugin:css-modules/recommended", |       "react-app", | ||||||
|       "plugin:jsx-a11y/recommended", |       "react-app/jest", | ||||||
|       "plugin:react-hooks/recommended" |       "plugin:css-modules/recommended" | ||||||
|     ], |     ], | ||||||
|     "rules": { |     "rules": { | ||||||
|       "@typescript-eslint/no-floating-promises": "error", |       "@typescript-eslint/no-floating-promises": "error", | ||||||
|       "@typescript-eslint/no-misused-promises": "error", |       "@typescript-eslint/no-misused-promises": "error", | ||||||
|       "jsx-a11y/click-events-have-key-events": "off", |  | ||||||
|       "jsx-a11y/no-autofocus": "off", |  | ||||||
|       "jsx-a11y/no-noninteractive-element-interactions": "off", |  | ||||||
|       "no-restricted-globals": [ |  | ||||||
|         "error", |  | ||||||
|         { |  | ||||||
|           "name": "isNaN", |  | ||||||
|           "message": "Use Number.isNaN() instead." |  | ||||||
|         }, |  | ||||||
|       ], |  | ||||||
|       "no-restricted-syntax": [ |  | ||||||
|         "error", |  | ||||||
|         { |  | ||||||
|           "selector": "CallExpression[callee.object.name='Array'][callee.property.name='isArray']", |  | ||||||
|           "message": "Use isArray() in lib/utils.ts instead of Array.isArray()." |  | ||||||
|         } |  | ||||||
|       ], |  | ||||||
|       "semi": [ |       "semi": [ | ||||||
|         "error", |         "error", | ||||||
|         "never" |         "never" | ||||||
| @ -48,9 +25,6 @@ | |||||||
|     "overrides": [ |     "overrides": [ | ||||||
|       { |       { | ||||||
|         "files": ["e2e/**/*.ts"], // Update the pattern based on your file structure |         "files": ["e2e/**/*.ts"], // Update the pattern based on your file structure | ||||||
|         "extends": [ |  | ||||||
|           "plugin:testing-library/react" |  | ||||||
|         ], |  | ||||||
|         "rules": { |         "rules": { | ||||||
|           "suggest-no-throw/suggest-no-throw": "off", |           "suggest-no-throw/suggest-no-throw": "off", | ||||||
|           "testing-library/prefer-screen-queries": "off", |           "testing-library/prefer-screen-queries": "off", | ||||||
| @ -59,9 +33,6 @@ | |||||||
|       }, |       }, | ||||||
|       { |       { | ||||||
|         "files": ["src/**/*.test.ts"], |         "files": ["src/**/*.test.ts"], | ||||||
|         "extends": [ |  | ||||||
|           "plugin:testing-library/react" |  | ||||||
|         ], |  | ||||||
|         "rules": { |         "rules": { | ||||||
|           "suggest-no-throw/suggest-no-throw": "off", |           "suggest-no-throw/suggest-no-throw": "off", | ||||||
|         } |         } | ||||||
|  | |||||||
							
								
								
									
										59
									
								
								.github/ci-cd-scripts/playwright-browser-chrome.sh
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						| @ -0,0 +1,59 @@ | |||||||
|  | # bash strict mode | ||||||
|  | set -euo pipefail | ||||||
|  |  | ||||||
|  | if [[ ! -f "test-results/.last-run.json" ]]; then | ||||||
|  |     # if no last run artifact, than run plawright normally | ||||||
|  |     echo "run playwright normally" | ||||||
|  |     if [[ "$3" == ubuntu-latest* ]]; then | ||||||
|  |         yarn test:playwright:browser:chrome:ubuntu -- --shard=$1/$2 || true | ||||||
|  |     elif [[ "$3" == windows-latest* ]]; then | ||||||
|  |         yarn test:playwright:browser:chrome:windows -- --shard=$1/$2 || true | ||||||
|  |     else | ||||||
|  |         echo "Do not run playwright. Unable to detect os runtime." | ||||||
|  |         exit 1 | ||||||
|  |     fi | ||||||
|  |     # # send to axiom | ||||||
|  |     node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1 | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | retry=1 | ||||||
|  | max_retrys=4 | ||||||
|  |  | ||||||
|  | # retry failed tests, doing our own retries because using inbuilt playwright retries causes connection issues | ||||||
|  | while [[ $retry -le $max_retrys ]]; do | ||||||
|  |     if [[ -f "test-results/.last-run.json" ]]; then | ||||||
|  |         failed_tests=$(jq '.failedTests | length' test-results/.last-run.json) | ||||||
|  |         if [[ $failed_tests -gt 0 ]]; then | ||||||
|  |             echo "retried=true" >>$GITHUB_OUTPUT | ||||||
|  |             echo "run playwright with last failed tests and retry $retry" | ||||||
|  |             if [[ "$3" == ubuntu-latest* ]]; then | ||||||
|  |                 yarn test:playwright:browser:chrome:ubuntu -- --last-failed || true | ||||||
|  |             elif [[ "$3" == windows-latest* ]]; then | ||||||
|  |                 yarn test:playwright:browser:chrome:windows -- --last-failed || true | ||||||
|  |             else | ||||||
|  |                 echo "Do not run playwright. Unable to detect os runtime." | ||||||
|  |                 exit 1 | ||||||
|  |             fi | ||||||
|  |             # send to axiom | ||||||
|  |             node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1 | ||||||
|  |             retry=$((retry + 1)) | ||||||
|  |         else | ||||||
|  |             echo "retried=false" >>$GITHUB_OUTPUT | ||||||
|  |             exit 0 | ||||||
|  |         fi | ||||||
|  |     else | ||||||
|  |         echo "retried=false" >>$GITHUB_OUTPUT | ||||||
|  |         exit 0 | ||||||
|  |     fi | ||||||
|  | done | ||||||
|  |  | ||||||
|  | echo "retried=false" >>$GITHUB_OUTPUT | ||||||
|  |  | ||||||
|  | if [[ -f "test-results/.last-run.json" ]]; then | ||||||
|  |     failed_tests=$(jq '.failedTests | length' test-results/.last-run.json) | ||||||
|  |     if [[ $failed_tests -gt 0 ]]; then | ||||||
|  |         # if it still fails after 3 retrys, then fail the job | ||||||
|  |         exit 1 | ||||||
|  |     fi | ||||||
|  | fi | ||||||
|  | exit 0 | ||||||
							
								
								
									
										22
									
								
								.github/ci-cd-scripts/playwright-electron.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						| @ -1,17 +1,15 @@ | |||||||
| #!/bin/bash |  | ||||||
|  |  | ||||||
| # bash strict mode | # bash strict mode | ||||||
| set -euo pipefail | set -euo pipefail | ||||||
|  |  | ||||||
| if [[ ! -f "test-results/.last-run.json" ]]; then | if [[ ! -f "test-results/.last-run.json" ]]; then | ||||||
|     # if no last run artifact, than run plawright normally |     # if no last run artifact, than run plawright normally | ||||||
|     echo "run playwright normally" |     echo "run playwright normally" | ||||||
|         if [[ "$3" == *ubuntu* ]]; then |         if [[ "$1" == ubuntu-latest* ]]; then | ||||||
|             xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu -- --shard=$1/$2 || true |             xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu || true | ||||||
|         elif [[ "$3" == *windows* ]]; then |         elif [[ "$1" == windows-latest* ]]; then | ||||||
|             yarn test:playwright:electron:windows -- --shard=$1/$2 || true |             yarn test:playwright:electron:windows || true | ||||||
|         elif [[ "$3" == *macos* ]]; then |         elif [[ "$1" == macos-14* ]]; then | ||||||
|             yarn test:playwright:electron:macos  -- --shard=$1/$2 || true |             yarn test:playwright:electron:macos || true | ||||||
|         else |         else | ||||||
|             echo "Do not run playwright. Unable to detect os runtime." |             echo "Do not run playwright. Unable to detect os runtime." | ||||||
|             exit 1 |             exit 1 | ||||||
| @ -21,7 +19,7 @@ if [[ ! -f "test-results/.last-run.json" ]]; then | |||||||
| fi | fi | ||||||
|  |  | ||||||
| retry=1 | retry=1 | ||||||
| max_retrys=5 | max_retrys=4 | ||||||
|  |  | ||||||
| # retry failed tests, doing our own retries because using inbuilt playwright retries causes connection issues | # retry failed tests, doing our own retries because using inbuilt playwright retries causes connection issues | ||||||
| while [[ $retry -le $max_retrys ]]; do | while [[ $retry -le $max_retrys ]]; do | ||||||
| @ -30,11 +28,11 @@ while [[ $retry -le $max_retrys ]]; do | |||||||
|         if [[ $failed_tests -gt 0 ]]; then |         if [[ $failed_tests -gt 0 ]]; then | ||||||
|             echo "retried=true" >>$GITHUB_OUTPUT |             echo "retried=true" >>$GITHUB_OUTPUT | ||||||
|             echo "run playwright with last failed tests and retry $retry" |             echo "run playwright with last failed tests and retry $retry" | ||||||
|             if [[ "$3" == *ubuntu* ]]; then |             if [[ "$1" == ubuntu-latest* ]]; then | ||||||
|                 xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu -- --last-failed || true |                 xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu -- --last-failed || true | ||||||
|             elif [[ "$3" == *windows* ]]; then |             elif [[ "$1" == windows-latest* ]]; then | ||||||
|                 yarn test:playwright:electron:windows -- --last-failed || true |                 yarn test:playwright:electron:windows -- --last-failed || true | ||||||
|             elif [[ "$3" == *macos* ]]; then |             elif [[ "$1" == macos-14* ]]; then | ||||||
|                 yarn test:playwright:electron:macos -- --last-failed || true |                 yarn test:playwright:electron:macos -- --last-failed || true | ||||||
|             else |             else | ||||||
|                 echo "Do not run playwright. Unable to detect os runtime." |                 echo "Do not run playwright. Unable to detect os runtime." | ||||||
|  | |||||||
							
								
								
									
										55
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						| @ -5,37 +5,24 @@ | |||||||
|  |  | ||||||
| version: 2 | version: 2 | ||||||
| updates: | updates: | ||||||
|   - package-ecosystem: 'npm' # See documentation for possible values |     - package-ecosystem: 'npm' # See documentation for possible values | ||||||
|     directories: |       directory: '/' # Location of package manifests | ||||||
|       - '/' |       schedule: | ||||||
|       - '/packages/codemirror-lang-kcl/' |           interval: 'weekly' | ||||||
|       - '/packages/codemirror-lsp-client/' |       reviewers: | ||||||
|     schedule: |           - franknoirot | ||||||
|       interval: weekly |           - irev-dev | ||||||
|       day: monday |     - package-ecosystem: 'github-actions' # See documentation for possible values | ||||||
|     reviewers: |       directory: '/' # Location of package manifests | ||||||
|       - franknoirot |       schedule: | ||||||
|       - irev-dev |           interval: 'weekly' | ||||||
|   - package-ecosystem: 'github-actions' # See documentation for possible values |       reviewers: | ||||||
|     directory: '/' # Location of package manifests |           - adamchalmers | ||||||
|     schedule: |           - jessfraz | ||||||
|       interval: weekly |     - package-ecosystem: 'cargo' # See documentation for possible values | ||||||
|       day: monday |       directory: '/src/wasm-lib/' # Location of package manifests | ||||||
|     reviewers: |       schedule: | ||||||
|       - adamchalmers |           interval: 'weekly' | ||||||
|       - jessfraz |       reviewers: | ||||||
|   - package-ecosystem: 'cargo' # See documentation for possible values |           - adamchalmers | ||||||
|     directory: '/src/wasm-lib/' # Location of package manifests |           - jessfraz | ||||||
|     schedule: |  | ||||||
|       interval: weekly |  | ||||||
|       day: monday |  | ||||||
|     reviewers: |  | ||||||
|       - adamchalmers |  | ||||||
|       - jessfraz |  | ||||||
|     groups: |  | ||||||
|       serde-dependencies: |  | ||||||
|         patterns: |  | ||||||
|           - "serde*" |  | ||||||
|       wasm-bindgen-deps: |  | ||||||
|         patterns: |  | ||||||
|           - "wasm-bindgen*" |  | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								.github/workflows/build-and-store-wasm.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						| @ -27,7 +27,7 @@ jobs: | |||||||
|  |  | ||||||
|  |  | ||||||
|       # Upload the WASM bundle as an artifact |       # Upload the WASM bundle as an artifact | ||||||
|       - uses: actions/upload-artifact@v4 |       - uses: actions/upload-artifact@v3 | ||||||
|         with: |         with: | ||||||
|           name: wasm-bundle |           name: wasm-bundle | ||||||
|           path: src/wasm-lib/pkg |           path: src/wasm-lib/pkg | ||||||
|  | |||||||
							
								
								
									
										71
									
								
								.github/workflows/build-apps.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						| @ -126,13 +126,9 @@ jobs: | |||||||
|           node-version-file: '.nvmrc' |           node-version-file: '.nvmrc' | ||||||
|           cache: 'yarn' # Set this to npm, yarn or pnpm. |           cache: 'yarn' # Set this to npm, yarn or pnpm. | ||||||
|  |  | ||||||
|       - name: yarn install |       - run: yarn install | ||||||
|         # Windows is picky sometimes and fails on fetch. Step takes about ~30s |  | ||||||
|         uses: nick-fields/retry@v3.0.0 |       - run: yarn tronb:vite | ||||||
|         with: |  | ||||||
|           timeout_minutes: 2 |  | ||||||
|           max_attempts: 3 |  | ||||||
|           command: yarn install |  | ||||||
|  |  | ||||||
|       - name: Prepare certificate and variables (Windows only) |       - name: Prepare certificate and variables (Windows only) | ||||||
|         if: ${{ (env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true') && matrix.os == 'windows-2022' }} |         if: ${{ (env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true') && matrix.os == 'windows-2022' }} | ||||||
| @ -163,12 +159,13 @@ jobs: | |||||||
|       - name: Build the app (debug) |       - name: Build the app (debug) | ||||||
|         if: ${{ env.IS_RELEASE == 'false' && env.IS_NIGHTLY == 'false' }} |         if: ${{ env.IS_RELEASE == 'false' && env.IS_NIGHTLY == 'false' }} | ||||||
|         # electron-builder doesn't have a concept of release vs debug, |         # electron-builder doesn't have a concept of release vs debug, | ||||||
|         # this is just not doing any codesign or release yml generation, and points to dev infra |         # this is just not doing any codesign or release yml generation | ||||||
|         run: yarn tronb:package:dev |         run: yarn electron-builder --config | ||||||
|  |  | ||||||
|       - name: Build the app (release) |       - name: Build the app (release) | ||||||
|         if: ${{ env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true' }} |         if: ${{ env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true' }} | ||||||
|         env: |         env: | ||||||
|  |           PUBLISH_FOR_PULL_REQUEST: true | ||||||
|           APPLE_ID: ${{ secrets.APPLE_ID }} |           APPLE_ID: ${{ secrets.APPLE_ID }} | ||||||
|           APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} |           APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} | ||||||
|           APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_PASSWORD }} |           APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_PASSWORD }} | ||||||
| @ -176,14 +173,9 @@ jobs: | |||||||
|           CSC_LINK: ${{ secrets.APPLE_CERTIFICATE }} |           CSC_LINK: ${{ secrets.APPLE_CERTIFICATE }} | ||||||
|           CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} |           CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | ||||||
|           CSC_KEYCHAIN: ${{ secrets.APPLE_SIGNING_IDENTITY }} |           CSC_KEYCHAIN: ${{ secrets.APPLE_SIGNING_IDENTITY }} | ||||||
|  |           CSC_FOR_PULL_REQUEST: true | ||||||
|           WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }} |           WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }} | ||||||
|           DEBUG: "electron-notarize*" |         run: yarn electron-builder --config --publish always | ||||||
|         # TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures |  | ||||||
|         uses: nick-fields/retry@v3.0.0 |  | ||||||
|         with: |  | ||||||
|           timeout_minutes: 10 |  | ||||||
|           max_attempts: 3 |  | ||||||
|           command: yarn tronb:package:prod |  | ||||||
|  |  | ||||||
|       - name: List artifacts in out/ |       - name: List artifacts in out/ | ||||||
|         run: ls -R out |         run: ls -R out | ||||||
| @ -237,14 +229,9 @@ jobs: | |||||||
|           CSC_LINK: ${{ secrets.APPLE_CERTIFICATE }} |           CSC_LINK: ${{ secrets.APPLE_CERTIFICATE }} | ||||||
|           CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} |           CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | ||||||
|           CSC_KEYCHAIN: ${{ secrets.APPLE_SIGNING_IDENTITY }} |           CSC_KEYCHAIN: ${{ secrets.APPLE_SIGNING_IDENTITY }} | ||||||
|  |           CSC_FOR_PULL_REQUEST: true | ||||||
|           WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }} |           WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }} | ||||||
|           DEBUG: "electron-notarize*" |         run: yarn electron-builder --config --publish always | ||||||
|         # TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures |  | ||||||
|         uses: nick-fields/retry@v3.0.0 |  | ||||||
|         with: |  | ||||||
|           timeout_minutes: 10 |  | ||||||
|           max_attempts: 3 |  | ||||||
|           command: yarn tronb:package:prod |  | ||||||
|  |  | ||||||
|       - uses: actions/upload-artifact@v4 |       - uses: actions/upload-artifact@v4 | ||||||
|         if: ${{ env.IS_RELEASE == 'true' }} |         if: ${{ env.IS_RELEASE == 'true' }} | ||||||
| @ -375,49 +362,33 @@ jobs: | |||||||
|       - name: List artifacts |       - name: List artifacts | ||||||
|         run: "ls -R out" |         run: "ls -R out" | ||||||
|  |  | ||||||
|       - name: Set more complete nightly release notes |  | ||||||
|         if: ${{ env.IS_NIGHTLY == 'true' }} |  | ||||||
|         run: | |  | ||||||
|           # Note: preferred going this way instead of a full clone in the checkout step, |  | ||||||
|           # see https://github.com/actions/checkout/issues/1471 |  | ||||||
|           git fetch --prune --unshallow --tags |  | ||||||
|           export TAG="nightly-${VERSION}" |  | ||||||
|           export PREVIOUS_TAG=$(git describe --tags --match="nightly-v[0-9]*" --abbrev=0) |  | ||||||
|           export NOTES=$(./scripts/get-nightly-changelog.sh) |  | ||||||
|           yarn files:set-notes |  | ||||||
|  |  | ||||||
|       - name: Authenticate to Google Cloud |       - name: Authenticate to Google Cloud | ||||||
|         if: ${{ env.IS_NIGHTLY == 'true' }} |         if: ${{ env.IS_NIGHTLY == 'true' }} | ||||||
|         uses: 'google-github-actions/auth@v2.1.8' |         uses: 'google-github-actions/auth@v2.1.7' | ||||||
|         with: |         with: | ||||||
|           credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}' |           credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}' | ||||||
|  |  | ||||||
|       - name: Set up Google Cloud SDK |       - name: Set up Google Cloud SDK | ||||||
|         if: ${{ env.IS_NIGHTLY == 'true' }} |         if: ${{ env.IS_NIGHTLY == 'true' }} | ||||||
|         uses: google-github-actions/setup-gcloud@v2.1.4 |         uses: google-github-actions/setup-gcloud@v2.1.2 | ||||||
|         with: |         with: | ||||||
|           project_id: ${{ env.GOOGLE_CLOUD_PROJECT_ID }} |           project_id: ${{ env.GOOGLE_CLOUD_PROJECT_ID }} | ||||||
|  |  | ||||||
|       - name: Upload nightly files to public bucket |       - name: Upload nightly files to public bucket | ||||||
|         if: ${{ env.IS_NIGHTLY == 'true' }} |         if: ${{ env.IS_NIGHTLY == 'true' }} | ||||||
|         uses: google-github-actions/upload-cloud-storage@v2.2.2 |         uses: google-github-actions/upload-cloud-storage@v2.2.1 | ||||||
|         with: |         with: | ||||||
|           path: out |           path: out | ||||||
|           glob: '*' |           glob: '*' | ||||||
|           parent: false |           parent: false | ||||||
|           destination: 'dl.kittycad.io/releases/modeling-app/nightly' |           destination: 'dl.kittycad.io/releases/modeling-app/nightly' | ||||||
|  |  | ||||||
|       - name: Invalidate bucket cache on latest*.yml and last_download.json files |       - name: Create draft release | ||||||
|         if: ${{ env.IS_NIGHTLY == 'true' }} |         uses: softprops/action-gh-release@v2 | ||||||
|         run: yarn files:invalidate-bucket:nightly |         if: ${{ env.IS_RELEASE == 'true' }} | ||||||
|  |  | ||||||
|       - name: Tag nightly commit |  | ||||||
|         if: ${{ env.IS_NIGHTLY == 'true' }} |  | ||||||
|         uses: actions/github-script@v7 |  | ||||||
|         with: |         with: | ||||||
|           script: | |           name: ${{ env.VERSION }} | ||||||
|             const { VERSION } = process.env           |           tag_name: ${{ env.VERSION }} | ||||||
|             const { owner, repo } = context.repo |           draft: true | ||||||
|             const { sha } = context |           generate_release_notes: true | ||||||
|             const ref = `refs/tags/nightly-${VERSION}` |           files: 'out/Zoo*' | ||||||
|             github.rest.git.createRef({ owner, repo, sha, ref }) |  | ||||||
|  | |||||||
							
								
								
									
										44
									
								
								.github/workflows/cargo-bench.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,44 @@ | |||||||
|  | on: | ||||||
|  |   push: | ||||||
|  |     branches: | ||||||
|  |       - main | ||||||
|  |     paths: | ||||||
|  |       - '**.rs' | ||||||
|  |       - '**/Cargo.toml' | ||||||
|  |       - '**/Cargo.lock' | ||||||
|  |       - '**/rust-toolchain.toml' | ||||||
|  |       - .github/workflows/cargo-bench.yml | ||||||
|  |   pull_request: | ||||||
|  |     paths: | ||||||
|  |       - '**.rs' | ||||||
|  |       - '**/Cargo.toml' | ||||||
|  |       - '**/Cargo.lock' | ||||||
|  |       - '**/rust-toolchain.toml' | ||||||
|  |       - .github/workflows/cargo-bench.yml | ||||||
|  |   workflow_dispatch: | ||||||
|  | permissions: read-all | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | name: cargo bench | ||||||
|  | jobs: | ||||||
|  |   cargo-bench: | ||||||
|  |     name: Benchmark with iai | ||||||
|  |     runs-on: ubuntu-latest-8-cores | ||||||
|  |     steps: | ||||||
|  |       - uses: actions/checkout@v4 | ||||||
|  |       - uses: dtolnay/rust-toolchain@stable | ||||||
|  |       - name: Install dependencies | ||||||
|  |         run: | | ||||||
|  |           cargo install cargo-criterion | ||||||
|  |           sudo apt update | ||||||
|  |           sudo apt install -y valgrind | ||||||
|  |       - name: Rust Cache | ||||||
|  |         uses: Swatinem/rust-cache@v2.6.1 | ||||||
|  |       - name: Benchmark kcl library | ||||||
|  |         shell: bash | ||||||
|  |         run: |- | ||||||
|  |           cd src/wasm-lib/kcl; cargo bench --all-features -- iai | ||||||
|  |         env: | ||||||
|  |           KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}} | ||||||
|  |  | ||||||
							
								
								
									
										22
									
								
								.github/workflows/cargo-test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						| @ -2,8 +2,28 @@ on: | |||||||
|   push: |   push: | ||||||
|     branches: |     branches: | ||||||
|       - main |       - main | ||||||
|  |     paths: | ||||||
|  |       - 'src/wasm-lib/**.rs' | ||||||
|  |       - 'src/wasm-lib/**.hbs' | ||||||
|  |       - 'src/wasm-lib/**.gen' | ||||||
|  |       - 'src/wasm-lib/**.snap' | ||||||
|  |       - '**/Cargo.toml' | ||||||
|  |       - '**/Cargo.lock' | ||||||
|  |       - '**/rust-toolchain.toml' | ||||||
|  |       - 'src/wasm-lib/**.kcl' | ||||||
|  |       - .github/workflows/cargo-test.yml | ||||||
|  |  | ||||||
|   pull_request: |   pull_request: | ||||||
|  |     paths: | ||||||
|  |       - 'src/wasm-lib/**.rs' | ||||||
|  |       - 'src/wasm-lib/**.hbs' | ||||||
|  |       - 'src/wasm-lib/**.gen' | ||||||
|  |       - 'src/wasm-lib/**.snap' | ||||||
|  |       - '**/Cargo.toml' | ||||||
|  |       - '**/Cargo.lock' | ||||||
|  |       - '**/rust-toolchain.toml' | ||||||
|  |       - 'src/wasm-lib/**.kcl' | ||||||
|  |       - .github/workflows/cargo-test.yml | ||||||
|   workflow_dispatch: |   workflow_dispatch: | ||||||
| permissions: read-all | permissions: read-all | ||||||
| concurrency: | concurrency: | ||||||
| @ -51,7 +71,7 @@ jobs: | |||||||
|           KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}} |           KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}} | ||||||
|           RUST_MIN_STACK: 10485760000 |           RUST_MIN_STACK: 10485760000 | ||||||
|       - name: Upload to codecov.io |       - name: Upload to codecov.io | ||||||
|         uses: codecov/codecov-action@v5 |         uses: codecov/codecov-action@v4 | ||||||
|         with: |         with: | ||||||
|           token: ${{secrets.CODECOV_TOKEN}} |           token: ${{secrets.CODECOV_TOKEN}} | ||||||
|           fail_ci_if_error: true |           fail_ci_if_error: true | ||||||
|  | |||||||
							
								
								
									
										32
									
								
								.github/workflows/codemirror-lang-kcl.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						| @ -1,32 +0,0 @@ | |||||||
| name: CodeMirror Lang KCL |  | ||||||
|  |  | ||||||
| on: |  | ||||||
|   pull_request: |  | ||||||
|   push: |  | ||||||
|     branches: |  | ||||||
|       - main |  | ||||||
|  |  | ||||||
| concurrency: |  | ||||||
|   group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |  | ||||||
|   cancel-in-progress: true |  | ||||||
|  |  | ||||||
| jobs: |  | ||||||
|   yarn-unit-test: |  | ||||||
|     runs-on: ubuntu-latest |  | ||||||
|     steps: |  | ||||||
|       - uses: actions/checkout@v4 |  | ||||||
|  |  | ||||||
|       - uses: actions/setup-node@v4 |  | ||||||
|         with: |  | ||||||
|           node-version-file: '.nvmrc' |  | ||||||
|           cache: 'yarn' |  | ||||||
|  |  | ||||||
|       - run: yarn install |  | ||||||
|         working-directory: packages/codemirror-lang-kcl |  | ||||||
|  |  | ||||||
|       - run: yarn tsc |  | ||||||
|         working-directory: packages/codemirror-lang-kcl |  | ||||||
|  |  | ||||||
|       - name: run unit tests |  | ||||||
|         run: yarn test |  | ||||||
|         working-directory: packages/codemirror-lang-kcl |  | ||||||
							
								
								
									
										183
									
								
								.github/workflows/e2e-tests.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						| @ -1,8 +1,9 @@ | |||||||
| name: E2E Tests | name: E2E Tests | ||||||
| on: | on: | ||||||
|   push: |   push: | ||||||
|     branches: [ main, pierremtb/issue5346-Multi-second-blank-screen-on-second-instance-of-the-app-workers-1 ] |     branches: [ main ] | ||||||
|   pull_request: |   pull_request: | ||||||
|  |     branches: [ main ] | ||||||
|  |  | ||||||
| concurrency: | concurrency: | ||||||
|   group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |   group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||||||
| @ -32,28 +33,21 @@ jobs: | |||||||
|             rust: |             rust: | ||||||
|               - 'src/wasm-lib/**' |               - 'src/wasm-lib/**' | ||||||
|  |  | ||||||
|   electron: |   browser: | ||||||
|     timeout-minutes: 60 |     timeout-minutes: ${{ matrix.os == 'macos-14' && 60 || 50 }} | ||||||
|     name: playwright:electron:${{ matrix.os }} ${{ matrix.shardIndex }} ${{ matrix.shardTotal }} |     name: playwright:browser:${{ matrix.os }} ${{ matrix.shardIndex }} ${{ matrix.shardTotal }} | ||||||
|     strategy: |     strategy: | ||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       matrix: | ||||||
|         # TODO: enable self-hosted-windows-8-cores once available |         os: [ubuntu-latest-8-cores, windows-latest-8-cores] | ||||||
|         os: [namespace-profile-ubuntu-8-cores, namespace-profile-macos-8-cores, windows-16-cores] |  | ||||||
|         shardIndex: [1, 2, 3, 4] |         shardIndex: [1, 2, 3, 4] | ||||||
|         shardTotal: [4] |         shardTotal: [4] | ||||||
|     runs-on: ${{ matrix.os }} |     runs-on: ${{ matrix.os }} | ||||||
|     needs: check-rust-changes |     needs: check-rust-changes | ||||||
|     steps: |     steps: | ||||||
|     - uses: actions/create-github-app-token@v1 |     - name: Tune GitHub-hosted runner network | ||||||
|       id: app-token |       uses: smorimoto/tune-github-hosted-runner-network@v1 | ||||||
|       with: |  | ||||||
|         app-id: ${{ secrets.MODELING_APP_GH_APP_ID }} |  | ||||||
|         private-key: ${{ secrets.MODELING_APP_GH_APP_PRIVATE_KEY }} |  | ||||||
|         owner: ${{ github.repository_owner }} |  | ||||||
|     - uses: actions/checkout@v4 |     - uses: actions/checkout@v4 | ||||||
|       with: |  | ||||||
|         token: ${{ steps.app-token.outputs.token }} |  | ||||||
|     - uses: actions/setup-node@v4 |     - uses: actions/setup-node@v4 | ||||||
|       with: |       with: | ||||||
|         node-version-file: '.nvmrc' |         node-version-file: '.nvmrc' | ||||||
| @ -74,7 +68,7 @@ jobs: | |||||||
|     - name: Download Wasm Cache |     - name: Download Wasm Cache | ||||||
|       id: download-wasm |       id: download-wasm | ||||||
|       if: needs.check-rust-changes.outputs.rust-changed == 'false' |       if: needs.check-rust-changes.outputs.rust-changed == 'false' | ||||||
|       uses: dawidd6/action-download-artifact@v7 |       uses: dawidd6/action-download-artifact@v6 | ||||||
|       continue-on-error: true |       continue-on-error: true | ||||||
|       with: |       with: | ||||||
|         github_token: ${{secrets.GITHUB_TOKEN}} |         github_token: ${{secrets.GITHUB_TOKEN}} | ||||||
| @ -107,8 +101,7 @@ jobs: | |||||||
|         echo "/opt/homebrew/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH |         echo "/opt/homebrew/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH | ||||||
|     - name: Install vector |     - name: Install vector | ||||||
|       shell: bash |       shell: bash | ||||||
|       # TODO: figure out what to do with this, it's failing |       if:  ${{ !startsWith(matrix.os, 'windows') }} | ||||||
|       if: false |  | ||||||
|       run: | |       run: | | ||||||
|         curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh |         curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh | ||||||
|         chmod +x /tmp/vector.sh |         chmod +x /tmp/vector.sh | ||||||
| @ -131,15 +124,12 @@ jobs: | |||||||
|       shell: bash |       shell: bash | ||||||
|       run: yarn build:wasm |       run: yarn build:wasm | ||||||
|     - name: build web |     - name: build web | ||||||
|  |       run: yarn build:local | ||||||
|       shell: bash |       shell: bash | ||||||
|       run: yarn tronb:vite:dev |  | ||||||
|     - name: Run ubuntu/chrome snapshots |     - name: Run ubuntu/chrome snapshots | ||||||
|       if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 }} |  | ||||||
|       shell: bash |       shell: bash | ||||||
|       # TODO: break this in its own job, for now it's not slowing down the overall execution as ubuntu is the quickest, |  | ||||||
|       # but we could do better. This forces a large 1/1 shard of all 20 snapshot tests that runs in about 3 minutes. |  | ||||||
|       run: | |       run: | | ||||||
|         PLATFORM=web yarn playwright test --config=playwright.config.ts --retries="3" --update-snapshots --grep=@snapshot  --shard=1/1 |         yarn playwright test --project="Google Chrome" --config=playwright.ci.config.ts --retries="3" --update-snapshots --grep=@snapshot  --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} | ||||||
|       env: |       env: | ||||||
|         CI: true |         CI: true | ||||||
|         NODE_ENV: development |         NODE_ENV: development | ||||||
| @ -160,11 +150,10 @@ jobs: | |||||||
|       continue-on-error: true |       continue-on-error: true | ||||||
|       run: rm -r test-results |       run: rm -r test-results | ||||||
|     - name: check for changes |     - name: check for changes | ||||||
|       if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 && github.ref != 'refs/heads/main' }} |  | ||||||
|       shell: bash |       shell: bash | ||||||
|       id: git-check |       id: git-check | ||||||
|       run: | |       run: | | ||||||
|           git add e2e/playwright/snapshot-tests.spec.ts-snapshots |           git add . | ||||||
|           if git status | grep -q "Changes to be committed" |           if git status | grep -q "Changes to be committed" | ||||||
|           then echo "modified=true" >> $GITHUB_OUTPUT |           then echo "modified=true" >> $GITHUB_OUTPUT | ||||||
|           else echo "modified=false" >> $GITHUB_OUTPUT |           else echo "modified=false" >> $GITHUB_OUTPUT | ||||||
| @ -173,14 +162,14 @@ jobs: | |||||||
|       if: steps.git-check.outputs.modified == 'true' |       if: steps.git-check.outputs.modified == 'true' | ||||||
|       shell: bash |       shell: bash | ||||||
|       run: | |       run: | | ||||||
|         git add e2e/playwright/snapshot-tests.spec.ts-snapshots |         git add . | ||||||
|         git config --local user.email "github-actions[bot]@users.noreply.github.com" |         git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||||||
|         git config --local user.name "github-actions[bot]" |         git config --local user.name "github-actions[bot]" | ||||||
|         git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git |         git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | ||||||
|         git fetch origin |         git fetch origin | ||||||
|         echo ${{ github.head_ref }} |         echo ${{ github.head_ref }} | ||||||
|         git checkout ${{ github.head_ref }} |         git checkout ${{ github.head_ref }} | ||||||
|         git commit -m "A snapshot a day keeps the bugs away! 📷🐛 (OS: ${{matrix.os}})" || true |         git commit -am "A snapshot a day keeps the bugs away! 📷🐛 (OS: ${{matrix.os}})" || true | ||||||
|         git push |         git push | ||||||
|         git push origin ${{ github.head_ref }} |         git push origin ${{ github.head_ref }} | ||||||
|     # only upload artifacts if there's actually changes |     # only upload artifacts if there's actually changes | ||||||
| @ -197,12 +186,12 @@ jobs: | |||||||
|       with: |       with: | ||||||
|         name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }} |         name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }} | ||||||
|         path: test-results/ |         path: test-results/ | ||||||
|     - name: Run playwright/electron flow (with retries) |     - name: Run playwright/chrome flow (with retries) | ||||||
|       id: retry |       id: retry | ||||||
|       if: ${{ !cancelled() && (success() || failure()) }} |       if: ${{ !cancelled() && (success() || failure()) }} | ||||||
|       shell: bash |       shell: bash | ||||||
|       run: | |       run: | | ||||||
|         .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}} |         .github/ci-cd-scripts/playwright-browser-chrome.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}} | ||||||
|       env: |       env: | ||||||
|         CI: true |         CI: true | ||||||
|         FAIL_ON_CONSOLE_ERRORS: true |         FAIL_ON_CONSOLE_ERRORS: true | ||||||
| @ -210,6 +199,11 @@ jobs: | |||||||
|         VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} |         VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} | ||||||
|         VITE_KC_SKIP_AUTH: true |         VITE_KC_SKIP_AUTH: true | ||||||
|         token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} |         token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} | ||||||
|  |     - name: send to axiom | ||||||
|  |       if: always() | ||||||
|  |       shell: bash | ||||||
|  |       run: | | ||||||
|  |         node playwrightProcess.mjs | tee /tmp/github-actions.log | ||||||
|     - uses: actions/upload-artifact@v4 |     - uses: actions/upload-artifact@v4 | ||||||
|       if: always() |       if: always() | ||||||
|       with: |       with: | ||||||
| @ -227,3 +221,136 @@ jobs: | |||||||
|         retention-days: 30 |         retention-days: 30 | ||||||
|         overwrite: true |         overwrite: true | ||||||
|  |  | ||||||
|  |  | ||||||
|  |   electron: | ||||||
|  |     name: playwright:electron:${{matrix.os}} | ||||||
|  |     strategy: | ||||||
|  |       fail-fast: false | ||||||
|  |       matrix: | ||||||
|  |         os: [ubuntu-latest-8-cores, windows-latest-8-cores, macos-14-large] | ||||||
|  |     timeout-minutes: 60 | ||||||
|  |     runs-on: ${{ matrix.os }} | ||||||
|  |     needs: check-rust-changes | ||||||
|  |     steps: | ||||||
|  |     - name: Tune GitHub-hosted runner network | ||||||
|  |       uses: smorimoto/tune-github-hosted-runner-network@v1 | ||||||
|  |     - uses: actions/checkout@v4 | ||||||
|  |     - uses: actions/setup-node@v4 | ||||||
|  |       with: | ||||||
|  |         node-version-file: '.nvmrc' | ||||||
|  |         cache: 'yarn' | ||||||
|  |     - uses: KittyCAD/action-install-cli@main | ||||||
|  |     - name: Install dependencies | ||||||
|  |       shell: bash | ||||||
|  |       run: yarn | ||||||
|  |     - name: Cache Playwright Browsers | ||||||
|  |       uses: actions/cache@v4 | ||||||
|  |       with: | ||||||
|  |         path: | | ||||||
|  |           ~/.cache/ms-playwright/ | ||||||
|  |         key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }} | ||||||
|  |     - name: Install Playwright Browsers | ||||||
|  |       shell: bash | ||||||
|  |       run: yarn playwright install chromium --with-deps | ||||||
|  |     - name: Download Wasm Cache | ||||||
|  |       id: download-wasm | ||||||
|  |       if: needs.check-rust-changes.outputs.rust-changed == 'false' | ||||||
|  |       uses: dawidd6/action-download-artifact@v6 | ||||||
|  |       continue-on-error: true | ||||||
|  |       with: | ||||||
|  |         github_token: ${{secrets.GITHUB_TOKEN}} | ||||||
|  |         name: wasm-bundle | ||||||
|  |         workflow: build-and-store-wasm.yml | ||||||
|  |         branch: main | ||||||
|  |         path: src/wasm-lib/pkg | ||||||
|  |     - name: copy wasm blob | ||||||
|  |       if: needs.check-rust-changes.outputs.rust-changed == 'false' | ||||||
|  |       shell: bash | ||||||
|  |       run: cp src/wasm-lib/pkg/wasm_lib_bg.wasm public | ||||||
|  |       continue-on-error: true | ||||||
|  |     - name: Setup Rust | ||||||
|  |       uses: dtolnay/rust-toolchain@stable | ||||||
|  |     - name: Cache Wasm (because rust diff) | ||||||
|  |       if: needs.check-rust-changes.outputs.rust-changed == 'true' | ||||||
|  |       uses: Swatinem/rust-cache@v2 | ||||||
|  |       with: | ||||||
|  |         workspaces: './src/wasm-lib' | ||||||
|  |     - name: OR Cache Wasm (because wasm cache failed) | ||||||
|  |       if: steps.download-wasm.outcome == 'failure' | ||||||
|  |       uses: Swatinem/rust-cache@v2 | ||||||
|  |       with: | ||||||
|  |         workspaces: './src/wasm-lib' | ||||||
|  |     - name: install good sed | ||||||
|  |       if:  ${{ startsWith(matrix.os, 'macos') }} | ||||||
|  |       shell: bash | ||||||
|  |       run: | | ||||||
|  |         brew install gnu-sed | ||||||
|  |         echo "/opt/homebrew/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH | ||||||
|  |     - name: Install vector | ||||||
|  |       if:  ${{ startsWith(matrix.os, 'ubuntu') }} | ||||||
|  |       shell: bash | ||||||
|  |       run: | | ||||||
|  |         curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh | ||||||
|  |         chmod +x /tmp/vector.sh | ||||||
|  |         /tmp/vector.sh -y -no-modify-path | ||||||
|  |         mkdir -p /tmp/vector | ||||||
|  |         cp .github/workflows/vector.toml /tmp/vector.toml | ||||||
|  |         sed -i "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml | ||||||
|  |         sed -i "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml | ||||||
|  |         sed -i "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml | ||||||
|  |         sed -i "s#GITHUB_REF_NAME#${GITHUB_REF_NAME}#g" /tmp/vector.toml | ||||||
|  |         sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${{secrets.GH_ACTIONS_AXIOM_TOKEN}}#g" /tmp/vector.toml | ||||||
|  |         cat /tmp/vector.toml | ||||||
|  |         ${HOME}/.vector/bin/vector --config /tmp/vector.toml & | ||||||
|  |     - name: Build Wasm (because rust diff) | ||||||
|  |       if: needs.check-rust-changes.outputs.rust-changed == 'true' | ||||||
|  |       shell: bash | ||||||
|  |       run: yarn build:wasm | ||||||
|  |     - name: OR Build Wasm (because wasm cache failed) | ||||||
|  |       if: steps.download-wasm.outcome == 'failure' | ||||||
|  |       shell: bash | ||||||
|  |       run: yarn build:wasm | ||||||
|  |     - name: build electron | ||||||
|  |       shell: bash | ||||||
|  |       run: yarn tron:package | ||||||
|  |     - uses: actions/download-artifact@v4 | ||||||
|  |       if: ${{ !cancelled() && (success() || failure()) }} | ||||||
|  |       continue-on-error: true | ||||||
|  |       with: | ||||||
|  |         name: test-results-electron-${{ matrix.os }}-${{ github.sha }} | ||||||
|  |         path: test-results/ | ||||||
|  |     - name: Run electron tests (with retries) | ||||||
|  |       id: retry | ||||||
|  |       if: ${{ !cancelled() && (success() || failure()) }} | ||||||
|  |       shell: bash | ||||||
|  |       run: | | ||||||
|  |         .github/ci-cd-scripts/playwright-electron.sh ${{ matrix.os }} | ||||||
|  |       env: | ||||||
|  |         CI: true | ||||||
|  |         FAIL_ON_CONSOLE_ERRORS: true | ||||||
|  |         NODE_ENV: development | ||||||
|  |         VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} | ||||||
|  |         VITE_KC_SKIP_AUTH: true | ||||||
|  |         IS_UBUNTU: ${{ startsWith(matrix.os, 'ubuntu') && 'true' || 'false' }} | ||||||
|  |         #DEBUG: 'pw:browser*' | ||||||
|  |     - name: send to axiom | ||||||
|  |       if: ${{ !cancelled() && (success() || failure()) && !startsWith(matrix.os, 'windows') }} | ||||||
|  |       shell: bash | ||||||
|  |       run: | | ||||||
|  |         node playwrightProcess.mjs | tee /tmp/github-actions.log | ||||||
|  |     - uses: actions/upload-artifact@v4 | ||||||
|  |       if: ${{ !cancelled() && (success() || failure()) }} | ||||||
|  |       with: | ||||||
|  |         name: test-results-electron-${{ matrix.os }}-${{ github.sha }} | ||||||
|  |         path: test-results/ | ||||||
|  |         include-hidden-files: true | ||||||
|  |         retention-days: 30 | ||||||
|  |         overwrite: true | ||||||
|  |     - uses: actions/upload-artifact@v4 | ||||||
|  |       if: ${{ !cancelled() && (success() || failure()) }} | ||||||
|  |       with: | ||||||
|  |         name: playwright-report-electron-${{ matrix.os }}-${{ github.sha }} | ||||||
|  |         path: playwright-report/ | ||||||
|  |         include-hidden-files: true | ||||||
|  |         retention-days: 30 | ||||||
|  |         overwrite: true | ||||||
|  | |||||||
							
								
								
									
										18
									
								
								.github/workflows/publish-apps-release.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						| @ -108,17 +108,17 @@ jobs: | |||||||
|         run: yarn files:set-notes |         run: yarn files:set-notes | ||||||
|  |  | ||||||
|       - name: Authenticate to Google Cloud |       - name: Authenticate to Google Cloud | ||||||
|         uses: 'google-github-actions/auth@v2.1.8' |         uses: 'google-github-actions/auth@v2.1.7' | ||||||
|         with: |         with: | ||||||
|           credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}' |           credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}' | ||||||
|  |  | ||||||
|       - name: Set up Google Cloud SDK |       - name: Set up Google Cloud SDK | ||||||
|         uses: google-github-actions/setup-gcloud@v2.1.4 |         uses: google-github-actions/setup-gcloud@v2.1.2 | ||||||
|         with: |         with: | ||||||
|           project_id: ${{ env.GOOGLE_CLOUD_PROJECT_ID }} |           project_id: ${{ env.GOOGLE_CLOUD_PROJECT_ID }} | ||||||
|  |  | ||||||
|       - name: Upload release files to public bucket |       - name: Upload release files to public bucket | ||||||
|         uses: google-github-actions/upload-cloud-storage@v2.2.2 |         uses: google-github-actions/upload-cloud-storage@v2.2.1 | ||||||
|         with: |         with: | ||||||
|           path: out |           path: out | ||||||
|           glob: '*' |           glob: '*' | ||||||
| @ -126,13 +126,11 @@ jobs: | |||||||
|           destination: 'dl.kittycad.io/releases/modeling-app' |           destination: 'dl.kittycad.io/releases/modeling-app' | ||||||
|  |  | ||||||
|       - name: Invalidate bucket cache on latest*.yml and last_download.json files |       - name: Invalidate bucket cache on latest*.yml and last_download.json files | ||||||
|         run: yarn files:invalidate-bucket |         run: | | ||||||
|  |           gcloud compute url-maps invalidate-cdn-cache dl-url-map --path="/releases/modeling-app/last_download.json" --async | ||||||
|       - name: Upload release files to Github |           gcloud compute url-maps invalidate-cdn-cache dl-url-map --path="/releases/modeling-app/latest-linux-arm64.yml" --async | ||||||
|         if: ${{ github.event_name == 'release' }} |           gcloud compute url-maps invalidate-cdn-cache dl-url-map --path="/releases/modeling-app/latest-mac.yml" --async | ||||||
|         uses: softprops/action-gh-release@v2 |           gcloud compute url-maps invalidate-cdn-cache dl-url-map --path="/releases/modeling-app/latest.yml" --async | ||||||
|         with: |  | ||||||
|           files: 'out/Zoo*' |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   announce_release: |   announce_release: | ||||||
|  | |||||||
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						| @ -25,7 +25,6 @@ yarn-error.log* | |||||||
|  |  | ||||||
| .idea | .idea | ||||||
| .vscode | .vscode | ||||||
| .helix |  | ||||||
| src/wasm-lib/.idea | src/wasm-lib/.idea | ||||||
| src/wasm-lib/.vscode | src/wasm-lib/.vscode | ||||||
|  |  | ||||||
| @ -45,7 +44,7 @@ e2e/playwright/temp3.png | |||||||
| e2e/playwright/export-snapshots/* | e2e/playwright/export-snapshots/* | ||||||
| !e2e/playwright/export-snapshots/*.png | !e2e/playwright/export-snapshots/*.png | ||||||
|  |  | ||||||
| /kcl-samples |  | ||||||
| /test-results/ | /test-results/ | ||||||
| /playwright-report/ | /playwright-report/ | ||||||
| /blob-report/ | /blob-report/ | ||||||
| @ -62,7 +61,6 @@ Mac_App_Distribution.provisionprofile | |||||||
| *.tsbuildinfo | *.tsbuildinfo | ||||||
| src/wasm-lib/pkg | src/wasm-lib/pkg | ||||||
|  |  | ||||||
| .eslintcache |  | ||||||
| venv | venv | ||||||
| .vite/ | .vite/ | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,2 +0,0 @@ | |||||||
| [editor] |  | ||||||
| auto-format = true |  | ||||||
| @ -1,10 +0,0 @@ | |||||||
| [language-server.eslint] |  | ||||||
| args = ["--stdio"] |  | ||||||
| command = "vscode-eslint-language-server" |  | ||||||
|  |  | ||||||
| [[language]] |  | ||||||
| name = "typescript" |  | ||||||
| auto-format = true |  | ||||||
| formatter = { command = "node_modules/.bin/prettier", args = ["--parser", "typescript"] } |  | ||||||
| language-servers = [ { name = "eslint", only-features = [ "diagnostics" ] }, "typescript-language-server" ] |  | ||||||
|  |  | ||||||
							
								
								
									
										43
									
								
								INSTALL.md
									
									
									
									
									
								
							
							
						
						| @ -1,43 +0,0 @@ | |||||||
| # Setting Up Zoo Modeling App |  | ||||||
|  |  | ||||||
| Compared to other CAD software, getting Zoo Modeling App up and running is quick and straightforward across platforms. It's about 100MB to download and is quick to install. |  | ||||||
|  |  | ||||||
| ## Windows |  | ||||||
|  |  | ||||||
| 1. Download the [Zoo Modeling App installer](https://zoo.dev/modeling-app/download) for Windows and for your processor type. |  | ||||||
|  |  | ||||||
| 2. Once downloaded, run the installer `Zoo Modeling App-{version}-{arch}-win.exe` which should take a few seconds. |  | ||||||
|  |  | ||||||
| 3. The installation happens at `C:\Program Files\Zoo Modeling App`. A shortcut in the start menu is also created so you can run the app easily by clicking on it. |  | ||||||
|  |  | ||||||
| ## macOS |  | ||||||
|  |  | ||||||
| 1. Download the [Zoo Modeling App installer](https://zoo.dev/modeling-app/download) for macOS and for your processor type. |  | ||||||
|  |  | ||||||
| 2. Once downloaded, open the disk image `Zoo Modeling App-{version}-{arch}-mac.dmg` and drag the applications to your `Applications` directory. |  | ||||||
|  |  | ||||||
| 3. You can then open your `Applications` directory and double-click on `Zoo Modeling App` to open. |  | ||||||
|  |  | ||||||
|  |  | ||||||
| ## Linux  |  | ||||||
|  |  | ||||||
| 1. Download the [Zoo Modeling App installer](https://zoo.dev/modeling-app/download) for Linux and for your processor type. |  | ||||||
|  |  | ||||||
| 2. Install the dependencies needed to run the [AppImage format](https://appimage.org/). |  | ||||||
|     -  On Ubuntu, install the FUSE library with these commands in a terminal. |  | ||||||
|        ```bash |  | ||||||
|        sudo apt update |  | ||||||
|        sudo apt install libfuse2 |  | ||||||
|        ``` |  | ||||||
|     - Optionally, follow [these steps](https://github.com/probonopd/go-appimage/blob/master/src/appimaged/README.md#initial-setup) to install `appimaged`. It is a daemon that makes interacting with AppImage files more seamless.  |  | ||||||
|     - Once installed, copy the downloaded `Zoo Modeling App-{version}-{arch}-linux.AppImage` to the directory of your choice, for instance `~/Applications`. |  | ||||||
|  |  | ||||||
|    - `appimaged` should automatically find it and make it executable. If not, run: |  | ||||||
|      ```bash |  | ||||||
|      chmod a+x ~/Applications/Zoo\ Modeling\ App-{version}-{arch}-linux.AppImage |  | ||||||
|      ``` |  | ||||||
|  |  | ||||||
| 3. You can double-click on the AppImage to run it, or in a terminal with this command: |  | ||||||
|    ```bash |  | ||||||
|     ~/Applications/Zoo\ Modeling\ App-{version}-{arch}-linux.AppImage |  | ||||||
|    ``` |  | ||||||
							
								
								
									
										79
									
								
								README.md
									
									
									
									
									
								
							
							
						
						| @ -99,9 +99,9 @@ yarn tron:start | |||||||
|  |  | ||||||
| This will start the application and hot-reload on changes. | This will start the application and hot-reload on changes. | ||||||
|  |  | ||||||
| Devtools can be opened with the usual Cmd-Opt-I (Mac) or Ctrl-Shift-I (Linux and Windows). | Devtools can be opened with the usual Cmd/Ctrl-Shift-I. | ||||||
|  |  | ||||||
| To build with electron-builder, run `yarn tronb:package:dev` (or `yarn tronb:package:prod` to point to the .env.production variables) | To build, run `yarn tron:package`. | ||||||
|  |  | ||||||
| ## Checking out commits / Bisecting | ## Checking out commits / Bisecting | ||||||
|  |  | ||||||
| @ -136,7 +136,7 @@ https://github.com/KittyCAD/modeling-app/issues/new | |||||||
|  |  | ||||||
| #### 2. Push a new tag | #### 2. Push a new tag | ||||||
|  |  | ||||||
| Create a new tag and push it to the repo. The `semantic-release.sh` script will automatically bump the minor part, which we use the most. For instance going from `v0.27.0` to `v0.28.0`. | Create a new tag and push it to the repo (eg. `v0.28.0` for `$VERSION`) | ||||||
|  |  | ||||||
| ``` | ``` | ||||||
| VERSION=$(./scripts/semantic-release.sh) | VERSION=$(./scripts/semantic-release.sh) | ||||||
| @ -146,14 +146,16 @@ git push origin --tags | |||||||
|  |  | ||||||
| This will trigger the `build-apps` workflow, set the version, build & sign the apps, and generate release files as well as updater-test artifacts. | This will trigger the `build-apps` workflow, set the version, build & sign the apps, and generate release files as well as updater-test artifacts. | ||||||
|  |  | ||||||
| The workflow should be listed right away [in this list](https://github.com/KittyCAD/modeling-app/actions/workflows/build-apps.yml?query=event%3Apush)). | Once the workflow succeeds, a draft release will be created at https://github.com/KittyCAD/modeling-app/releases. | ||||||
|  |  | ||||||
| #### 3. Manually test artifacts | #### 3. Manually test artifacts from the Cut Release PR | ||||||
|  |  | ||||||
| ##### Release builds | ##### Release builds | ||||||
|  |  | ||||||
| The release builds can be found under the `out-{arch}-{platform}` zip files, at the very bottom of the `build-apps` summary page for the workflow (triggered by the tag in 2.). | The release builds can be found under the `out-{arch}-{platform}` zip files, at the very bottom of the `build-apps` summary page for the workflow (triggered by the tag in 2.). | ||||||
|  |  | ||||||
|  | Alternatively, the draft release will also include these builds. | ||||||
|  |  | ||||||
| Manually test against this [list](https://github.com/KittyCAD/modeling-app/issues/3588) across Windows, MacOS, Linux and posting results as comments in the issue. | Manually test against this [list](https://github.com/KittyCAD/modeling-app/issues/3588) across Windows, MacOS, Linux and posting results as comments in the issue. | ||||||
|  |  | ||||||
| ##### Updater-test builds | ##### Updater-test builds | ||||||
| @ -176,11 +178,9 @@ If the prompt doesn't show up, start the app in command line to grab the electro | |||||||
|  |  | ||||||
| #### 4. Publish the release | #### 4. Publish the release | ||||||
|  |  | ||||||
| Head over to https://github.com/KittyCAD/modeling-app/releases/new, pick the newly created tag and type it in the _Release title_ field as well. | Head over to https://github.com/KittyCAD/modeling-app/releases, paste in the changelog discussed in the issue, and publish the draft release created by the `build-apps` workflow from step 2. | ||||||
|  |  | ||||||
| Hit _Generate release notes_ as a starting point to discuss the changelog in the issue. Once done, make sure _Set as the latest release_ is checked, and hit _Publish release_.  | A new Action kicks in at https://github.com/KittyCAD/modeling-app/actions, which can be found under `release` event filter. On success, the files will be uploaded to the public bucket and the announcement on Discord will be sent.  | ||||||
|  |  | ||||||
| A new `publish-apps-release` will kick in and you should be able to find it [here](https://github.com/KittyCAD/modeling-app/actions?query=event%3Arelease). On success, the files will be uploaded to the public bucket as well as to the GitHub release, and the announcement on Discord will be sent.  |  | ||||||
|  |  | ||||||
| #### 5. Close the issue | #### 5. Close the issue | ||||||
|  |  | ||||||
| @ -337,47 +337,13 @@ For individual testing: | |||||||
| yarn test abstractSyntaxTree -t "unexpected closed curly brace" --silent=false | yarn test abstractSyntaxTree -t "unexpected closed curly brace" --silent=false | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testing Library E2E](https://testing-library.com/docs/react-testing-library/intro) tests, in interactive mode by default. | Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testing Library E2E](https://testing-library.com/docs/react-testing-library/intro/) tests, in interactive mode by default. | ||||||
|  |  | ||||||
| ### Rust tests | ### Rust tests | ||||||
|  |  | ||||||
| **Dependencies** |  | ||||||
|  |  | ||||||
| - `KITTYCAD_API_TOKEN` |  | ||||||
| - `cargo-nextest` |  | ||||||
| - `just` |  | ||||||
|  |  | ||||||
| #### Setting KITTYCAD_API_TOKEN |  | ||||||
| Use the production zoo.dev token, set this environment variable before running the tests |  | ||||||
|  |  | ||||||
| #### Installing cargonextest |  | ||||||
|  |  | ||||||
| ``` |  | ||||||
| cd src/wasm-lib |  | ||||||
| cargo search cargo-nextest |  | ||||||
| cargo install cargo-nextest |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| #### just |  | ||||||
| install [`just`](https://github.com/casey/just?tab=readme-ov-file#pre-built-binaries) |  | ||||||
|  |  | ||||||
| #### Running the tests |  | ||||||
|  |  | ||||||
| ```bash | ```bash | ||||||
| # With just |  | ||||||
| # Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set |  | ||||||
| # Make sure you installed cargo-nextest |  | ||||||
| # Make sure you installed just |  | ||||||
| cd src/wasm-lib | cd src/wasm-lib | ||||||
| just test | KITTYCAD_API_TOKEN=XXX cargo test -- --test-threads=1 | ||||||
| ``` |  | ||||||
|  |  | ||||||
| ```bash |  | ||||||
| # Without just |  | ||||||
| # Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set |  | ||||||
| # Make sure you installed cargo-nextest |  | ||||||
| cd src/wasm-lib |  | ||||||
| export RUST_BRACKTRACE="full" && cargo nextest run --workspace --test-threads=1 |  | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| Where `XXX` is an API token from the production engine (NOT the dev environment). | Where `XXX` is an API token from the production engine (NOT the dev environment). | ||||||
| @ -422,6 +388,23 @@ yarn test:unit:local | |||||||
|  |  | ||||||
| #### E2E Tests | #### E2E Tests | ||||||
|  |  | ||||||
|  | **Playwright Browser** | ||||||
|  |  | ||||||
|  | These E2E tests run in a browser (without electron). | ||||||
|  | There are tests that are skipped if they are ran in a windows OS or Linux OS. We can use playwright tags to implement test skipping. | ||||||
|  |  | ||||||
|  | Breaking down the command `yarn test:playwright:browser:chrome:windows` | ||||||
|  | - The application is `playwright` | ||||||
|  | - The runtime is a `browser` | ||||||
|  | - The specific `browser` is `chrome` | ||||||
|  | - The test should run in a `windows` environment. It will skip tests that are broken or flaky in the windows OS. | ||||||
|  |  | ||||||
|  | ``` | ||||||
|  | yarn test:playwright:browser:chrome | ||||||
|  | yarn test:playwright:browser:chrome:windows | ||||||
|  | yarn test:playwright:browser:chrome:ubuntu | ||||||
|  | ``` | ||||||
|  |  | ||||||
| **Playwright Electron** | **Playwright Electron** | ||||||
|  |  | ||||||
| These E2E tests run in electron. There are tests that are skipped if they are ran in a windows, linux, or macos environment. We can use playwright tags to implement test skipping. | These E2E tests run in electron. There are tests that are skipped if they are ran in a windows, linux, or macos environment. We can use playwright tags to implement test skipping. | ||||||
| @ -467,9 +450,3 @@ PS: for the debug panel, the following JSON is useful for snapping the camera | |||||||
| ## KCL | ## KCL | ||||||
|  |  | ||||||
| For how to contribute to KCL, [see our KCL README](https://github.com/KittyCAD/modeling-app/tree/main/src/wasm-lib/kcl). | For how to contribute to KCL, [see our KCL README](https://github.com/KittyCAD/modeling-app/tree/main/src/wasm-lib/kcl). | ||||||
|  |  | ||||||
| ### Logging |  | ||||||
|  |  | ||||||
| To display logging (to the terminal or console) set `ZOO_LOG=1`. This will log some warnings and simple performance metrics. To view these in test runs, use `-- --nocapture`. |  | ||||||
|  |  | ||||||
| To enable memory metrics, build with `--features dhat-heap`. |  | ||||||
|  | |||||||
| Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 176 KiB | 
| Before Width: | Height: | Size: 259 KiB After Width: | Height: | Size: 157 KiB | 
							
								
								
									
										
											BIN
										
									
								
								assets/icon.ico
									
									
									
									
									
								
							
							
						
						| Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 183 KiB | 
							
								
								
									
										
											BIN
										
									
								
								assets/icon.png
									
									
									
									
									
								
							
							
						
						| Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 113 KiB | 
| @ -22,5 +22,3 @@ once fixed in engine will just start working here with no language changes. | |||||||
|  |  | ||||||
| - **Chamfers**: Chamfers cannot intersect, you will get an error. Only simple | - **Chamfers**: Chamfers cannot intersect, you will get an error. Only simple | ||||||
|     chamfer cases work currently. |     chamfer cases work currently. | ||||||
|  |  | ||||||
| - **Appearance**: Changing the appearance on a loft does not work. |  | ||||||
|  | |||||||
| @ -36,12 +36,12 @@ filletRadius = 2 | |||||||
|  |  | ||||||
| mountingPlateSketch = startSketchOn("XY") | mountingPlateSketch = startSketchOn("XY") | ||||||
|   |> startProfileAt([-width / 2, -length / 2], %) |   |> startProfileAt([-width / 2, -length / 2], %) | ||||||
|   |> line(endAbsolute = [width / 2, -length / 2], tag = $edge1) |   |> lineTo([width / 2, -length / 2], %, $edge1) | ||||||
|   |> line(endAbsolute = [width / 2, length / 2], tag = $edge2) |   |> lineTo([width / 2, length / 2], %, $edge2) | ||||||
|   |> line(endAbsolute = [-width / 2, length / 2], tag = $edge3) |   |> lineTo([-width / 2, length / 2], %, $edge3) | ||||||
|   |> close(tag = $edge4) |   |> close(%, $edge4) | ||||||
|  |  | ||||||
| mountingPlate = extrude(mountingPlateSketch, length = thickness) | mountingPlate = extrude(thickness, mountingPlateSketch) | ||||||
|   |> fillet({ |   |> fillet({ | ||||||
|        radius = filletRadius, |        radius = filletRadius, | ||||||
|        tags = [ |        tags = [ | ||||||
| @ -63,12 +63,12 @@ filletRadius = 1 | |||||||
|  |  | ||||||
| mountingPlateSketch = startSketchOn("XY") | mountingPlateSketch = startSketchOn("XY") | ||||||
|   |> startProfileAt([-width / 2, -length / 2], %) |   |> startProfileAt([-width / 2, -length / 2], %) | ||||||
|   |> line(endAbsolute = [width / 2, -length / 2], tag = $edge1) |   |> lineTo([width / 2, -length / 2], %, $edge1) | ||||||
|   |> line(endAbsolute = [width / 2, length / 2], tag = $edge2) |   |> lineTo([width / 2, length / 2], %, $edge2) | ||||||
|   |> line(endAbsolute = [-width / 2, length / 2], tag = $edge3) |   |> lineTo([-width / 2, length / 2], %, $edge3) | ||||||
|   |> close(tag = $edge4) |   |> close(%, $edge4) | ||||||
|  |  | ||||||
| mountingPlate = extrude(mountingPlateSketch, length = thickness) | mountingPlate = extrude(thickness, mountingPlateSketch) | ||||||
|   |> fillet({ |   |> fillet({ | ||||||
|        radius = filletRadius, |        radius = filletRadius, | ||||||
|        tolerance = 0.000001, |        tolerance = 0.000001, | ||||||
|  | |||||||
| @ -19,7 +19,6 @@ layout: manual | |||||||
| * [`angledLineThatIntersects`](kcl/angledLineThatIntersects) | * [`angledLineThatIntersects`](kcl/angledLineThatIntersects) | ||||||
| * [`angledLineToX`](kcl/angledLineToX) | * [`angledLineToX`](kcl/angledLineToX) | ||||||
| * [`angledLineToY`](kcl/angledLineToY) | * [`angledLineToY`](kcl/angledLineToY) | ||||||
| * [`appearance`](kcl/appearance) |  | ||||||
| * [`arc`](kcl/arc) | * [`arc`](kcl/arc) | ||||||
| * [`arcTo`](kcl/arcTo) | * [`arcTo`](kcl/arcTo) | ||||||
| * [`asin`](kcl/asin) | * [`asin`](kcl/asin) | ||||||
| @ -30,12 +29,10 @@ layout: manual | |||||||
| * [`assertLessThan`](kcl/assertLessThan) | * [`assertLessThan`](kcl/assertLessThan) | ||||||
| * [`assertLessThanOrEq`](kcl/assertLessThanOrEq) | * [`assertLessThanOrEq`](kcl/assertLessThanOrEq) | ||||||
| * [`atan`](kcl/atan) | * [`atan`](kcl/atan) | ||||||
| * [`atan2`](kcl/atan2) |  | ||||||
| * [`bezierCurve`](kcl/bezierCurve) | * [`bezierCurve`](kcl/bezierCurve) | ||||||
| * [`ceil`](kcl/ceil) | * [`ceil`](kcl/ceil) | ||||||
| * [`chamfer`](kcl/chamfer) | * [`chamfer`](kcl/chamfer) | ||||||
| * [`circle`](kcl/circle) | * [`circle`](kcl/circle) | ||||||
| * [`circleThreePoint`](kcl/circleThreePoint) |  | ||||||
| * [`close`](kcl/close) | * [`close`](kcl/close) | ||||||
| * [`cm`](kcl/cm) | * [`cm`](kcl/cm) | ||||||
| * [`cos`](kcl/cos) | * [`cos`](kcl/cos) | ||||||
| @ -48,16 +45,18 @@ layout: manual | |||||||
| * [`getOppositeEdge`](kcl/getOppositeEdge) | * [`getOppositeEdge`](kcl/getOppositeEdge) | ||||||
| * [`getPreviousAdjacentEdge`](kcl/getPreviousAdjacentEdge) | * [`getPreviousAdjacentEdge`](kcl/getPreviousAdjacentEdge) | ||||||
| * [`helix`](kcl/helix) | * [`helix`](kcl/helix) | ||||||
| * [`helixRevolutions`](kcl/helixRevolutions) |  | ||||||
| * [`hole`](kcl/hole) | * [`hole`](kcl/hole) | ||||||
| * [`hollow`](kcl/hollow) | * [`hollow`](kcl/hollow) | ||||||
|  | * [`import`](kcl/import) | ||||||
| * [`inch`](kcl/inch) | * [`inch`](kcl/inch) | ||||||
|  | * [`int`](kcl/int) | ||||||
| * [`lastSegX`](kcl/lastSegX) | * [`lastSegX`](kcl/lastSegX) | ||||||
| * [`lastSegY`](kcl/lastSegY) | * [`lastSegY`](kcl/lastSegY) | ||||||
| * [`legAngX`](kcl/legAngX) | * [`legAngX`](kcl/legAngX) | ||||||
| * [`legAngY`](kcl/legAngY) | * [`legAngY`](kcl/legAngY) | ||||||
| * [`legLen`](kcl/legLen) | * [`legLen`](kcl/legLen) | ||||||
| * [`line`](kcl/line) | * [`line`](kcl/line) | ||||||
|  | * [`lineTo`](kcl/lineTo) | ||||||
| * [`ln`](kcl/ln) | * [`ln`](kcl/ln) | ||||||
| * [`loft`](kcl/loft) | * [`loft`](kcl/loft) | ||||||
| * [`log`](kcl/log) | * [`log`](kcl/log) | ||||||
| @ -79,7 +78,6 @@ layout: manual | |||||||
| * [`pi`](kcl/pi) | * [`pi`](kcl/pi) | ||||||
| * [`polar`](kcl/polar) | * [`polar`](kcl/polar) | ||||||
| * [`polygon`](kcl/polygon) | * [`polygon`](kcl/polygon) | ||||||
| * [`pop`](kcl/pop) |  | ||||||
| * [`pow`](kcl/pow) | * [`pow`](kcl/pow) | ||||||
| * [`profileStart`](kcl/profileStart) | * [`profileStart`](kcl/profileStart) | ||||||
| * [`profileStartX`](kcl/profileStartX) | * [`profileStartX`](kcl/profileStartX) | ||||||
| @ -101,8 +99,8 @@ layout: manual | |||||||
| * [`sin`](kcl/sin) | * [`sin`](kcl/sin) | ||||||
| * [`sqrt`](kcl/sqrt) | * [`sqrt`](kcl/sqrt) | ||||||
| * [`startProfileAt`](kcl/startProfileAt) | * [`startProfileAt`](kcl/startProfileAt) | ||||||
|  | * [`startSketchAt`](kcl/startSketchAt) | ||||||
| * [`startSketchOn`](kcl/startSketchOn) | * [`startSketchOn`](kcl/startSketchOn) | ||||||
| * [`sweep`](kcl/sweep) |  | ||||||
| * [`tan`](kcl/tan) | * [`tan`](kcl/tan) | ||||||
| * [`tangentToEnd`](kcl/tangentToEnd) | * [`tangentToEnd`](kcl/tangentToEnd) | ||||||
| * [`tangentialArc`](kcl/tangentialArc) | * [`tangentialArc`](kcl/tangentialArc) | ||||||
|  | |||||||
							
								
								
									
										44
									
								
								docs/kcl/lineTo.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -29,7 +29,7 @@ map(array: [KclValue], map_fn: FunctionParam) -> [KclValue] | |||||||
|  |  | ||||||
| ```js | ```js | ||||||
| r = 10 // radius | r = 10 // radius | ||||||
| fn drawCircle(id) { | fn drawCircle = (id) => { | ||||||
|   return startSketchOn("XY") |   return startSketchOn("XY") | ||||||
|     |> circle({ center = [id * 2 * r, 0], radius = r }, %) |     |> circle({ center = [id * 2 * r, 0], radius = r }, %) | ||||||
| } | } | ||||||
| @ -45,7 +45,7 @@ circles = map([1..3], drawCircle) | |||||||
| ```js | ```js | ||||||
| r = 10 // radius | r = 10 // radius | ||||||
| // Call `map`, using an anonymous function instead of a named one. | // Call `map`, using an anonymous function instead of a named one. | ||||||
| circles = map([1..3], fn(id) { | circles = map([1..3], (id) => { | ||||||
|   return startSketchOn("XY") |   return startSketchOn("XY") | ||||||
|     |> circle({ center = [id * 2 * r, 0], radius = r }, %) |     |> circle({ center = [id * 2 * r, 0], radius = r }, %) | ||||||
| }) | }) | ||||||
|  | |||||||
| @ -12,7 +12,7 @@ to other modules. | |||||||
|  |  | ||||||
| ``` | ``` | ||||||
| // util.kcl | // util.kcl | ||||||
| export fn increment(x) { | export fn increment = (x) => { | ||||||
|   return x + 1 |   return x + 1 | ||||||
| } | } | ||||||
| ``` | ``` | ||||||
| @ -37,11 +37,11 @@ Multiple functions can be exported in a file. | |||||||
|  |  | ||||||
| ``` | ``` | ||||||
| // util.kcl | // util.kcl | ||||||
| export fn increment(x) { | export fn increment = (x) => { | ||||||
|   return x + 1 |   return x + 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| export fn decrement(x) { | export fn decrement = (x) => { | ||||||
|   return x - 1 |   return x - 1 | ||||||
| } | } | ||||||
| ``` | ``` | ||||||
| @ -57,55 +57,3 @@ Imported symbols can be renamed for convenience or to avoid name collisions. | |||||||
| ``` | ``` | ||||||
| import increment as inc, decrement as dec from "util.kcl" | import increment as inc, decrement as dec from "util.kcl" | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| ## Importing files from other CAD systems |  | ||||||
|  |  | ||||||
| `import` can also be used to import files from other CAD systems. The format of the statement is the |  | ||||||
| same as for KCL files. You can only import the whole file, not items from it. E.g., |  | ||||||
|  |  | ||||||
| ``` |  | ||||||
| import "tests/inputs/cube.obj" |  | ||||||
|  |  | ||||||
| // Use `cube` just like a KCL object. |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| ``` |  | ||||||
| import "tests/inputs/cube-2.sldprt" as cube |  | ||||||
|  |  | ||||||
| // Use `cube` just like a KCL object. |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| You can make the file format explicit using a format attribute (useful if using a different |  | ||||||
| extension), e.g., |  | ||||||
|  |  | ||||||
| ``` |  | ||||||
| @(format = obj) |  | ||||||
| import "tests/inputs/cube" |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| For formats lacking unit data (such as STL, OBJ, or PLY files), the default |  | ||||||
| unit of measurement is millimeters. Alternatively you may specify the unit |  | ||||||
| by using an attirbute. Likewise, you can also specify a coordinate system. E.g., |  | ||||||
|  |  | ||||||
| ``` |  | ||||||
| @(unitLength = ft, coords = opengl) |  | ||||||
| import "tests/inputs/cube.obj" |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| When importing a GLTF file, the bin file will be imported as well. |  | ||||||
|  |  | ||||||
| Import paths are relative to the current project directory. Imports currently only work when |  | ||||||
| using the native Modeling App, not in the browser. |  | ||||||
|  |  | ||||||
| ### Supported values |  | ||||||
|  |  | ||||||
| File formats: `fbx`, `gltf`/`glb`, `obj`+, `ply`+, `sldprt`, `step`/`stp`, `stl`+. (Those marked with a |  | ||||||
| '+' support customising the length unit and coordinate system). |  | ||||||
|  |  | ||||||
| Length units: `mm` (the default), `cm`, `m`, `inch`, `ft`, `yd`. |  | ||||||
|  |  | ||||||
| Coordinate systems: |  | ||||||
|  |  | ||||||
| - `zoo` (the default), forward: -Y, up: +Z, handedness: right |  | ||||||
| - `opengl`, forward: +Z, up: +Y, handedness: right |  | ||||||
| - `vulkan`, forward: +Z, up: -Y, handedness: left |  | ||||||
|  | |||||||
