Skip to content

Commit 2045f6f

Browse files
committed
tools: cache V8 builds
1 parent 5a877ec commit 2045f6f

1 file changed

Lines changed: 79 additions & 7 deletions

File tree

.github/workflows/test-shared.yml

Lines changed: 79 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,47 @@ jobs:
141141
path: '*.tar.gz'
142142
compression-level: 0
143143

144+
build-aarch64-linux-v8:
145+
needs: build-tarball
146+
runs-on: ubuntu-24.04-arm
147+
name: 'aarch64-linux: Cache V8 build'
148+
steps:
149+
- name: Check if Cachix is available
150+
id: cachix-check
151+
run: echo 'IS_AVAILABLE=${{ secrets.CACHIX_AUTH_TOKEN && 'true' }}' >> "$GITHUB_OUTPUT"
152+
153+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
154+
if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }}
155+
with:
156+
name: tarballs
157+
path: tarballs
158+
159+
- name: Extract tarball
160+
if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }}
161+
shell: bash
162+
run: |
163+
tar xzf tarballs/*.tar.gz -C "$RUNNER_TEMP"
164+
echo "TAR_DIR=$RUNNER_TEMP/$(basename tarballs/*.tar.gz .tar.gz)" >> "$GITHUB_ENV"
165+
166+
- uses: cachix/install-nix-action@96951a368ba55167b55f1c916f7d416bac6505fe # v31.10.3
167+
if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }}
168+
with:
169+
extra_nix_config: sandbox = true
170+
171+
- uses: cachix/cachix-action@1eb2ef646ac0255473d23a5907ad7b04ce94065c # v17
172+
if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }}
173+
with:
174+
name: nodejs
175+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
176+
177+
- name: Build V8 derivation
178+
if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }}
179+
run: |
180+
set +x
181+
nix-build "$(
182+
nix-instantiate -E "builtins.filter (p: p.pname == 'v8') (import $TAR_DIR/shell.nix { useSeparateDerivationForV8=true; }).buildInputs"
183+
)"
184+
144185
build:
145186
needs: build-tarball
146187
strategy:
@@ -149,8 +190,8 @@ jobs:
149190
include:
150191
- runner: ubuntu-24.04
151192
system: x86_64-linux
152-
- runner: ubuntu-24.04-arm
153-
system: aarch64-linux
193+
# - runner: ubuntu-24.04-arm
194+
# system: aarch64-linux
154195
- runner: macos-15-intel
155196
system: x86_64-darwin
156197
- runner: macos-latest
@@ -169,6 +210,34 @@ jobs:
169210
system: ${{ matrix.system }}
170211
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
171212

213+
build-aarch64-linux:
214+
needs: build-aarch64-linux-v8
215+
strategy:
216+
fail-fast: false
217+
matrix:
218+
include:
219+
# - runner: ubuntu-24.04
220+
# system: x86_64-linux
221+
- runner: ubuntu-24.04-arm
222+
system: aarch64-linux
223+
# - runner: macos-15-intel
224+
# system: x86_64-darwin
225+
# - runner: macos-latest
226+
# system: aarch64-darwin
227+
name: '${{ matrix.system }}: with shared libraries'
228+
runs-on: ${{ matrix.runner }}
229+
steps:
230+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
231+
if: ${{ github.event_name != 'workflow_dispatch' }}
232+
with:
233+
persist-credentials: false
234+
sparse-checkout: .github/actions
235+
- uses: ./.github/actions/build-shared
236+
if: ${{ github.event_name != 'workflow_dispatch' }}
237+
with:
238+
system: ${{ matrix.system }}
239+
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
240+
172241
# Builds the matrix for `build-openssl` from tools/nix/openssl-matrix.json.
173242
# Output shape:
174243
# [{ "version": "3.6.1", "attr": "openssl_3_6", "continue-on-error": false }, ...]
@@ -181,21 +250,24 @@ jobs:
181250
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
182251
with:
183252
persist-credentials: false
184-
sparse-checkout: tools/nix
253+
sparse-checkout: tools/nix/openssl-matrix.json
185254
sparse-checkout-cone-mode: false
186255
- id: query
187256
run: |
188-
matrix=$(jq -c . tools/nix/openssl-matrix.json)
189-
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
190-
257+
{
258+
echo 'matrix<<EOF'
259+
cat tools/nix/openssl-matrix.json
260+
echo 'EOF'
261+
} >> "$GITHUB_OUTPUT"
262+
191263
# Builds and tests Node.js with shared libraries against every supported
192264
# OpenSSL release version available in the repo-pinned nixpkgs. The default
193265
# shared `openssl` from tools/nix/sharedLibDeps.nix is overridden per matrix
194266
# entry, while all other shared libs remain at their defaults. Only runs on
195267
# a single runner/system (aarch64-linux) to keep the matrix to a minimum.
196268
build-openssl:
197269
needs:
198-
- build-tarball
270+
- build-aarch64-linux-v8
199271
- collect-openssl-versions
200272
strategy:
201273
fail-fast: false

0 commit comments

Comments
 (0)