Skip to content

Commit c5634f4

Browse files
committed
tools: run CI with shared libs on GHA
1 parent f7c2a7e commit c5634f4

File tree

2 files changed

+155
-0
lines changed

2 files changed

+155
-0
lines changed

.github/workflows/test-shared.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Test Shared librairies
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- .mailmap
7+
- README.md
8+
- .github/**
9+
- '!.github/workflows/test-shared.yml'
10+
types: [opened, synchronize, reopened, ready_for_review]
11+
push:
12+
branches:
13+
- main
14+
- canary
15+
- v[0-9]+.x-staging
16+
- v[0-9]+.x
17+
paths-ignore:
18+
- .mailmap
19+
- README.md
20+
- .github/**
21+
- '!.github/workflows/test-shared.yml'
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
25+
cancel-in-progress: true
26+
27+
env:
28+
PYTHON_VERSION: '3.12'
29+
FLAKY_TESTS: keep_retrying
30+
CLANG_VERSION: '19'
31+
CC: sccache clang-19
32+
CXX: sccache clang++-19
33+
SCCACHE_GHA_ENABLED: 'true'
34+
NIXPKGS_PIN: 6a489c9482ca676ce23c0bcd7f2e1795383325fa
35+
36+
permissions:
37+
contents: read
38+
39+
jobs:
40+
build:
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
include:
45+
- runner: ubuntu-24.04
46+
system: x86_64-linux
47+
- runner: ubuntu-24.04-arm
48+
system: aarch64-linux
49+
- runner: macos-13
50+
system: x86_64-darwin
51+
- runner: macos-14
52+
system: aarch64-darwin
53+
name: '${{ matrix.system }}: shared libraries'
54+
runs-on: ${{ matrix.runner }}
55+
steps:
56+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
57+
58+
- uses: cachix/install-nix-action@f0fe604f8a612776892427721526b4c7cfb23aba # v31
59+
with:
60+
extra_nix_config: sandbox = true
61+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
62+
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/${{ env.NIXPKGS_PIN }}.tar.gz
63+
64+
- name: Build Node.js
65+
run: |
66+
nix-shell --arg loadJSBuiltinsDynamically false --arg benchmarkTools '[]' --run '
67+
make build-ci -j4 V=1 CONFIG_FLAGS="--error-on-warn"
68+
make run-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9"
69+
'

shell.nix

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
pkgs ? import <nixpkgs> {},
3+
loadJSBuiltinsDynamically ? true, # Load `lib/**.js` from disk instead of embedding
4+
ncu-path ? null, # Provide this if you want to use a local version of NCU
5+
shared-icu ? pkgs.icu,
6+
sharedLibDeps ? {
7+
inherit (pkgs)
8+
ada
9+
brotli
10+
c-ares
11+
libuv
12+
nghttp2
13+
nghttp3
14+
ngtcp2
15+
openssl
16+
simdjson
17+
simdutf
18+
sqlite
19+
uvwasi
20+
zlib
21+
zstd
22+
;
23+
http-parser = pkgs.llhttp;
24+
},
25+
benchmarkTools ? [
26+
pkgs.R
27+
pkgs.rPackages.ggplot2
28+
pkgs.rPackages.plyr
29+
],
30+
extraConfigFlags ? [
31+
"--without-npm"
32+
"--debug-node"
33+
],
34+
}:
35+
36+
let
37+
useSharedICU = if builtins.isString shared-icu then shared-icu == "system" else shared-icu != null;
38+
useSharedAda = builtins.hasAttr "ada" sharedLibDeps;
39+
in
40+
pkgs.mkShell {
41+
inherit (pkgs.nodejs_latest) nativeBuildInputs;
42+
43+
TEST = if useSharedICU then "true" else "false";
44+
buildInputs = builtins.attrValues sharedLibDeps ++ pkgs.lib.optionals useSharedICU [ shared-icu ];
45+
46+
packages = [
47+
pkgs.ccache
48+
pkgs.curl
49+
pkgs.gh
50+
pkgs.git
51+
pkgs.jq
52+
] ++ benchmarkTools ++ pkgs.lib.optionals (ncu-path != null) [
53+
(pkgs.writeShellScriptBin "git-node" "exec \"${ncu-path}/bin/git-node.js\" \"$@\"")
54+
(pkgs.writeShellScriptBin "ncu-ci" "exec \"${ncu-path}/bin/ncu-ci.js\" \"$@\"")
55+
(pkgs.writeShellScriptBin "ncu-config" "exec \"${ncu-path}/bin/ncu-config.js\" \"$@\"")
56+
] ++ pkgs.lib.optionals (ncu-path == null) [
57+
pkgs.node-core-utils
58+
];
59+
60+
CC = "ccache cc";
61+
CXX = "ccache c++";
62+
CI_SKIP_TESTS="${
63+
pkgs.lib.concatStringsSep "," ([
64+
] ++ pkgs.lib.optionals useSharedAda [
65+
# Different versions of Ada affect the WPT tests
66+
"test-url"
67+
])
68+
}";
69+
DIFF_CMD = "code --wait --diff";
70+
CONFIG_FLAGS = builtins.toString ([
71+
"--ninja"
72+
(if shared-icu == null
73+
then "--without-intl"
74+
else "--with-intl=${if useSharedICU then "system" else shared-icu}-icu")
75+
] ++ extraConfigFlags ++ pkgs.lib.optionals loadJSBuiltinsDynamically [
76+
"--node-builtin-modules-path=${builtins.toString ./.}"
77+
] ++ pkgs.lib.concatMap (name: [
78+
"--shared-${builtins.replaceStrings [ "c-ares" ] [ "cares" ] name}"
79+
"--shared-${builtins.replaceStrings [ "c-ares" ] [ "cares" ] name}-libpath=${
80+
pkgs.lib.getLib sharedLibDeps.${name}
81+
}/lib"
82+
"--shared-${builtins.replaceStrings [ "c-ares" ] [ "cares" ] name}-include=${
83+
pkgs.lib.getInclude sharedLibDeps.${name}
84+
}/include"
85+
]) (builtins.attrNames sharedLibDeps));
86+
}

0 commit comments

Comments
 (0)