Skip to content

Commit 55f6ac3

Browse files
committed
tools: reuse V8 builds even without Cachix
1 parent c202696 commit 55f6ac3

2 files changed

Lines changed: 31 additions & 25 deletions

File tree

.github/actions/build-shared/action.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ description: >
55
test suite inside the pinned nix-shell.
66
77
inputs:
8-
system:
9-
description: System label (e.g. x86_64-linux, aarch64-darwin).
10-
required: true
118
extra-nix-args:
129
description: Additional arguments appended to the nix-shell invocation.
1310
required: false
@@ -21,13 +18,11 @@ runs:
2118
using: composite
2219
steps:
2320
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
24-
if: ${{ github.event_name != 'workflow_dispatch' }}
2521
with:
2622
name: tarballs
2723
path: tarballs
2824

2925
- name: Extract tarball
30-
if: ${{ github.event_name != 'workflow_dispatch' }}
3126
shell: bash
3227
run: |
3328
tar xzf tarballs/*.tar.gz -C "$RUNNER_TEMP"
@@ -61,11 +56,9 @@ runs:
6156
--pure --keep TAR_DIR --keep FLAKY_TESTS \
6257
--keep SCCACHE_GHA_ENABLED --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \
6358
--arg loadJSBuiltinsDynamically false \
64-
--arg useSeparateDerivationForV8 true \
6559
--arg ccache "${NIX_SCCACHE:-null}" \
6660
--arg devTools '[]' \
6761
--arg benchmarkTools '[]' \
68-
${{ endsWith(inputs.system, '-darwin') && '--arg withAmaro false --arg withLief false --arg withSQLite false --arg withFFI false --arg extraConfigFlags ''["--without-inspector" "--without-node-options"]'' \' || '\' }}
6962
${{ inputs.extra-nix-args }} \
7063
--run '
7164
make -C "$TAR_DIR" run-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS"

.github/workflows/test-shared.yml

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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,61 @@ 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+
with-cachix: ${{ steps.cachix-check.outputs.IS_AVAILABLE }}
174175
steps:
175176
- name: Check if Cachix is available
176177
id: cachix-check
177178
run: echo 'IS_AVAILABLE=${{ secrets.CACHIX_AUTH_TOKEN && 'true' }}' >> "$GITHUB_OUTPUT"
178179

179180
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
180-
if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }}
181181
with:
182182
name: tarballs
183183
path: tarballs
184184

185185
- name: Extract tarball
186-
if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }}
187186
shell: bash
188187
run: |
189188
tar xzf tarballs/*.tar.gz -C "$RUNNER_TEMP"
190189
echo "TAR_DIR=$RUNNER_TEMP/$(basename tarballs/*.tar.gz .tar.gz)" >> "$GITHUB_ENV"
191190
192191
- uses: cachix/install-nix-action@96951a368ba55167b55f1c916f7d416bac6505fe # v31.10.3
193-
if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }}
194192
with:
195193
extra_nix_config: sandbox = true
196194

197195
- uses: cachix/cachix-action@1eb2ef646ac0255473d23a5907ad7b04ce94065c # v17
198-
if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }}
199196
with:
200197
name: nodejs
201198
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
202199

203200
- name: Build V8 derivation
204-
if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }}
205201
run: |
206-
nix-build "$(
202+
nix-store --export "$(nix-build "$(
207203
nix-instantiate -E "builtins.filter (p: p.pname == ''v8'') (import $TAR_DIR/shell.nix { useSeparateDerivationForV8=true; }).buildInputs"
208-
)"
204+
)")" > libv8
205+
206+
- name: Upload libv8
207+
if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }}
208+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
209+
with:
210+
name: libv8
211+
path: libv8
209212

210213
# Builds the matrix for `build-openssl` from tools/nix/openssl-matrix.json.
211214
# Output shape:
@@ -241,26 +244,36 @@ jobs:
241244
strategy:
242245
fail-fast: false
243246
matrix:
244-
openssl: ${{ fromJSON(needs.collect-openssl-versions.outputs.matrix) }}
247+
openssl: ${{ fromJSON(needs.build-aarch64-linux-v8.outputs.matrix) }}
245248
name: 'aarch64-linux: with shared ${{ matrix.openssl.attr }} (${{ matrix.openssl.version }})'
246249
runs-on: ubuntu-24.04-arm
247250
continue-on-error: ${{ matrix.openssl['continue-on-error'] }}
248251
env:
249252
OPENSSL_ATTR: ${{ matrix.openssl.attr }}
250-
OPENSSL_VERSION: ${{ matrix.openssl.version }}
251253
steps:
252254
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
253255
with:
254256
persist-credentials: false
255257
sparse-checkout: .github/actions
258+
sparse-checkout-cone-mode: false
259+
260+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
261+
if: ${{ needs.build-aarch64-linux-v8.outputs.with-cachix == 'true' }}
262+
with:
263+
name: libv8
264+
256265
- uses: ./.github/actions/build-shared
266+
name: Build and test Node.js
257267
with:
258-
system: aarch64-linux
259268
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
260269
# Override just the `openssl` attr of the default shared-lib set with
261270
# the matrix-selected nixpkgs attribute (e.g. `openssl_3_6`). All
262271
# other shared libs (brotli, cares, libuv, …) keep their defaults.
263272
# `permittedInsecurePackages` whitelists just the matrix-selected
264273
# release (e.g. `openssl-1.1.1w`) so EOL-with-extended-support
265274
# 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; }"
275+
extra-nix-args: |
276+
--arg useSeparateDerivationForV8 ${{ needs.build-aarch64-linux-v8.outputs.with-cachix || '"$(nix-store --import < libv8)"' }} \
277+
--arg sharedLibDeps "(import $TAR_DIR/tools/nix/sharedLibDeps.nix {}) // {
278+
openssl = (import $TAR_DIR/tools/nix/openssl-matrix.nix {}).$OPENSSL_ATTR;
279+
}" \

0 commit comments

Comments
 (0)