Skip to content

Commit f50e3ff

Browse files
authored
Merge branch 'nodejs:main' into main
2 parents 457cb4c + 6176222 commit f50e3ff

File tree

23 files changed

+23377
-2144
lines changed

23 files changed

+23377
-2144
lines changed

.github/workflows/test-shared.yml

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,35 @@ permissions:
3535
contents: read
3636

3737
jobs:
38-
build:
38+
build-tarball:
3939
if: github.event.pull_request.draft == false
40+
name: ${{ github.event_name == 'workflow_dispatch' && 'Skipped job' || 'Build slim tarball' }}
41+
runs-on: ubuntu-24.04-arm
42+
steps:
43+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
44+
if: ${{ github.event_name != 'workflow_dispatch' }}
45+
with:
46+
persist-credentials: false
47+
48+
- name: Make tarball
49+
if: ${{ github.event_name != 'workflow_dispatch' }}
50+
run: |
51+
export DATESTRING=$(date "+%Y-%m-%d")
52+
export COMMIT=$(git rev-parse --short=10 "$GITHUB_SHA")
53+
./configure && make tar -j4 SKIP_XZ=1 SKIP_SHARED_DEPS=1
54+
env:
55+
DISTTYPE: nightly
56+
57+
- name: Upload tarball artifact
58+
if: ${{ github.event_name != 'workflow_dispatch' }}
59+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
60+
with:
61+
name: tarballs
62+
path: '*.tar.gz'
63+
compression-level: 0
64+
65+
build:
66+
needs: build-tarball
4067
strategy:
4168
fail-fast: false
4269
matrix:
@@ -52,9 +79,17 @@ jobs:
5279
name: '${{ matrix.system }}: with shared libraries'
5380
runs-on: ${{ matrix.runner }}
5481
steps:
55-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
82+
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
83+
if: ${{ github.event_name != 'workflow_dispatch' }}
5684
with:
57-
persist-credentials: false
85+
name: tarballs
86+
path: tarballs
87+
88+
- name: Extract tarball
89+
if: ${{ github.event_name != 'workflow_dispatch' }}
90+
run: |
91+
tar xzf tarballs/*.tar.gz -C "$RUNNER_TEMP"
92+
echo "TAR_DIR=$RUNNER_TEMP/$(basename tarballs/*.tar.gz .tar.gz)" >> "$GITHUB_ENV"
5893
5994
- uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
6095
with:
@@ -69,17 +104,24 @@ jobs:
69104
core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || '');
70105
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
71106
107+
- name: Load shell.nix
108+
if: github.event_name != 'workflow_dispatch'
109+
run: |
110+
mv "$TAR_DIR"/*.nix .
111+
mkdir tools
112+
mv "$TAR_DIR"/tools/nix tools/.
113+
72114
- name: Build Node.js and run tests
73115
run: |
74116
nix-shell \
75117
-I nixpkgs=./tools/nix/pkgs.nix \
76-
--pure --keep FLAKY_TESTS \
118+
--pure --keep TAR_DIR --keep FLAKY_TESTS \
77119
--keep SCCACHE_GHA_VERSION --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \
78120
--arg loadJSBuiltinsDynamically false \
79121
--arg ccache '(import <nixpkgs> {}).sccache' \
80122
--arg devTools '[]' \
81123
--arg benchmarkTools '[]' \
82124
${{ endsWith(matrix.system, '-darwin') && '--arg extraConfigFlags ''["--without-inspector"]'' \' || '\' }}
83125
--run '
84-
make run-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS"
126+
make -C "$TAR_DIR" run-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS"
85127
'

Makefile

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ ADDONS_HEADERS_PREREQS := tools/install.py \
399399
$(wildcard deps/uv/include/*/*.h) \
400400
$(wildcard deps/v8/include/*.h) \
401401
$(wildcard deps/v8/include/*/*.h) \
402-
deps/zlib/zconf.h deps/zlib/zlib.h \
402+
$(wildcard deps/zlib/z*.h) \
403403
src/node.h src/node_api.h src/js_native_api.h src/js_native_api_types.h \
404404
src/node_api_types.h src/node_buffer.h src/node_object_wrap.h \
405405
src/node_version.h
@@ -1032,6 +1032,11 @@ override DESTCPU=x86
10321032
endif
10331033

10341034
TARNAME=node-$(FULLVERSION)
1035+
# Supply SKIP_SHARED_DEPS=1 to explicitly skip all dependencies that can be included as shared deps
1036+
SKIP_SHARED_DEPS ?= 0
1037+
ifeq ($(SKIP_SHARED_DEPS), 1)
1038+
TARNAME:=$(TARNAME)-slim
1039+
endif
10351040
TARBALL=$(TARNAME).tar
10361041
# Custom user-specified variation, use it directly
10371042
ifdef VARIATION
@@ -1215,12 +1220,31 @@ $(TARBALL): release-only doc-only
12151220
$(RM) -r $(TARNAME)/.mailmap
12161221
$(RM) -r $(TARNAME)/deps/corepack
12171222
$(RM) $(TARNAME)/test/parallel/test-corepack-version.js
1223+
ifeq ($(SKIP_SHARED_DEPS), 1)
1224+
$(RM) -r $(TARNAME)/deps/ada
1225+
$(RM) -r $(TARNAME)/deps/brotli
1226+
$(RM) -r $(TARNAME)/deps/cares
1227+
$(RM) -r $(TARNAME)/deps/icu-small
1228+
$(RM) -r $(TARNAME)/deps/icu-tmp
1229+
$(RM) -r $(TARNAME)/deps/llhttp
1230+
$(RM) -r $(TARNAME)/deps/nghttp2
1231+
$(RM) -r $(TARNAME)/deps/ngtcp2
1232+
find $(TARNAME)/deps/openssl -maxdepth 1 -type f ! -name 'nodejs-openssl.cnf' -exec $(RM) {} +
1233+
find $(TARNAME)/deps/openssl -mindepth 1 -maxdepth 1 -type d -exec $(RM) -r {} +
1234+
$(RM) -r $(TARNAME)/deps/simdjson
1235+
$(RM) -r $(TARNAME)/deps/sqlite
1236+
$(RM) -r $(TARNAME)/deps/uv
1237+
$(RM) -r $(TARNAME)/deps/uvwasi
1238+
$(RM) -r $(TARNAME)/deps/zlib
1239+
$(RM) -r $(TARNAME)/deps/zstd
1240+
else
12181241
$(RM) -r $(TARNAME)/deps/openssl/openssl/demos
12191242
$(RM) -r $(TARNAME)/deps/openssl/openssl/doc
12201243
$(RM) -r $(TARNAME)/deps/openssl/openssl/test
12211244
$(RM) -r $(TARNAME)/deps/uv/docs
12221245
$(RM) -r $(TARNAME)/deps/uv/samples
12231246
$(RM) -r $(TARNAME)/deps/uv/test
1247+
endif
12241248
$(RM) -r $(TARNAME)/deps/v8/samples
12251249
$(RM) -r $(TARNAME)/deps/v8/tools/profviz
12261250
$(RM) -r $(TARNAME)/deps/v8/tools/run-tests.py

benchmark/cpu.sh

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,73 @@ CPUPATH=/sys/devices/system/cpu
44

55
MAXID=$(cat $CPUPATH/present | awk -F- '{print $NF}')
66

7+
[ "$(uname -s || true)" = "Linux" ] || \
8+
echo "Warning: This script supports Linux only." >&2
9+
10+
[ "$(id -u || true)" = "0" ] || \
11+
echo "Warning: This script typically needs root access to modify CPU governor. Consider running it with sudo." >&2
12+
13+
get_default_governor() {
14+
case "$(cat "$CPUPATH/cpu0/cpufreq/scaling_available_governors")" in
15+
*"schedutil"*) echo "schedutil" ;;
16+
*"ondemand"*) echo "ondemand" ;;
17+
*"conservative"*) echo "conservative";;
18+
*) echo "powersave" ;;
19+
esac
20+
21+
}
22+
723
set_governor() {
8-
echo "Setting CPU frequency governor to \"$1\""
24+
governor_name="$1"
25+
26+
echo "Setting governor for all CPU cores to \"$governor_name\"..."
27+
928
i=0
1029
while [ "$i" -le "$MAXID" ]; do
1130
echo "$1" > "$CPUPATH/cpu$i/cpufreq/scaling_governor"
1231
i=$((i + 1))
1332
done
33+
34+
echo "Done."
35+
}
36+
37+
usage() {
38+
default_gov=$(get_default_governor)
39+
echo "CPU Governor Management Script"
40+
echo "----------------------------------------------------------------------------"
41+
echo "Usage: $0 [command]"
42+
echo
43+
echo "Commands:"
44+
echo " fast Sets the governor to 'performance' for maximum speed."
45+
echo " (Warning: Increases heat/power use. Use for short-term tasks.)"
46+
echo
47+
echo " reset Resets the governor to the system's recommended default ('$default_gov')."
48+
echo
49+
echo " get Shows the current CPU governor for ALL cores."
50+
echo "----------------------------------------------------------------------------"
1451
}
1552

1653
case "$1" in
1754
fast | performance)
55+
echo "Warning: The 'performance' mode locks the CPU at its highest speed."
56+
echo "It is highly recommended to 'reset' after your task is complete."
1857
set_governor "performance"
1958
;;
59+
60+
reset | default)
61+
default_governor=$(get_default_governor)
62+
set_governor "$default_governor"
63+
;;
64+
65+
get | status)
66+
echo "Current governor status for all cores:"
67+
grep . "$CPUPATH"/cpu*/cpufreq/scaling_governor
68+
;;
69+
2070
*)
21-
echo "Usage: $0 fast"
71+
usage
2272
exit 1
2373
;;
2474
esac
75+
76+
exit 0

0 commit comments

Comments
 (0)