Skip to content

Commit e402736

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

1 file changed

Lines changed: 85 additions & 7 deletions

File tree

.github/workflows/test-shared.yml

Lines changed: 85 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,53 @@ 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
178+
if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }}
179+
shell: bash
180+
run: |
181+
nix-shell \
182+
-I "nixpkgs=$TAR_DIR/tools/nix/pkgs.nix" \
183+
--pure \
184+
--arg useSeparateDerivationForV8 true \
185+
--arg ccache "${NIX_SCCACHE:-null}" \
186+
--arg sharedLibDeps '{}' \
187+
--arg devTools '[]' \
188+
--arg benchmarkTools '[]' \
189+
--run 'echo Done' "$TAR_DIR/shell.nix"
190+
144191
build:
145192
needs: build-tarball
146193
strategy:
@@ -149,8 +196,8 @@ jobs:
149196
include:
150197
- runner: ubuntu-24.04
151198
system: x86_64-linux
152-
- runner: ubuntu-24.04-arm
153-
system: aarch64-linux
199+
# - runner: ubuntu-24.04-arm
200+
# system: aarch64-linux
154201
- runner: macos-15-intel
155202
system: x86_64-darwin
156203
- runner: macos-latest
@@ -169,6 +216,34 @@ jobs:
169216
system: ${{ matrix.system }}
170217
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
171218

219+
build-aarch64-linux:
220+
needs: build-aarch64-linux-v8
221+
strategy:
222+
fail-fast: false
223+
matrix:
224+
include:
225+
# - runner: ubuntu-24.04
226+
# system: x86_64-linux
227+
- runner: ubuntu-24.04-arm
228+
system: aarch64-linux
229+
# - runner: macos-15-intel
230+
# system: x86_64-darwin
231+
# - runner: macos-latest
232+
# system: aarch64-darwin
233+
name: '${{ matrix.system }}: with shared libraries'
234+
runs-on: ${{ matrix.runner }}
235+
steps:
236+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
237+
if: ${{ github.event_name != 'workflow_dispatch' }}
238+
with:
239+
persist-credentials: false
240+
sparse-checkout: .github/actions
241+
- uses: ./.github/actions/build-shared
242+
if: ${{ github.event_name != 'workflow_dispatch' }}
243+
with:
244+
system: ${{ matrix.system }}
245+
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
246+
172247
# Builds the matrix for `build-openssl` from tools/nix/openssl-matrix.json.
173248
# Output shape:
174249
# [{ "version": "3.6.1", "attr": "openssl_3_6", "continue-on-error": false }, ...]
@@ -181,21 +256,24 @@ jobs:
181256
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
182257
with:
183258
persist-credentials: false
184-
sparse-checkout: tools/nix
259+
sparse-checkout: tools/nix/openssl-matrix.json
185260
sparse-checkout-cone-mode: false
186261
- id: query
187262
run: |
188-
matrix=$(jq -c . tools/nix/openssl-matrix.json)
189-
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
190-
263+
{
264+
echo 'matrix<<EOF'
265+
cat tools/nix/openssl-matrix.json
266+
echo 'EOF'
267+
} >> "$GITHUB_OUTPUT"
268+
191269
# Builds and tests Node.js with shared libraries against every supported
192270
# OpenSSL release version available in the repo-pinned nixpkgs. The default
193271
# shared `openssl` from tools/nix/sharedLibDeps.nix is overridden per matrix
194272
# entry, while all other shared libs remain at their defaults. Only runs on
195273
# a single runner/system (aarch64-linux) to keep the matrix to a minimum.
196274
build-openssl:
197275
needs:
198-
- build-tarball
276+
- build-aarch64-linux-v8
199277
- collect-openssl-versions
200278
strategy:
201279
fail-fast: false

0 commit comments

Comments
 (0)