Skip to content

Commit e7023eb

Browse files
committed
fixup! fixup! tools: run CI with shared libs on GHA
1 parent cbb4073 commit e7023eb

File tree

6 files changed

+80
-55
lines changed

6 files changed

+80
-55
lines changed

.github/workflows/linters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ jobs:
123123
persist-credentials: false
124124
sparse-checkout: '*.nix'
125125
sparse-checkout-cone-mode: false
126-
- uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
126+
- uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
127127
- name: Lint Nix files
128-
run: nix-shell -I nixpkgs=./nixpkgs.nix -p 'nixfmt-tree' --run 'treefmt --quiet --fail-on-change'
128+
run: nix-shell -I nixpkgs=./nixpkgs.nix -p 'nixfmt-tree' --run 'treefmt --quiet --fail-on-change'
129129
- if: ${{ failure() }}
130130
name: Show diff
131131
run: git --no-pager diff

.github/workflows/test-shared.yml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ on:
2727
inputs:
2828
repo:
2929
type: string
30-
description: 'GitHub repository to fetch from (default to the current repo)'
30+
description: GitHub repository to fetch from (default to the current repo)
3131
pr_id:
3232
type: number
3333
required: true
34-
description: 'The PR to test'
34+
description: The PR to test
3535
commit:
3636
required: true
3737
type: string
38-
description: 'The expect HEAD of the PR'
38+
description: The expect HEAD of the PR
3939
category:
4040
required: true
4141
type: string
@@ -88,7 +88,6 @@ jobs:
8888
env:
8989
DISTTYPE: nightly
9090

91-
9291
- name: Upload tarball artifact
9392
if: ${{ github.event_name != 'workflow_dispatch' }}
9493
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@@ -126,7 +125,7 @@ jobs:
126125
tar xzf tarballs/*.tar.gz -C "$RUNNER_TEMP"
127126
echo "TAR_DIR=$RUNNER_TEMP/$(basename tarballs/*.tar.gz .tar.gz)" >> "$GITHUB_ENV"
128127
129-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
128+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
130129
if: ${{ github.event_name == 'workflow_dispatch' }}
131130
with:
132131
repository: ${{ inputs.repo || github.repository }}
@@ -142,25 +141,25 @@ jobs:
142141
env:
143142
EXPECTED_SHA: ${{ inputs.commit }}
144143

145-
- uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
144+
- uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
146145
with:
147146
extra_nix_config: sandbox = true
148147
github_access_token: ${{ secrets.GITHUB_TOKEN }}
149148

150-
- uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16
149+
- uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16
151150
with:
152151
name: nodejs
153152
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
154153

155154
- name: Configure sccache
156-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
155+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
157156
with:
158157
script: |
159158
core.exportVariable('SCCACHE_GHA_VERSION', 'on');
160159
core.exportVariable('ACTIONS_CACHE_SERVICE_V2', 'on');
161160
core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || '');
162161
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
163-
162+
164163
- name: Load shell.nix
165164
run: |
166165
${{ github.event_name == 'workflow_dispatch' &&
@@ -171,6 +170,7 @@ jobs:
171170
- name: Build Node.js ${{ github.event_name == 'workflow_dispatch' && 'on the base commit' || 'and run tests' }}
172171
run: |
173172
nix-shell \
173+
-I nixpkgs=./nixpkgs.nix \
174174
--pure --keep TAR_DIR --keep FLAKY_TESTS \
175175
--keep SCCACHE_GHA_VERSION --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \
176176
--arg loadJSBuiltinsDynamically false \
@@ -188,6 +188,7 @@ jobs:
188188
mv out/Release/node base_node
189189
git reset FETCH_HEAD --hard
190190
nix-shell \
191+
-I nixpkgs=./nixpkgs.nix \
191192
--pure \
192193
--arg loadJSBuiltinsDynamically false \
193194
--arg ccache 'null' \
@@ -201,6 +202,7 @@ jobs:
201202
if: ${{ github.event_name == 'workflow_dispatch' }}
202203
run: |
203204
nix-shell \
205+
-I nixpkgs=./nixpkgs.nix \
204206
--pure --keep FILTER \
205207
--arg loadJSBuiltinsDynamically false \
206208
--arg ccache 'null' \
@@ -235,34 +237,35 @@ jobs:
235237
if: ${{ github.event_name == 'workflow_dispatch' }}
236238
runs-on: ubuntu-latest
237239
steps:
238-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
240+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
239241
with:
240242
persist-credentials: false
241243
sparse-checkout: |
242244
benchmark/*.R
243-
shell.nix
245+
*.nix
244246
sparse-checkout-cone-mode: false
245247

246248
- name: Download benchmark raw results
247-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
249+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
248250
with:
249251
pattern: csv-*
250-
merge-multiple: true
252+
merge-multiple: true
251253
path: raw-results
252254

253-
- uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
255+
- uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
254256
with:
255257
extra_nix_config: sandbox = true
256258
github_access_token: ${{ secrets.GITHUB_TOKEN }}
257259

258-
- uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16
260+
- uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16
259261
with:
260262
name: nodejs
261263
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
262264

263265
- name: Benchmark results
264266
run: |
265267
nix-shell \
268+
-I nixpkgs=./nixpkgs.nix \
266269
--pure \
267270
--arg loadJSBuiltinsDynamically false \
268271
--arg ccache 'null' \

.github/workflows/tools.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ jobs:
308308
python-version: ${{ env.PYTHON_VERSION }}
309309
- name: Set up Nix
310310
if: matrix.id == 'nixpkgs-unstable' && (github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id)
311-
uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
311+
uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
312312
- run: ${{ matrix.run }}
313313
if: github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id
314314
env:

BUILDING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ make build-ci -j12
273273
The use of `make build-ci` is to ensure you are using the `CONFIG_FLAGS`
274274
environment variable. You can also specify it manually:
275275

276-
```sh
276+
```bash
277277
./configure $CONFIG_FLAGS
278278
make -j12
279279
```

nixpkgs.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ let
77
sha256 = "1airrw6l87iyny1a3mb29l28na4s4llifprlgpll2na461jd40iy";
88
}) arg;
99
in
10-
nixpkgs
10+
nixpkgs

shell.nix

Lines changed: 57 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
pkgs ? import "${./nixpkgs.nix}" {},
2+
pkgs ? import "${./nixpkgs.nix}" { },
33
loadJSBuiltinsDynamically ? true, # Load `lib/**.js` from disk instead of embedding
44
ncu-path ? null, # Provide this if you want to use a local version of NCU
55
icu ? pkgs.icu,
@@ -19,7 +19,7 @@
1919
uvwasi
2020
zlib
2121
zstd
22-
;
22+
;
2323
http-parser = pkgs.llhttp;
2424
},
2525
ccache ? pkgs.ccache,
@@ -30,13 +30,17 @@
3030
pkgs.git
3131
pkgs.jq
3232
pkgs.shellcheck
33-
] ++ (if (ncu-path == null) then [
34-
pkgs.node-core-utils
35-
] else [
36-
(pkgs.writeShellScriptBin "git-node" "exec \"${ncu-path}/bin/git-node.js\" \"$@\"")
37-
(pkgs.writeShellScriptBin "ncu-ci" "exec \"${ncu-path}/bin/ncu-ci.js\" \"$@\"")
38-
(pkgs.writeShellScriptBin "ncu-config" "exec \"${ncu-path}/bin/ncu-config.js\" \"$@\"")
39-
]),
33+
]
34+
++ (
35+
if (ncu-path == null) then
36+
[ pkgs.node-core-utils ]
37+
else
38+
[
39+
(pkgs.writeShellScriptBin "git-node" "exec \"${ncu-path}/bin/git-node.js\" \"$@\"")
40+
(pkgs.writeShellScriptBin "ncu-ci" "exec \"${ncu-path}/bin/ncu-ci.js\" \"$@\"")
41+
(pkgs.writeShellScriptBin "ncu-config" "exec \"${ncu-path}/bin/ncu-config.js\" \"$@\"")
42+
]
43+
),
4044
benchmarkTools ? [
4145
pkgs.R
4246
pkgs.rPackages.ggplot2
@@ -61,38 +65,56 @@ pkgs.mkShell {
6165

6266
packages = [
6367
ccache
64-
] ++ devTools ++ benchmarkTools;
68+
]
69+
++ devTools
70+
++ benchmarkTools;
6571

66-
shellHook = if (ccache != null) then ''
67-
export CC="${pkgs.lib.getExe ccache} $CC"
68-
export CXX="${pkgs.lib.getExe ccache} $CXX"
69-
'' else "";
72+
shellHook =
73+
if (ccache != null) then
74+
''
75+
export CC="${pkgs.lib.getExe ccache} $CC"
76+
export CXX="${pkgs.lib.getExe ccache} $CXX"
77+
''
78+
else
79+
"";
7080

7181
BUILD_WITH = if (ninja != null) then "ninja" else "make";
7282
NINJA = if (ninja != null) then "${pkgs.lib.getExe ninja}" else "";
73-
CI_SKIP_TESTS = pkgs.lib.concatStringsSep "," ([
74-
] ++ pkgs.lib.optionals useSharedAda [
83+
CI_SKIP_TESTS = pkgs.lib.concatStringsSep "," (
84+
[ ]
85+
++ pkgs.lib.optionals useSharedAda [
7586
# Different versions of Ada affect the WPT tests
7687
"test-url"
77-
] ++ pkgs.lib.optionals useSharedOpenSSL [
88+
]
89+
++ pkgs.lib.optionals useSharedOpenSSL [
7890
# Path to the openssl.cnf is different from the expected one
7991
"test-strace-openat-openssl"
80-
]);
81-
CONFIG_FLAGS = builtins.toString ([
82-
(if icu == null
83-
then "--without-intl"
84-
else "--with-intl=${if useSharedICU then "system" else icu}-icu")
85-
] ++ extraConfigFlags ++ pkgs.lib.optionals (ninja != null) [
86-
"--ninja"
87-
] ++ pkgs.lib.optionals loadJSBuiltinsDynamically [
88-
"--node-builtin-modules-path=${builtins.toString ./.}"
89-
] ++ pkgs.lib.concatMap (name: [
90-
"--shared-${builtins.replaceStrings [ "c-ares" ] [ "cares" ] name}"
91-
"--shared-${builtins.replaceStrings [ "c-ares" ] [ "cares" ] name}-libpath=${
92-
pkgs.lib.getLib sharedLibDeps.${name}
93-
}/lib"
94-
"--shared-${builtins.replaceStrings [ "c-ares" ] [ "cares" ] name}-include=${
95-
pkgs.lib.getInclude sharedLibDeps.${name}
96-
}/include"
97-
]) (builtins.attrNames sharedLibDeps));
92+
]
93+
);
94+
CONFIG_FLAGS = builtins.toString (
95+
[
96+
(
97+
if icu == null then
98+
"--without-intl"
99+
else
100+
"--with-intl=${if useSharedICU then "system" else icu}-icu"
101+
)
102+
]
103+
++ extraConfigFlags
104+
++ pkgs.lib.optionals (ninja != null) [
105+
"--ninja"
106+
]
107+
++ pkgs.lib.optionals loadJSBuiltinsDynamically [
108+
"--node-builtin-modules-path=${builtins.toString ./.}"
109+
]
110+
++ pkgs.lib.concatMap (name: [
111+
"--shared-${builtins.replaceStrings [ "c-ares" ] [ "cares" ] name}"
112+
"--shared-${builtins.replaceStrings [ "c-ares" ] [ "cares" ] name}-libpath=${
113+
pkgs.lib.getLib sharedLibDeps.${name}
114+
}/lib"
115+
"--shared-${builtins.replaceStrings [ "c-ares" ] [ "cares" ] name}-include=${
116+
pkgs.lib.getInclude sharedLibDeps.${name}
117+
}/include"
118+
]) (builtins.attrNames sharedLibDeps)
119+
);
98120
}

0 commit comments

Comments
 (0)