CI: harden and align GitHub Actions workflows #2712
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: Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - '!dependabot/**' | |
| pull_request: | |
| branches: | |
| - '**' | |
| workflow_dispatch: | |
| env: | |
| FORCE_COLOR: 2 | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| run: | |
| permissions: | |
| contents: read # for actions/checkout to fetch code | |
| name: Node ${{ matrix.node }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 | |
| if: github.event_name != 'pull_request' || github.event.pull_request.changed_files > 0 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node: [20, 22, 24] | |
| os: [ubuntu-latest, windows-latest] | |
| steps: | |
| - name: Clone repository | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Node.js | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: npm | |
| - name: Enable yarn via corepack | |
| run: corepack enable yarn | |
| - name: Install npm dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Unit Tests | |
| run: npm run test:unit | |
| env: | |
| NODE_OPTIONS: ${{ matrix.os == 'windows-latest' && '--dns-result-order=ipv4first' || '' }} | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 | |
| - name: Bun Tests | |
| run: npm run test:bun | |
| - name: E2E Tests | |
| run: npm run test:e2e | |
| if: startsWith(matrix.os, 'ubuntu') && matrix.node == 20 |