Skip to content

Commit cb425b9

Browse files
committed
move openssl-matrix to a nix file
1 parent c202696 commit cb425b9

3 files changed

Lines changed: 50 additions & 40 deletions

File tree

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

Lines changed: 0 additions & 5 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
@@ -61,11 +58,9 @@ runs:
6158
--pure --keep TAR_DIR --keep FLAKY_TESTS \
6259
--keep SCCACHE_GHA_ENABLED --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \
6360
--arg loadJSBuiltinsDynamically false \
64-
--arg useSeparateDerivationForV8 true \
6561
--arg ccache "${NIX_SCCACHE:-null}" \
6662
--arg devTools '[]' \
6763
--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"]'' \' || '\' }}
6964
${{ inputs.extra-nix-args }} \
7065
--run '
7166
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: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -161,73 +161,65 @@ jobs:
161161
with:
162162
persist-credentials: false
163163
sparse-checkout: .github/actions
164+
sparse-checkout-cone-mode: false
164165
- uses: ./.github/actions/build-shared
165166
if: ${{ github.event_name != 'workflow_dispatch' }}
166167
with:
167-
system: ${{ matrix.system }}
168168
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
169+
extra-nix-attrs: |
170+
--arg useSeparateDerivationForV8 true \
171+
${{ endsWith(matrix.system, '-darwin') && '--arg withAmaro false --arg withLief false --arg withSQLite false --arg withFFI false --arg extraConfigFlags ''["--without-inspector" "--without-node-options"]'' \' || '\' }}
169172
170173
build-aarch64-linux-v8:
171174
needs: build-tarball
172175
runs-on: ubuntu-24.04-arm
173176
name: 'aarch64-linux: Cache V8 build'
177+
outputs:
178+
matrix: ${{ steps.query.outputs.matrix }}
174179
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-
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' }}
201+
id: build
205202
run: |
206-
nix-build "$(
203+
echo "V8_DIR=$(nix-build "$(
207204
nix-instantiate -E "builtins.filter (p: p.pname == ''v8'') (import $TAR_DIR/shell.nix { useSeparateDerivationForV8=true; }).buildInputs"
208-
)"
205+
)")" >> "$GITHUB_OUTPUT"
209206
210-
# Builds the matrix for `build-openssl` from tools/nix/openssl-matrix.json.
211-
# Output shape:
212-
# [{ "version": "3.6.1", "attr": "openssl_3_6", "continue-on-error": false }, ...]
213-
collect-openssl-versions:
214-
if: github.event.pull_request.draft == false
215-
runs-on: ubuntu-slim
216-
outputs:
217-
matrix: ${{ steps.query.outputs.matrix }}
218-
steps:
219-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
207+
- name: Upload tarball artifact
208+
if: ${{ github.event_name != 'workflow_dispatch' }}
209+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
220210
with:
221-
persist-credentials: false
222-
sparse-checkout: tools/nix/openssl-matrix.json
223-
sparse-checkout-cone-mode: false
224-
- id: query
211+
name: libv8
212+
path: ${{ steps.build.outputs.V8_DIR }}
213+
214+
- name: Compute OpenSSL support matrix
215+
id: query
225216
run: |
226-
{
227-
echo 'matrix<<EOF'
228-
cat tools/nix/openssl-matrix.json
229-
echo 'EOF'
230-
} >> "$GITHUB_OUTPUT"
217+
nix-instantiate --eval --strict --json -E "
218+
let
219+
matrix = import $TAR_DIR/tools/nix/openssl-matrix.nix {};
220+
in
221+
builtins.map (attr: { inherit attr; inherit (builtins.getAttr attr matrix) name; }) (builtins.attrNames matrix)
222+
"
231223
232224
# Builds and tests Node.js with shared libraries against every supported
233225
# OpenSSL release version available in the repo-pinned nixpkgs. The default
@@ -237,22 +229,26 @@ jobs:
237229
build-openssl:
238230
needs:
239231
- build-aarch64-linux-v8
240-
- collect-openssl-versions
241232
strategy:
242233
fail-fast: false
243234
matrix:
244-
openssl: ${{ fromJSON(needs.collect-openssl-versions.outputs.matrix) }}
235+
openssl: ${{ fromJSON(needs.build-aarch64-linux-v8.outputs.matrix) }}
245236
name: 'aarch64-linux: with shared ${{ matrix.openssl.attr }} (${{ matrix.openssl.version }})'
246237
runs-on: ubuntu-24.04-arm
247238
continue-on-error: ${{ matrix.openssl['continue-on-error'] }}
248239
env:
249240
OPENSSL_ATTR: ${{ matrix.openssl.attr }}
250-
OPENSSL_VERSION: ${{ matrix.openssl.version }}
251241
steps:
252242
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
253243
with:
254244
persist-credentials: false
255245
sparse-checkout: .github/actions
246+
sparse-checkout-cone-mode: false
247+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
248+
if: ${{ github.event_name != 'workflow_dispatch' }}
249+
with:
250+
name: libv8
251+
path: ${{ runner.temp }}/libv8
256252
- uses: ./.github/actions/build-shared
257253
with:
258254
system: aarch64-linux
@@ -263,4 +259,8 @@ jobs:
263259
# `permittedInsecurePackages` whitelists just the matrix-selected
264260
# release (e.g. `openssl-1.1.1w`) so EOL-with-extended-support
265261
# 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; }"
262+
extra-nix-args: |
263+
--arg useSeparateDerivationForV8 "$RUNNER_TEMP/libv8" \
264+
--arg sharedLibDeps "(import $TAR_DIR/tools/nix/sharedLibDeps.nix {}) // {
265+
openssl = (import $TAR_DIR/tools/nix/openssl-matrix.nix {}).$OPENSSL_ATTR;
266+
}"

tools/nix/openssl-matrix.nix

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
pkgs ? import ./pkgs.nix {
3+
config.permittedInsecurePackages = [ "openssl-1.1.1w" ];
4+
},
5+
}:
6+
7+
{
8+
inherit (pkgs)
9+
openssl_1_1
10+
openssl_3
11+
openssl_3_5
12+
openssl_3_6
13+
openssl_4_0
14+
;
15+
}

0 commit comments

Comments
 (0)