|
6 | 6 | - "v*.*.*" # Trigger on version tags like v1.2.3 |
7 | 7 |
|
8 | 8 | jobs: |
| 9 | + setup: |
| 10 | + name: Resolve primary Node version |
| 11 | + runs-on: ubuntu-latest |
| 12 | + permissions: {} |
| 13 | + outputs: |
| 14 | + primary-node: ${{ steps.read.outputs.version }} |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v6 |
| 17 | + - id: read |
| 18 | + run: echo "version=$(cat .node-version)" >> "$GITHUB_OUTPUT" |
| 19 | + |
9 | 20 | build-napi: |
10 | 21 | name: Build N-API modules |
11 | 22 | runs-on: ${{ matrix.settings.host }} |
|
48 | 59 | - name: Setup Node |
49 | 60 | uses: actions/setup-node@v6 |
50 | 61 | with: |
51 | | - node-version: 22 |
| 62 | + node-version-file: .node-version |
52 | 63 | cache: pnpm |
53 | 64 | - name: Setup Rust |
54 | 65 | uses: actions-rust-lang/setup-rust-toolchain@v1 |
@@ -96,16 +107,17 @@ jobs: |
96 | 107 | if-no-files-found: error |
97 | 108 |
|
98 | 109 | test-targets: |
99 | | - name: Cross-runtime test on ${{ matrix.settings.target }} |
| 110 | + name: Cross-runtime test on ${{ matrix.settings.target }} (Node ${{ matrix.node }}) |
100 | 111 | runs-on: ${{ matrix.settings.host }} |
101 | | - needs: build-napi |
| 112 | + needs: [build-napi, setup] |
102 | 113 | permissions: {} |
103 | 114 | defaults: |
104 | 115 | run: |
105 | 116 | shell: bash |
106 | 117 | strategy: |
107 | 118 | fail-fast: false |
108 | 119 | matrix: |
| 120 | + node: [22, 24] |
109 | 121 | settings: |
110 | 122 | - host: macos-15-intel |
111 | 123 | target: x86_64-apple-darwin |
@@ -147,7 +159,7 @@ jobs: |
147 | 159 | - name: Setup Node |
148 | 160 | uses: actions/setup-node@v6 |
149 | 161 | with: |
150 | | - node-version: 22 |
| 162 | + node-version: ${{ matrix.node }} |
151 | 163 | cache: pnpm |
152 | 164 | - name: Setup Rust |
153 | 165 | uses: actions-rust-lang/setup-rust-toolchain@v1 |
@@ -175,7 +187,14 @@ jobs: |
175 | 187 | run: pnpm install --frozen-lockfile |
176 | 188 | - name: Run comprehensive tests (includes compilation) |
177 | 189 | run: | |
178 | | - if [ -n "${{ matrix.settings.test_runtimes }}" ]; then |
| 190 | + # Only the primary Node version (sourced from .node-version via the |
| 191 | + # setup job) runs the full cross-runtime suite. Other Node versions |
| 192 | + # only re-run the Node runtime tests, since Rust/Deno/Bun results |
| 193 | + # don't depend on the installed Node. |
| 194 | + if [ "${{ matrix.node }}" != "${{ needs.setup.outputs.primary-node }}" ]; then |
| 195 | + echo "Running Node-only tests for Node ${{ matrix.node }}" |
| 196 | + task test -- node |
| 197 | + elif [ -n "${{ matrix.settings.test_runtimes }}" ]; then |
179 | 198 | echo "Running selective runtime tests: ${{ matrix.settings.test_runtimes }}" |
180 | 199 | task test -- ${{ matrix.settings.test_runtimes }} |
181 | 200 | else |
@@ -205,7 +224,7 @@ jobs: |
205 | 224 | - name: Setup Node |
206 | 225 | uses: actions/setup-node@v6 |
207 | 226 | with: |
208 | | - node-version: 24 |
| 227 | + node-version-file: .node-version |
209 | 228 | registry-url: https://registry.npmjs.org/ |
210 | 229 | cache: pnpm |
211 | 230 | - name: Install Node.js dependencies |
|
0 commit comments