|
47 | 47 | - vcbuild.bat |
48 | 48 | - .** |
49 | 49 | - '!.github/workflows/test-shared.yml' |
| 50 | + - '!.github/actions/build-shared/**' |
50 | 51 | types: [opened, synchronize, reopened, ready_for_review] |
51 | 52 | push: |
52 | 53 | branches: |
|
97 | 98 | - vcbuild.bat |
98 | 99 | - .** |
99 | 100 | - '!.github/workflows/test-shared.yml' |
| 101 | + - '!.github/actions/build-shared/**' |
100 | 102 |
|
101 | 103 | concurrency: |
102 | 104 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
@@ -144,59 +146,121 @@ jobs: |
144 | 146 | include: |
145 | 147 | - runner: ubuntu-24.04 |
146 | 148 | system: x86_64-linux |
147 | | - - runner: ubuntu-24.04-arm |
148 | | - system: aarch64-linux |
| 149 | + # built separately in build-aarch64-linux-v8 |
| 150 | + # - runner: ubuntu-24.04-arm |
| 151 | + # system: aarch64-linux |
149 | 152 | - runner: macos-15-intel |
150 | 153 | system: x86_64-darwin |
151 | 154 | - runner: macos-latest |
152 | 155 | system: aarch64-darwin |
153 | 156 | name: '${{ matrix.system }}: with shared libraries' |
154 | 157 | runs-on: ${{ matrix.runner }} |
155 | 158 | steps: |
156 | | - - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 159 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
157 | 160 | if: ${{ github.event_name != 'workflow_dispatch' }} |
| 161 | + with: |
| 162 | + persist-credentials: false |
| 163 | + sparse-checkout: .github/actions |
| 164 | + - uses: ./.github/actions/build-shared |
| 165 | + if: ${{ github.event_name != 'workflow_dispatch' }} |
| 166 | + with: |
| 167 | + system: ${{ matrix.system }} |
| 168 | + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} |
| 169 | + |
| 170 | + build-aarch64-linux-v8: |
| 171 | + needs: build-tarball |
| 172 | + runs-on: ubuntu-24.04-arm |
| 173 | + name: 'aarch64-linux: Cache V8 build' |
| 174 | + steps: |
| 175 | + - name: Check if Cachix is available |
| 176 | + id: cachix-check |
| 177 | + run: echo 'IS_AVAILABLE=${{ secrets.CACHIX_AUTH_TOKEN && 'true' }}' >> "$GITHUB_OUTPUT" |
| 178 | + |
| 179 | + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 180 | + if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }} |
158 | 181 | with: |
159 | 182 | name: tarballs |
160 | 183 | path: tarballs |
161 | 184 |
|
162 | 185 | - name: Extract tarball |
163 | | - if: ${{ github.event_name != 'workflow_dispatch' }} |
| 186 | + if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }} |
| 187 | + shell: bash |
164 | 188 | run: | |
165 | 189 | tar xzf tarballs/*.tar.gz -C "$RUNNER_TEMP" |
166 | 190 | echo "TAR_DIR=$RUNNER_TEMP/$(basename tarballs/*.tar.gz .tar.gz)" >> "$GITHUB_ENV" |
167 | 191 |
|
168 | 192 | - uses: cachix/install-nix-action@96951a368ba55167b55f1c916f7d416bac6505fe # v31.10.3 |
| 193 | + if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }} |
169 | 194 | with: |
170 | 195 | extra_nix_config: sandbox = true |
171 | 196 |
|
172 | 197 | - uses: cachix/cachix-action@1eb2ef646ac0255473d23a5907ad7b04ce94065c # v17 |
| 198 | + if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }} |
173 | 199 | with: |
174 | 200 | name: nodejs |
175 | 201 | authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} |
176 | 202 |
|
177 | | - - name: Configure sccache |
178 | | - if: github.base_ref == 'main' || github.ref_name == 'main' |
179 | | - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 |
| 203 | + - name: Build V8 derivation |
| 204 | + if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }} |
| 205 | + run: | |
| 206 | + nix-build "$( |
| 207 | + nix-instantiate -E "builtins.filter (p: p.pname == ''v8'') (import $TAR_DIR/shell.nix { useSeparateDerivationForV8=true; }).buildInputs" |
| 208 | + )" |
| 209 | +
|
| 210 | + # Builds the matrix for `build-openssl` from tools/nix/openssl-matrix.json. |
| 211 | + # Output shape: |
| 212 | + # [{ "version": "3.6.1", "attr": "openssl_3_6", "continue-on-error": false }, ...] |
| 213 | + collect-openssl-versions: |
| 214 | + if: github.event.pull_request.draft == false |
| 215 | + runs-on: ubuntu-slim |
| 216 | + outputs: |
| 217 | + matrix: ${{ steps.query.outputs.matrix }} |
| 218 | + steps: |
| 219 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
180 | 220 | with: |
181 | | - script: | |
182 | | - core.exportVariable('SCCACHE_GHA_ENABLED', 'on'); |
183 | | - core.exportVariable('ACTIONS_CACHE_SERVICE_V2', 'on'); |
184 | | - core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || ''); |
185 | | - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); |
186 | | - core.exportVariable('NIX_SCCACHE', '(import <nixpkgs> {}).sccache'); |
187 | | -
|
188 | | - - name: Build Node.js and run tests |
| 221 | + persist-credentials: false |
| 222 | + sparse-checkout: tools/nix/openssl-matrix.json |
| 223 | + sparse-checkout-cone-mode: false |
| 224 | + - id: query |
189 | 225 | run: | |
190 | | - nix-shell \ |
191 | | - -I "nixpkgs=$TAR_DIR/tools/nix/pkgs.nix" \ |
192 | | - --pure --keep TAR_DIR --keep FLAKY_TESTS \ |
193 | | - --keep SCCACHE_GHA_ENABLED --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \ |
194 | | - --arg loadJSBuiltinsDynamically false \ |
195 | | - --arg useSeparateDerivationForV8 true \ |
196 | | - --arg ccache "${NIX_SCCACHE:-null}" \ |
197 | | - --arg devTools '[]' \ |
198 | | - --arg benchmarkTools '[]' \ |
199 | | - ${{ endsWith(matrix.system, '-darwin') && '--arg withAmaro false --arg withLief false --arg withSQLite false --arg withFFI false --arg extraConfigFlags ''["--without-inspector" "--without-node-options"]'' \' || '\' }} |
200 | | - --run ' |
201 | | - make -C "$TAR_DIR" run-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS" |
202 | | - ' "$TAR_DIR/shell.nix" |
| 226 | + { |
| 227 | + echo 'matrix<<EOF' |
| 228 | + cat tools/nix/openssl-matrix.json |
| 229 | + echo 'EOF' |
| 230 | + } >> "$GITHUB_OUTPUT" |
| 231 | +
|
| 232 | + # Builds and tests Node.js with shared libraries against every supported |
| 233 | + # OpenSSL release version available in the repo-pinned nixpkgs. The default |
| 234 | + # shared `openssl` from tools/nix/sharedLibDeps.nix is overridden per matrix |
| 235 | + # entry, while all other shared libs remain at their defaults. Only runs on |
| 236 | + # a single runner/system (aarch64-linux) to keep the matrix to a minimum. |
| 237 | + build-openssl: |
| 238 | + needs: |
| 239 | + - build-aarch64-linux-v8 |
| 240 | + - collect-openssl-versions |
| 241 | + strategy: |
| 242 | + fail-fast: false |
| 243 | + matrix: |
| 244 | + openssl: ${{ fromJSON(needs.collect-openssl-versions.outputs.matrix) }} |
| 245 | + name: 'aarch64-linux: with shared ${{ matrix.openssl.attr }} (${{ matrix.openssl.version }})' |
| 246 | + runs-on: ubuntu-24.04-arm |
| 247 | + continue-on-error: ${{ matrix.openssl['continue-on-error'] }} |
| 248 | + env: |
| 249 | + OPENSSL_ATTR: ${{ matrix.openssl.attr }} |
| 250 | + OPENSSL_VERSION: ${{ matrix.openssl.version }} |
| 251 | + steps: |
| 252 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 253 | + with: |
| 254 | + persist-credentials: false |
| 255 | + sparse-checkout: .github/actions |
| 256 | + - uses: ./.github/actions/build-shared |
| 257 | + with: |
| 258 | + system: aarch64-linux |
| 259 | + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} |
| 260 | + # Override just the `openssl` attr of the default shared-lib set with |
| 261 | + # the matrix-selected nixpkgs attribute (e.g. `openssl_3_6`). All |
| 262 | + # other shared libs (brotli, cares, libuv, …) keep their defaults. |
| 263 | + # `permittedInsecurePackages` whitelists just the matrix-selected |
| 264 | + # release (e.g. `openssl-1.1.1w`) so EOL-with-extended-support |
| 265 | + # cycles evaluate without relaxing nixpkgs' meta check globally. |
| 266 | + extra-nix-args: --arg sharedLibDeps "(import $TAR_DIR/tools/nix/sharedLibDeps.nix {}) // { openssl = (import $TAR_DIR/tools/nix/pkgs.nix { config.permittedInsecurePackages = [ \"openssl-$OPENSSL_VERSION\" ]; }).$OPENSSL_ATTR; }" |
0 commit comments