chore: Expand node version test matrix (#2700)

Co-authored-by: matt korwel <matt.korwel@gmail.com>
Co-authored-by: N. Taylor Mullen <ntaylormullen@google.com>
This commit is contained in:
Pascal Birchler 2025-07-22 00:33:54 +01:00 committed by GitHub
parent 5066bc5384
commit ffa42a79dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 29 deletions

View File

@ -10,22 +10,19 @@ on:
merge_group: merge_group:
jobs: jobs:
build: lint:
name: Build and Lint name: Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read # For checkout contents: read # For checkout
strategy:
matrix:
node-version: [20.x, 22.x, 24.x]
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Node.js ${{ matrix.node-version }} - name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with: with:
node-version: ${{ matrix.node-version }} node-version-file: '.nvmrc'
cache: 'npm' cache: 'npm'
- name: Install dependencies - name: Install dependencies
@ -45,24 +42,17 @@ jobs:
- name: Run type check - name: Run type check
run: npm run typecheck run: npm run typecheck
- name: Upload build artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: build-artifacts-${{ matrix.node-version }}
path: |
packages/*/dist
package-lock.json # Only upload dist and lockfile
test: test:
name: Test name: Test
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build # This job depends on the 'build' job needs: lint
permissions: permissions:
contents: read contents: read
checks: write checks: write
pull-requests: write pull-requests: write
strategy: strategy:
matrix: matrix:
node-version: [20.x, 22.x, 24.x] # Should match the build job's matrix node-version: [20.x, 22.x, 24.x]
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
@ -73,16 +63,8 @@ jobs:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: 'npm' cache: 'npm'
- name: Download build artifacts - name: Build project
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 run: npm run build
with:
name: build-artifacts-${{ matrix.node-version }}
path: . # Download to the root, this will include package-lock.json and packages/*/dist
# Restore/create package structure for dist folders if necessary.
# The download-artifact action with path: . should place them correctly if the
# upload paths were relative to the workspace root.
# Example: if uploaded `packages/cli/dist`, it will be at `./packages/cli/dist`.
- name: Install dependencies for testing - name: Install dependencies for testing
run: npm ci # Install fresh dependencies using the downloaded package-lock.json run: npm ci # Install fresh dependencies using the downloaded package-lock.json
@ -92,7 +74,7 @@ jobs:
- name: Publish Test Report (for non-forks) - name: Publish Test Report (for non-forks)
if: always() && (github.event.pull_request.head.repo.full_name == github.repository) if: always() && (github.event.pull_request.head.repo.full_name == github.repository)
uses: dorny/test-reporter@890a17cecf52a379fc869ab770a71657660be727 # v2 uses: dorny/test-reporter@dc3a92680fcc15842eef52e8c4606ea7ce6bd3f3 # v2
with: with:
name: Test Results (Node ${{ matrix.node-version }}) name: Test Results (Node ${{ matrix.node-version }})
path: packages/*/junit.xml path: packages/*/junit.xml

View File

@ -14,14 +14,15 @@ jobs:
strategy: strategy:
matrix: matrix:
sandbox: [sandbox:none, sandbox:docker] sandbox: [sandbox:none, sandbox:docker]
node-version: [20.x, 22.x, 24.x]
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Node.js - name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with: with:
node-version: 20.x node-version: ${{ matrix.node-version }}
cache: 'npm' cache: 'npm'
- name: Install dependencies - name: Install dependencies

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
20