Merge branch 'master' into vipergc-997 #303
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR | |
| on: | |
| push: | |
| pull_request: | |
| types: | |
| - opened | |
| - labeled | |
| env: | |
| NODE_ENV: development | |
| NODE_VERSION: 24.14.1 | |
| PERCY_POSTINSTALL_BROWSER: "true" | |
| PERCY_LOGLEVEL: "debug" | |
| PERCY_PARALLEL_TOTAL: 2 | |
| PERCY_TOKEN: "${{ secrets.PERCY_TOKEN }}" | |
| jobs: | |
| generate_cache_key: | |
| runs-on: ubuntu-latest | |
| container: mcr.microsoft.com/playwright:v1.57.0-jammy | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: generate_cache_key | |
| run: | | |
| lock_hash="$(sha256sum package-lock.json e2e/package-lock.json | sha256sum | awk '{print $1}')" | |
| echo "cache_key=node${NODE_VERSION}-deps-${lock_hash}-v2" >> "$GITHUB_OUTPUT" | |
| outputs: | |
| cache_key: ${{ steps.generate_cache_key.outputs.cache_key }} | |
| build_and_cache_dependencies_if_needed: | |
| needs: generate_cache_key | |
| runs-on: ubuntu-latest | |
| container: mcr.microsoft.com/playwright:v1.57.0-jammy | |
| permissions: | |
| actions: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: npm | |
| - uses: actions/cache/restore@v4 | |
| id: node_deps_restore_cache | |
| with: | |
| path: | | |
| node_modules | |
| e2e/node_modules | |
| dist | |
| key: ${{ needs.generate_cache_key.outputs.cache_key }} | |
| - run: | | |
| npm ci | |
| npm run build | |
| if: steps.node_deps_restore_cache.outputs.cache-hit != 'true' || contains(github.event.pull_request.labels.*.name, 'build:clean') | |
| - name: Remove build:clean label (if present) | |
| if: contains(github.event.pull_request.labels.*.name, 'build:clean') | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const { owner, repo, number } = context.issue; | |
| const labelToRemove = 'build:clean'; | |
| try { | |
| await github.rest.issues.removeLabel({ | |
| owner, | |
| repo, | |
| issue_number: number, | |
| name: labelToRemove | |
| }); | |
| } catch (error) { | |
| core.warning(`Failed to remove ' + labelToRemove + ' label: ${error.message}`); | |
| } | |
| - uses: actions/cache/save@v4 | |
| id: node_deps_save_cache | |
| if: steps.node_deps_restore_cache.outputs.cache-hit != 'true' || contains(github.event.pull_request.labels.*.name, 'build:clean') | |
| with: | |
| path: | | |
| node_modules | |
| e2e/node_modules | |
| dist | |
| key: ${{ needs.generate_cache_key.outputs.cache_key }} | |
| outputs: | |
| cache_key: ${{ needs.generate_cache_key.outputs.cache_key }} | |
| lint: | |
| needs: | |
| - build_and_cache_dependencies_if_needed | |
| runs-on: ubuntu-latest | |
| container: mcr.microsoft.com/playwright:v1.57.0-jammy | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: npm | |
| - uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| node_modules | |
| e2e/node_modules | |
| dist | |
| key: ${{ needs.build_and_cache_dependencies_if_needed.outputs.cache_key }} | |
| - run: npm run lint | |
| unit-test: | |
| needs: | |
| - build_and_cache_dependencies_if_needed | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: npm | |
| - run: | | |
| mkdir -p dist/reports/tests/ | |
| npm ci | |
| npm run build | |
| npm run test | |
| - uses: codecov/codecov-action@v4 | |
| if: always() | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage/unit/lcov.info | |
| flags: unit | |
| name: unit-test-${{ github.run_id }} | |
| fail_ci_if_error: false | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: unit-test-results | |
| path: dist/reports/tests/ | |
| if-no-files-found: warn | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: unit-test-coverage | |
| path: coverage | |
| if-no-files-found: warn | |
| - name: Collect version artifacts | |
| if: always() | |
| run: | | |
| mkdir -p /tmp/artifacts | |
| printenv NODE_ENV > /tmp/artifacts/NODE_ENV.txt || true | |
| npm -v > /tmp/artifacts/npm-version.txt | |
| node -v > /tmp/artifacts/node-version.txt | |
| ls -latR > /tmp/artifacts/dir.txt | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: unit-test-artifacts | |
| path: /tmp/artifacts | |
| if-no-files-found: warn | |
| e2e-test: | |
| name: e2e-ci (shard ${{ matrix.shard }}/4) | |
| runs-on: ubuntu-latest | |
| container: mcr.microsoft.com/playwright:v1.57.0-jammy | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2, 3, 4] | |
| needs: | |
| - build_and_cache_dependencies_if_needed | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: npm | |
| - uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| node_modules | |
| e2e/node_modules | |
| dist | |
| key: ${{ needs.build_and_cache_dependencies_if_needed.outputs.cache_key }} | |
| - run: | | |
| mkdir -p test-results | |
| npm run test:e2e:ci -- --shard=${{ matrix.shard }}/4 | |
| - run: npm run cov:e2e:report || true | |
| - uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage/e2e/lcov.info | |
| flags: e2e-ci | |
| name: e2e-ci-${{ github.run_id }}-shard-${{ matrix.shard }} | |
| fail_ci_if_error: false | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: e2e-ci-test-results-shard-${{ matrix.shard }} | |
| path: test-results | |
| if-no-files-found: warn | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: e2e-ci-coverage-shard-${{ matrix.shard }} | |
| path: coverage | |
| if-no-files-found: warn | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: e2e-ci-html-results-shard-${{ matrix.shard }} | |
| path: html-test-results | |
| if-no-files-found: warn | |
| - name: Collect version artifacts | |
| if: always() | |
| run: | | |
| mkdir -p /tmp/artifacts | |
| printenv NODE_ENV > /tmp/artifacts/NODE_ENV.txt || true | |
| npm -v > /tmp/artifacts/npm-version.txt | |
| node -v > /tmp/artifacts/node-version.txt | |
| ls -latR > /tmp/artifacts/dir.txt | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: e2e-ci-artifacts-shard-${{ matrix.shard }} | |
| path: /tmp/artifacts | |
| if-no-files-found: warn | |
| visual-a11y: | |
| name: visual-a11y-ci | |
| runs-on: ubuntu-latest | |
| container: mcr.microsoft.com/playwright:v1.57.0-jammy | |
| needs: | |
| - build_and_cache_dependencies_if_needed | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: npm | |
| - uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| node_modules | |
| e2e/node_modules | |
| dist | |
| key: ${{ needs.build_and_cache_dependencies_if_needed.outputs.cache_key }} | |
| - run: npm run test:e2e:visual:ci -- --shard=${{ matrix.shard }}/2 | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: visual-a11y-ci-test-results-shard-${{ matrix.shard }} | |
| path: test-results | |
| if-no-files-found: warn | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: visual-a11y-ci-html-results-shard-${{ matrix.shard }} | |
| path: html-test-results | |
| if-no-files-found: warn | |
| - name: Collect version artifacts | |
| if: always() | |
| run: | | |
| mkdir -p /tmp/artifacts | |
| printenv NODE_ENV > /tmp/artifacts/NODE_ENV.txt || true | |
| npm -v > /tmp/artifacts/npm-version.txt | |
| node -v > /tmp/artifacts/node-version.txt | |
| ls -latR > /tmp/artifacts/dir.txt | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: visual-a11y-ci-artifacts-shard-${{ matrix.shard }} | |
| path: /tmp/artifacts | |
| if-no-files-found: warn | |
| perf-test: | |
| runs-on: ubuntu-latest | |
| container: mcr.microsoft.com/playwright:v1.57.0-jammy | |
| needs: | |
| - build_and_cache_dependencies_if_needed | |
| if: ${{ always() }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: npm | |
| - uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| node_modules | |
| e2e/node_modules | |
| dist | |
| key: ${{ needs.build_and_cache_dependencies_if_needed.outputs.cache_key }} | |
| - run: npm run test:perf:localhost | |
| - run: npm run test:perf:contract | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: perf-test-results | |
| path: test-results | |
| if-no-files-found: warn | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: perf-html-results | |
| path: html-test-results | |
| if-no-files-found: warn | |
| - name: Collect version artifacts | |
| if: always() | |
| run: | | |
| mkdir -p /tmp/artifacts | |
| printenv NODE_ENV > /tmp/artifacts/NODE_ENV.txt || true | |
| npm -v > /tmp/artifacts/npm-version.txt | |
| node -v > /tmp/artifacts/node-version.txt | |
| ls -latR > /tmp/artifacts/dir.txt | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: perf-test-artifacts | |
| path: /tmp/artifacts | |
| if-no-files-found: warn | |
| mem-test: | |
| runs-on: ubuntu-latest | |
| container: mcr.microsoft.com/playwright:v1.57.0-jammy | |
| needs: | |
| - build_and_cache_dependencies_if_needed | |
| if: ${{ always() }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: npm | |
| - uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| node_modules | |
| e2e/node_modules | |
| dist | |
| key: ${{ needs.build_and_cache_dependencies_if_needed.outputs.cache_key }} | |
| - run: npm run test:perf:memory | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: mem-test-results | |
| path: test-results | |
| if-no-files-found: warn | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: mem-html-results | |
| path: html-test-results | |
| if-no-files-found: warn | |
| - name: Collect version artifacts | |
| if: always() | |
| run: | | |
| mkdir -p /tmp/artifacts | |
| printenv NODE_ENV > /tmp/artifacts/NODE_ENV.txt || true | |
| npm -v > /tmp/artifacts/npm-version.txt | |
| node -v > /tmp/artifacts/node-version.txt | |
| ls -latR > /tmp/artifacts/dir.txt | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: mem-test-artifacts | |
| path: /tmp/artifacts | |
| if-no-files-found: warn |