Skip to content

Commit 5262bcd

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

1 file changed

Lines changed: 55 additions & 6 deletions

File tree

.github/workflows/test-shared.yml

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

144-
build:
144+
build-v8:
145145
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' }}' >> "$GITUHB_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 devTools '[]' \
187+
--arg benchmarkTools '[]' \
188+
--run ';'
189+
190+
build:
191+
needs: build-v8
146192
strategy:
147193
fail-fast: false
148194
matrix:
@@ -181,21 +227,24 @@ jobs:
181227
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
182228
with:
183229
persist-credentials: false
184-
sparse-checkout: tools/nix
230+
sparse-checkout: tools/nix/openssl-matrix.json
185231
sparse-checkout-cone-mode: false
186232
- id: query
187233
run: |
188-
matrix=$(jq -c . tools/nix/openssl-matrix.json)
189-
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
190-
234+
{
235+
echo 'matrix<<EOF'
236+
cat tools/nix/openssl-matrix.json
237+
echo 'EOF'
238+
} >> "$GITHUB_OUTPUT"
239+
191240
# Builds and tests Node.js with shared libraries against every supported
192241
# OpenSSL release version available in the repo-pinned nixpkgs. The default
193242
# shared `openssl` from tools/nix/sharedLibDeps.nix is overridden per matrix
194243
# entry, while all other shared libs remain at their defaults. Only runs on
195244
# a single runner/system (aarch64-linux) to keep the matrix to a minimum.
196245
build-openssl:
197246
needs:
198-
- build-tarball
247+
- build-v8
199248
- collect-openssl-versions
200249
strategy:
201250
fail-fast: false

0 commit comments

Comments
 (0)