fix(tooling): migrate to use github-actions #2
Workflow file for this run
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: Pull Request Validation | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| - labeled | |
| - unlabeled | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| env: | |
| NODE_VERSION: 20.13.1 | |
| JOURNEY_TEST_COMMAND_CHROME: npm run test -- --ci | |
| JOURNEY_TEST_COMMAND_FIREFOX: npm run test -- --ci | |
| jobs: | |
| validate: | |
| name: validated-label gate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Require validated label on PR | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const labels = context.payload.pull_request.labels.map((label) => label.name); | |
| const hasValidated = labels.includes("validated"); | |
| if (!hasValidated) { | |
| core.setFailed( | |
| `Missing required "validated" label. Current labels: ${labels.join(", ") || "none"}` | |
| ); | |
| } | |
| install: | |
| name: install | |
| runs-on: ubuntu-latest | |
| needs: validate | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci --legacy-peer-deps | |
| - name: Save node_modules cache | |
| uses: actions/cache/save@v4 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
| path: node_modules | |
| tests: | |
| name: tests | |
| runs-on: ubuntu-latest | |
| needs: install | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Restore node_modules cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
| path: node_modules | |
| fail-on-cache-miss: true | |
| - name: Run eslint | |
| run: npm run linter | |
| - name: Run jest | |
| run: npm run test -- --ci | |
| build_for_tests: | |
| name: build_for_tests | |
| runs-on: ubuntu-latest | |
| needs: install | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Restore node_modules cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
| path: node_modules | |
| fail-on-cache-miss: true | |
| - name: Build assets for integration tests | |
| run: npm run build | |
| journey_tests_chrome: | |
| name: journey_tests_chrome | |
| runs-on: ubuntu-latest | |
| needs: build_for_tests | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Restore node_modules cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
| path: node_modules | |
| fail-on-cache-miss: true | |
| - name: Run Chrome journey tests | |
| run: ${{ env.JOURNEY_TEST_COMMAND_CHROME }} | |
| env: | |
| CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
| journey_tests_firefox: | |
| name: journey_tests_firefox | |
| runs-on: ubuntu-latest | |
| needs: build_for_tests | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Restore node_modules cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
| path: node_modules | |
| fail-on-cache-miss: true | |
| - name: Run Firefox journey tests | |
| run: ${{ env.JOURNEY_TEST_COMMAND_FIREFOX }} | |
| env: | |
| CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} |