Skip to content

Commit 70b84df

Browse files
committed
tools: share CI and benchmark build configuration
Benchmark builds kept Temporal enabled on macOS after the Nix default changed, while shared-library CI disabled it. This forced benchmarks to rebuild V8 instead of reusing the cached derivation. Define the common Nix flags in a composite action used by both workflows to keep their build configurations aligned. Signed-off-by: Filip Skokan <panva.ip@gmail.com> Assisted-by: Codex
1 parent 5137638 commit 70b84df

4 files changed

Lines changed: 63 additions & 26 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Shared-library build configuration
2+
description: Common Nix build flags for shared-library CI and benchmarks.
3+
4+
inputs:
5+
with-perfetto:
6+
description: Whether to enable Perfetto
7+
default: 'false'
8+
9+
outputs:
10+
nix-flags:
11+
description: Shell-escaped arguments for nix-shell
12+
value: ${{ steps.config.outputs.nix-flags }}
13+
14+
runs:
15+
using: composite
16+
steps:
17+
- id: config
18+
shell: bash
19+
run: |
20+
args=(
21+
--arg useSeparateDerivationForV8 true
22+
--arg loadJSBuiltinsDynamically false
23+
--arg devTools '[]'
24+
--arg benchmarkTools '[]'
25+
--arg withPerfetto "$WITH_PERFETTO"
26+
)
27+
if [[ "$RUNNER_OS" == macOS ]]; then
28+
args+=(
29+
--arg withAmaro false
30+
--arg withFFI false
31+
--arg withLief false
32+
--arg withSQLite false
33+
--arg withTemporal false
34+
--arg extraConfigFlags '["--without-inspector" "--without-node-options"]'
35+
)
36+
fi
37+
printf -v flags '%q ' "${args[@]}"
38+
echo "nix-flags=$flags" >> "$GITHUB_OUTPUT"
39+
env:
40+
WITH_PERFETTO: ${{ inputs.with-perfetto }}

‎.github/workflows/benchmark.yml‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,21 @@ jobs:
114114
core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || '');
115115
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
116116
117+
- name: Configure shared-library build
118+
id: build-config
119+
uses: $/.github/actions/shared-build-config
120+
with:
121+
with-perfetto: ${{ matrix.perfetto || false }}
122+
117123
- name: Build Node.js on the base commit
118124
run: |
119125
nix-shell \
120126
-I nixpkgs=./tools/nix/pkgs.nix \
121127
--pure --keep TAR_DIR --keep FLAKY_TESTS \
122128
--keep SCCACHE_GHA_ENABLED --keep SCCACHE_GHA_RW_MODE \
123129
--keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \
124-
--arg useSeparateDerivationForV8 true \
125-
--arg withPerfetto ${{ matrix.perfetto || false }} \
126-
--arg loadJSBuiltinsDynamically false \
130+
${{ steps.build-config.outputs.nix-flags }} \
127131
--arg ccache '(import <nixpkgs> {}).sccache' \
128-
--arg devTools '[]' \
129-
--arg benchmarkTools '[]' \
130132
--run '
131133
make build-ci -j4 V=1 && sccache --stop-server
132134
'
@@ -141,12 +143,8 @@ jobs:
141143
nix-shell \
142144
-I nixpkgs=./tools/nix/pkgs.nix \
143145
--pure --keep SCCACHE_LOCAL_RW_MODE \
144-
--arg useSeparateDerivationForV8 true \
145-
--arg withPerfetto ${{ matrix.perfetto || false }} \
146-
--arg loadJSBuiltinsDynamically false \
146+
${{ steps.build-config.outputs.nix-flags }} \
147147
--arg ccache '(import <nixpkgs> {}).sccache' \
148-
--arg devTools '[]' \
149-
--arg benchmarkTools '[]' \
150148
--run '
151149
make build-ci -j4 V=1
152150
'

‎.github/workflows/build-shared.yml‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ on:
1717
required: false
1818
type: boolean
1919
default: false
20+
with-perfetto:
21+
description: Whether to enable Perfetto
22+
required: false
23+
type: boolean
24+
default: false
2025
v8-nar:
2126
description: An optional name for the NAR archive for V8 that needs to be downloaded
2227
required: false
@@ -78,17 +83,21 @@ jobs:
7883
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
7984
core.exportVariable('NIX_SCCACHE', '(import <nixpkgs> {}).sccache');
8085
86+
- name: Configure shared-library build
87+
id: build-config
88+
uses: $/.github/actions/shared-build-config
89+
with:
90+
with-perfetto: ${{ inputs.with-perfetto }}
91+
8192
- name: Build Node.js and run tests
8293
shell: bash
8394
run: |
8495
nix-shell \
8596
-I "nixpkgs=$TAR_DIR/tools/nix/pkgs.nix" \
8697
--pure --keep TAR_DIR --keep FLAKY_TESTS \
8798
--keep SCCACHE_GHA_ENABLED --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \
88-
--arg loadJSBuiltinsDynamically false \
99+
${{ steps.build-config.outputs.nix-flags }} \
89100
--arg ccache "${NIX_SCCACHE:-null}" \
90-
--arg devTools '[]' \
91-
--arg benchmarkTools '[]' \
92101
--arg pkcs11 ${{ inputs.pkcs11-store-test }} \
93102
${{ inputs.extra-nix-flags }} \
94103
--run '

‎.github/workflows/test-shared.yml‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ on:
5454
- .**
5555
- '!.github/workflows/test-shared.yml'
5656
- '!.github/workflows/build-shared.yml'
57+
- '!.github/actions/shared-build-config/**'
5758
types: [opened, synchronize, reopened, ready_for_review]
5859
push:
5960
branches:
@@ -111,6 +112,7 @@ on:
111112
- .**
112113
- '!.github/workflows/test-shared.yml'
113114
- '!.github/workflows/build-shared.yml'
115+
- '!.github/actions/shared-build-config/**'
114116

115117
concurrency:
116118
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -165,19 +167,7 @@ jobs:
165167
with:
166168
runner: ${{ matrix.runner }}
167169
with-sccache: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
168-
extra-nix-flags: |
169-
--arg useSeparateDerivationForV8 true \
170-
${{ matrix.perfetto && '--arg withPerfetto true \' || '\' }}
171-
${{ endsWith(matrix.system, '-darwin') && '\
172-
--arg withAmaro false \
173-
--arg withFFI false \
174-
--arg withLief false \
175-
--arg withSQLite false \
176-
--arg withTemporal false \
177-
--arg extraConfigFlags ''[
178-
"--without-inspector"
179-
"--without-node-options"
180-
]'' \' || '\' }}
170+
with-perfetto: ${{ matrix.perfetto || false }}
181171
secrets:
182172
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
183173

0 commit comments

Comments
 (0)