@@ -117,12 +117,10 @@ jobs:
117117 runs-on : ubuntu-slim
118118 steps :
119119 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
120- if : ${{ github.event_name != 'workflow_dispatch' }}
121120 with :
122121 persist-credentials : false
123122
124123 - name : Make tarball
125- if : ${{ github.event_name != 'workflow_dispatch' }}
126124 run : |
127125 export DATESTRING=$(date "+%Y-%m-%d")
128126 export COMMIT=$(git rev-parse --short=10 "$GITHUB_SHA")
@@ -131,7 +129,6 @@ jobs:
131129 DISTTYPE : nightly
132130
133131 - name : Upload tarball artifact
134- if : ${{ github.event_name != 'workflow_dispatch' }}
135132 uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
136133 with :
137134 name : tarballs
@@ -157,55 +154,75 @@ jobs:
157154 runs-on : ${{ matrix.runner }}
158155 steps :
159156 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
160- if : ${{ github.event_name != 'workflow_dispatch' }}
161157 with :
162158 persist-credentials : false
163159 sparse-checkout : .github/actions
160+ sparse-checkout-cone-mode : false
164161 - uses : ./.github/actions/build-shared
165- if : ${{ github.event_name != 'workflow_dispatch' }}
162+ name : Build and test Node.js
166163 with :
167- system : ${{ matrix.system }}
168164 cachix-auth-token : ${{ secrets.CACHIX_AUTH_TOKEN }}
165+ extra-nix-attrs : |
166+ --arg useSeparateDerivationForV8 true \
167+ ${{ endsWith(matrix.system, '-darwin') && '--arg withAmaro false --arg withLief false --arg withSQLite false --arg withFFI false --arg extraConfigFlags ''["--without-inspector" "--without-node-options"]'' \' || '\' }}
169168
170169 build-aarch64-linux-v8 :
171170 needs : build-tarball
172171 runs-on : ubuntu-24.04-arm
173- name : ' aarch64-linux: Cache V8 build'
172+ name : ' aarch64-linux: Build V8'
173+ outputs :
174+ local-cache : ${{ steps.upload.outcome != 'skipped' && 'true' }}
174175 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-
179176 - uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
180- if : ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }}
181177 with :
182178 name : tarballs
183179 path : tarballs
184180
185181 - name : Extract tarball
186- if : ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }}
187182 shell : bash
188183 run : |
189184 tar xzf tarballs/*.tar.gz -C "$RUNNER_TEMP"
190185 echo "TAR_DIR=$RUNNER_TEMP/$(basename tarballs/*.tar.gz .tar.gz)" >> "$GITHUB_ENV"
191186
192187 - uses : cachix/install-nix-action@96951a368ba55167b55f1c916f7d416bac6505fe # v31.10.3
193- if : ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }}
194188 with :
195189 extra_nix_config : sandbox = true
196190
191+ - name : Prepare V8
192+ id : v8-drv
193+ run : |
194+ echo "V8_DRV=$(
195+ nix-instantiate -E "builtins.filter (p: p.pname == ''v8'') (import $TAR_DIR/shell.nix { useSeparateDerivationForV8=true; }).buildInputs"
196+ )" >> "$GITHUB_OUTPUT"
197+
198+ - name : Check if available on Cachix
199+ id : cachix-check
200+ run : |
201+ echo 'WRITE_ACCESS=${{ secrets.CACHIX_AUTH_TOKEN && 'true' }}' >> "$GITHUB_OUTPUT"
202+ [ "$(curl -ISsw "%{http_code}" "https://nodejs.cachix.org/$(basename ${V8_DRV%-v8-*}).narinfo")" != "200" ] ||
203+ echo "ALREADY_CACHED=true" >> "$GITHUB_OUTPUT"
204+ env :
205+ V8_DRV : ${{ steps.v8-drv.outputs.V8_DRV }}
206+
197207 - uses : cachix/cachix-action@1eb2ef646ac0255473d23a5907ad7b04ce94065c # v17
198- if : ${{ steps.cachix-check.outputs.IS_AVAILABLE = = 'true' }}
208+ if : ${{ steps.cachix-check.outputs.ALREADY_CACHED ! = 'true' }}
199209 with :
200210 name : nodejs
201211 authToken : ${{ secrets.CACHIX_AUTH_TOKEN }}
202212
203213 - 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- )"
214+ if : ${{ steps.cachix-check.outputs.ALREADY_CACHED != 'true' }}
215+ run : nix-store --export "$(nix-build "$V8_DRV")" > libv8
216+ env :
217+ V8_DRV : ${{ steps.v8-drv.outputs.V8_DRV }}
218+
219+ - name : Upload libv8
220+ if : ${{ steps.cachix-check.outputs.ALREADY_CACHED != 'true' && steps.cachix-check.outputs.WRITE_ACCESS != 'true' }}
221+ id : upload
222+ uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
223+ with :
224+ name : libv8
225+ path : libv8
209226
210227 # Builds the matrix for `build-openssl` from tools/nix/openssl-matrix.json.
211228 # Output shape:
@@ -241,26 +258,36 @@ jobs:
241258 strategy :
242259 fail-fast : false
243260 matrix :
244- openssl : ${{ fromJSON(needs.collect-openssl-versions .outputs.matrix) }}
261+ openssl : ${{ fromJSON(needs.build-aarch64-linux-v8 .outputs.matrix) }}
245262 name : ' aarch64-linux: with shared ${{ matrix.openssl.attr }} (${{ matrix.openssl.version }})'
246263 runs-on : ubuntu-24.04-arm
247264 continue-on-error : ${{ matrix.openssl['continue-on-error'] }}
248265 env :
249266 OPENSSL_ATTR : ${{ matrix.openssl.attr }}
250- OPENSSL_VERSION : ${{ matrix.openssl.version }}
251267 steps :
252268 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
253269 with :
254270 persist-credentials : false
255271 sparse-checkout : .github/actions
272+ sparse-checkout-cone-mode : false
273+
274+ - uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
275+ if : ${{ needs.build-aarch64-linux-v8.outputs.local-cache == 'true' }}
276+ with :
277+ name : libv8
278+
256279 - uses : ./.github/actions/build-shared
280+ name : Build and test Node.js
257281 with :
258- system : aarch64-linux
259282 cachix-auth-token : ${{ secrets.CACHIX_AUTH_TOKEN }}
260283 # Override just the `openssl` attr of the default shared-lib set with
261284 # the matrix-selected nixpkgs attribute (e.g. `openssl_3_6`). All
262285 # other shared libs (brotli, cares, libuv, …) keep their defaults.
263286 # `permittedInsecurePackages` whitelists just the matrix-selected
264287 # release (e.g. `openssl-1.1.1w`) so EOL-with-extended-support
265288 # 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; }"
289+ extra-nix-args : |
290+ --arg useSeparateDerivationForV8 ${{ needs.build-aarch64-linux-v8.outputs.local-cache || '"$(nix-store --import < libv8)"' }} \
291+ --arg sharedLibDeps "(import $TAR_DIR/tools/nix/sharedLibDeps.nix {}) // {
292+ openssl = (import $TAR_DIR/tools/nix/openssl-matrix.nix {}).$OPENSSL_ATTR;
293+ }" \
0 commit comments