Update CI github-actions #6910
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
| # NOTE: This name appears in GitHub's Checks API and in workflow's status badge. | |
| name: ci-test | |
| # Trigger the workflow when: | |
| on: | |
| # A push occurs to one of the matched branches. | |
| push: | |
| branches: | |
| - master | |
| - stable/* | |
| # Or when a pull request event occurs for a pull request against one of the | |
| # matched branches. | |
| pull_request: | |
| branches: | |
| - master | |
| - stable/* | |
| # Explicitly disable secrets.GITHUB_TOKEN permissions. | |
| permissions: {} | |
| jobs: | |
| yarn_cache: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| id: yarn-cache | |
| with: | |
| node-version: '24.13.0' | |
| cache: yarn | |
| - if: steps.yarn-cache.outputs.cache-hit != 'true' | |
| run: yarn install --frozen-lockfile | |
| jest: | |
| # NOTE: This name appears in GitHub's Checks API. | |
| name: jest | |
| needs: [yarn_cache] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24.13.0' | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - run: yarn test --coverage | |
| - name: 'Upload coverage report' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jest-coverage | |
| path: coverage | |
| retention-days: 5 | |
| playwright-prepare: | |
| # NOTE: This name appears in GitHub's Checks API. | |
| name: playwright-prepare | |
| needs: [yarn_cache] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24.13.0' | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - run: REACT_APP_E2E_TEST=1 yarn build:ext | |
| - run: REACT_APP_E2E_TEST=1 yarn build | |
| - name: Upload builds for playwright | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: builds-for-playwright | |
| path: | | |
| ./build | |
| ./build-ext | |
| retention-days: 5 | |
| playwright: | |
| # NOTE: This name appears in GitHub's Checks API. | |
| name: playwright | |
| needs: [playwright-prepare] | |
| runs-on: ubuntu-latest | |
| container: | |
| image: mcr.microsoft.com/playwright:v1.58.1-noble | |
| options: --user 1001 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shardIndex: [1, 2, 3, 4, 5, 6, 7, 8] | |
| shardTotal: [8] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24.13.0' | |
| cache: yarn | |
| - uses: actions/download-artifact@v4 | |
| - run: mv ./builds-for-playwright/build ./build | |
| - run: mv ./builds-for-playwright/build-ext ./build-ext | |
| - name: Install playwright's npm dependencies | |
| working-directory: ./playwright/ | |
| run: yarn install --frozen-lockfile | |
| # outside sharding: yarn + build:ext + build + upload | |
| # and then 8x shard: download builds + serve + test | |
| - run: REACT_APP_E2E_TEST=1 node ./playwright/serve-prod.js & | |
| - run: npx wait-on http://localhost:5000/ --timeout 60000 | |
| - name: Run playwright tests (with xvfb-run to support headed extension test) | |
| working-directory: ./playwright/ | |
| run: xvfb-run yarn test:prod --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} | |
| - name: 'Upload playwright test-results' | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-test-results-${{ matrix.shardIndex }} | |
| path: playwright/test-results | |
| retention-days: 5 | |
| # TODO: maybe https://playwright.dev/docs/test-sharding#merging-reports-from-multiple-shards | |
| upload-coverage: | |
| # NOTE: This name appears in GitHub's Checks API. | |
| name: coverage | |
| needs: [jest] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download coverage reports | |
| uses: actions/download-artifact@v4 | |
| - uses: codecov/codecov-action@v3 | |
| with: | |
| files: ./jest-coverage/coverage-final.json | |
| flags: jest |