Compare commits
	
		
			7 Commits
		
	
	
		
			jess/chang
			...
			pierremtb/
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| fe5f197bdc | |||
| ab49da1685 | |||
| 0bab975560 | |||
| 38a7c767c2 | |||
| 8d62ed3cde | |||
| 3e884bd0db | |||
| 0c1a697fec | 
							
								
								
									
										213
									
								
								.github/workflows/e2e-tests.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										213
									
								
								.github/workflows/e2e-tests.yml
									
									
									
									
										vendored
									
									
								
							| @ -1,7 +1,7 @@ | ||||
| name: E2E Tests | ||||
| on: | ||||
|   push: | ||||
|     branches: [ main ] | ||||
|     branches: [ main, pierremtb/adhoc/e2e-no-cache-no-shard ] | ||||
|   pull_request: | ||||
|  | ||||
| concurrency: | ||||
| @ -15,35 +15,14 @@ permissions: | ||||
|  | ||||
|  | ||||
| jobs: | ||||
|  | ||||
|   check-rust-changes: | ||||
|     runs-on: ubuntu-latest | ||||
|     outputs: | ||||
|       rust-changed: ${{ steps.filter.outputs.rust }} | ||||
|  | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|  | ||||
|       - id: filter | ||||
|         name: Check for Rust changes | ||||
|         uses: dorny/paths-filter@v3 | ||||
|         with: | ||||
|           filters: | | ||||
|             rust: | ||||
|               - 'src/wasm-lib/**' | ||||
|  | ||||
|   electron: | ||||
|     timeout-minutes: 60 | ||||
|     name: playwright:electron:${{ matrix.os }} ${{ matrix.shardIndex }} ${{ matrix.shardTotal }} | ||||
|     name: playwright:electron:${{ matrix.os }} | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         # TODO: enable self-hosted-windows-8-cores once available | ||||
|         os: [namespace-profile-ubuntu-8-cores, namespace-profile-macos-8-cores, windows-16-cores] | ||||
|         shardIndex: [1, 2, 3, 4] | ||||
|         shardTotal: [4] | ||||
|     runs-on: ${{ matrix.os }} | ||||
|     needs: check-rust-changes | ||||
|     steps: | ||||
|     - uses: actions/create-github-app-token@v1 | ||||
|       id: app-token | ||||
| @ -51,158 +30,32 @@ jobs: | ||||
|         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 | ||||
|       with: | ||||
|         token: ${{ steps.app-token.outputs.token }} | ||||
|  | ||||
|     - 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 --with-deps | ||||
|     - name: Download Wasm Cache | ||||
|       id: download-wasm | ||||
|       if: needs.check-rust-changes.outputs.rust-changed == 'false' | ||||
|       uses: dawidd6/action-download-artifact@v7 | ||||
|       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 | ||||
|       shell: bash | ||||
|       # TODO: figure out what to do with this, it's failing | ||||
|       if: false | ||||
|       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' | ||||
|  | ||||
|     - name: Build Wasm | ||||
|       shell: bash | ||||
|       run: yarn build:wasm | ||||
|  | ||||
|     - name: build web | ||||
|       shell: bash | ||||
|       run: yarn tronb:vite:dev | ||||
|     - name: Run ubuntu/chrome snapshots | ||||
|       if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 }} | ||||
|       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. | ||||
|  | ||||
|     - name: Run playwright/electron flow on ubuntu (with retries) | ||||
|       if: contains(matrix.os, 'ubuntu') | ||||
|       run: | | ||||
|         PLATFORM=web yarn playwright test --config=playwright.config.ts --retries="3" --update-snapshots --grep=@snapshot  --shard=1/1 | ||||
|       env: | ||||
|         CI: true | ||||
|         NODE_ENV: development | ||||
|         VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} | ||||
|         VITE_KC_SKIP_AUTH: true | ||||
|         token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} | ||||
|         snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }} | ||||
|     - uses: actions/upload-artifact@v4 | ||||
|       if: ${{ !cancelled() && (success() || failure()) }} | ||||
|       with: | ||||
|         name: playwright-report-${{ matrix.os }}-snapshot-${{ matrix.shardIndex }}-${{ github.sha }} | ||||
|         path: playwright-report/ | ||||
|         include-hidden-files: true | ||||
|         retention-days: 30 | ||||
|         overwrite: true | ||||
|     - name: Clean up test-results | ||||
|       if: ${{ !cancelled() && (success() || failure()) }} | ||||
|       continue-on-error: true | ||||
|       run: rm -r test-results | ||||
|     - name: check for changes | ||||
|       if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 && github.ref != 'refs/heads/main' }} | ||||
|       shell: bash | ||||
|       id: git-check | ||||
|       run: | | ||||
|           git add e2e/playwright/snapshot-tests.spec.ts-snapshots | ||||
|           if git status | grep -q "Changes to be committed" | ||||
|           then echo "modified=true" >> $GITHUB_OUTPUT | ||||
|           else echo "modified=false" >> $GITHUB_OUTPUT | ||||
|           fi | ||||
|     - name: Commit changes, if any | ||||
|       if: steps.git-check.outputs.modified == 'true' | ||||
|       shell: bash | ||||
|       run: | | ||||
|         git add e2e/playwright/snapshot-tests.spec.ts-snapshots | ||||
|         git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||||
|         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 fetch origin | ||||
|         echo ${{ github.head_ref }} | ||||
|         git checkout ${{ github.head_ref }} | ||||
|         git commit -m "A snapshot a day keeps the bugs away! 📷🐛 (OS: ${{matrix.os}})" || true | ||||
|         git push | ||||
|         git push origin ${{ github.head_ref }} | ||||
|     # only upload artifacts if there's actually changes | ||||
|     - uses: actions/upload-artifact@v4 | ||||
|       if: steps.git-check.outputs.modified == 'true' | ||||
|       with: | ||||
|         name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }} | ||||
|         path: playwright-report/ | ||||
|         include-hidden-files: true | ||||
|         retention-days: 30 | ||||
|     - uses: actions/download-artifact@v4 | ||||
|       if: ${{ !cancelled() && (success() || failure()) }} | ||||
|       continue-on-error: true | ||||
|       with: | ||||
|         name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }} | ||||
|         path: test-results/ | ||||
|     - name: Run playwright/electron flow (with retries) | ||||
|       id: retry | ||||
|       if: ${{ !cancelled() && (success() || failure()) }} | ||||
|       shell: bash | ||||
|       run: | | ||||
|         .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}} | ||||
|         xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu | ||||
|       env: | ||||
|         CI: true | ||||
|         FAIL_ON_CONSOLE_ERRORS: true | ||||
| @ -210,20 +63,28 @@ jobs: | ||||
|         VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} | ||||
|         VITE_KC_SKIP_AUTH: true | ||||
|         token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} | ||||
|     - uses: actions/upload-artifact@v4 | ||||
|       if: always() | ||||
|       with: | ||||
|         name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }} | ||||
|         path: test-results/ | ||||
|         include-hidden-files: true | ||||
|         retention-days: 30 | ||||
|         overwrite: true | ||||
|     - uses: actions/upload-artifact@v4 | ||||
|       if: always() | ||||
|       with: | ||||
|         name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }} | ||||
|         path: playwright-report/ | ||||
|         include-hidden-files: true | ||||
|         retention-days: 30 | ||||
|         overwrite: true | ||||
|  | ||||
|     - name: Run playwright/electron flow on windows (with retries) | ||||
|       if: contains(matrix.os, 'windows') | ||||
|       id: retry | ||||
|       run: | | ||||
|         yarn test:playwright:electron:windows | ||||
|       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 | ||||
|         token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} | ||||
|  | ||||
|     - name: Run playwright/electron flow on macos (with retries) | ||||
|       if: contains(matrix.os, 'macos') | ||||
|       run: | | ||||
|         yarn test:playwright:electron:macos | ||||
|       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 | ||||
|         token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} | ||||
|  | ||||
| @ -11,9 +11,9 @@ export default defineConfig({ | ||||
|   /* Fail the build on CI if you accidentally left test.only in the source code. */ | ||||
|   forbidOnly: true, | ||||
|   /* Do not retry */ | ||||
|   retries: 0, | ||||
|   retries: 100, | ||||
|   /* Different amount of parallelism on CI and local. */ | ||||
|   workers: 8, | ||||
|   workers: 4, | ||||
|   /* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||||
|   reporter: [ | ||||
|     ['dot'], | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	