Skip to content

Commit bc0d16a

Browse files
committed
tools: add an option to generate lighter archives
1 parent 98081b6 commit bc0d16a

File tree

2 files changed

+81
-15
lines changed

2 files changed

+81
-15
lines changed

.github/workflows/test-shared.yml

Lines changed: 61 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,77 @@ permissions:
5757
contents: read
5858

5959
jobs:
60+
build-tarball:
61+
if: false #github.event.pull_request.draft == false
62+
runs-on: ubuntu-24.04-arm
63+
steps:
64+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
65+
if: ${{ github.event_name != 'workflow_dispatch' }}
66+
with:
67+
persist-credentials: false
68+
69+
- name: Make tarball
70+
if: ${{ github.event_name != 'workflow_dispatch' }}
71+
run: |
72+
export DATESTRING=$(date "+%Y-%m-%d")
73+
export COMMIT=$(git rev-parse --short=10 "$GITHUB_SHA")
74+
./configure && make tar -j4 SKIP_XZ=1 SKIP_SHARED_DEPS=1
75+
env:
76+
DISTTYPE: nightly
77+
78+
79+
- name: Upload tarball artifact
80+
if: ${{ github.event_name != 'workflow_dispatch' }}
81+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
82+
with:
83+
name: tarballs
84+
path: '*.tar.gz'
85+
compression-level: 0
86+
6087
build:
88+
# needs: build-tarball
89+
permissions:
90+
actions: read
6191
strategy:
6292
fail-fast: false
6393
matrix:
6494
include:
6595
- runner: ubuntu-24.04
6696
system: x86_64-linux
67-
- runner: ubuntu-24.04-arm
68-
system: aarch64-linux
69-
- runner: macos-13
70-
system: x86_64-darwin
71-
- runner: macos-latest
72-
system: aarch64-darwin
97+
# - runner: ubuntu-24.04-arm
98+
# system: aarch64-linux
99+
# - runner: macos-13
100+
# system: x86_64-darwin
101+
# - runner: macos-latest
102+
# system: aarch64-darwin
73103
name: '${{ matrix.system }}: with shared libraries'
74104
runs-on: ${{ matrix.runner }}
75105
steps:
76-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
106+
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
77107
if: ${{ github.event_name != 'workflow_dispatch' }}
78108
with:
79-
persist-credentials: false
109+
name: tarballs
110+
path: tarballs
111+
github-token: ${{ github.token }} # token with actions:read permissions on target repo
112+
repository: aduh95/node
113+
run-id: 17547305713
114+
115+
- name: Extract tarball
116+
if: ${{ github.event_name != 'workflow_dispatch' }}
117+
run: |
118+
tar xzf tarballs/*.tar.gz -C "$RUNNER_TEMP"
119+
echo "TAR_DIR=$RUNNER_TEMP/$(basename tarballs/*.tar.gz .tar.gz)" >> "$GITHUB_ENV"
120+
121+
- run: tree "$TAR_DIR/deps/npm"
122+
123+
- name: Patch npm gyp (to be able to build addons for the tests)
124+
if: ${{ github.event_name != 'workflow_dispatch' }}
125+
run: |
126+
cd "$TAR_DIR"
127+
curl -L https://github.com/npm/cli/pull/8531.diff \
128+
| git apply --directory=deps/npm \
129+
--exclude=deps/npm/package-lock.json
130+
--exclude=deps/npm/node_modules/node-gyp/.release-please-manifest.json
80131
81132
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
82133
if: ${{ github.event_name == 'workflow_dispatch' }}
@@ -113,26 +164,21 @@ jobs:
113164
core.exportVariable('ACTIONS_CACHE_SERVICE_V2', 'on');
114165
core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || '');
115166
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
116-
117-
- name: Patch npm gyp (to be able to build addons for the tests)
118-
if: ${{ github.event_name != 'workflow_dispatch' }}
119-
run: curl -L https://github.com/npm/cli/pull/8531.diff | git apply --directory=deps/npm --exclude=deps/npm/package-lock.json
120167
121168
- name: Load shell.nix
122-
if: ${{ github.event_name == 'workflow_dispatch' }}
123169
run: curl -fsLSO https://github.com/${GITHUB_REPOSITORY}/raw/${GITHUB_SHA}/shell.nix
124170

125171
- name: Build Node.js ${{ github.event_name == 'workflow_dispatch' && 'on the base commit' || 'and run tests' }}
126172
run: |
127173
nix-shell \
128-
--pure --keep FLAKY_TESTS \
174+
--pure --keep TAR_DIR --keep FLAKY_TESTS \
129175
--keep SCCACHE_GHA_VERSION --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \
130176
--arg loadJSBuiltinsDynamically false \
131177
--arg ccache '(import <nixpkgs> {}).sccache' \
132178
--arg devTools '[]' \
133179
--arg benchmarkTools '[]' \
134180
--run '
135-
make ${{ github.event_name == 'workflow_dispatch' && 'build' || 'run' }}-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS"
181+
make ${{ github.event_name == 'workflow_dispatch' && 'build' || '-C "$TAR_DIR" run' }}-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS"
136182
'
137183
138184
- name: Re-build Node.js on the merge commit

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,8 @@ BINARYTAR=$(BINARYNAME).tar
10441044
HAS_XZ ?= $(shell command -v xz > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0)
10451045
# Supply SKIP_XZ=1 to explicitly skip .tar.xz creation
10461046
SKIP_XZ ?= 0
1047+
# Supply SKIP_XZ=1 to explicitly skip all dependencies that can be included as shared deps
1048+
SKIP_SHARED_DEPS ?= 0
10471049
XZ = $(shell [ $(HAS_XZ) -eq 1 ] && [ $(SKIP_XZ) -eq 0 ] && echo 1 || echo 0)
10481050
XZ_COMPRESSION ?= 9e
10491051
PKG=$(TARNAME).pkg
@@ -1213,12 +1215,30 @@ $(TARBALL): release-only doc-only
12131215
$(RM) -r $(TARNAME)/.editorconfig
12141216
$(RM) -r $(TARNAME)/.git*
12151217
$(RM) -r $(TARNAME)/.mailmap
1218+
ifeq ($(SKIP_SHARED_DEPS), 1)
1219+
$(RM) -r $(TARNAME)/deps/ada
1220+
$(RM) -r $(TARNAME)/deps/brotli
1221+
$(RM) -r $(TARNAME)/deps/cares
1222+
$(RM) -r $(TARNAME)/deps/icu-small
1223+
$(RM) -r $(TARNAME)/deps/icu-tmp
1224+
$(RM) -r $(TARNAME)/deps/llhttp
1225+
$(RM) -r $(TARNAME)/deps/nghttp2
1226+
$(RM) -r $(TARNAME)/deps/ngtcp2
1227+
$(RM) -r $(TARNAME)/deps/openssl
1228+
$(RM) -r $(TARNAME)/deps/simdjson
1229+
$(RM) -r $(TARNAME)/deps/sqlite
1230+
$(RM) -r $(TARNAME)/deps/uv
1231+
$(RM) -r $(TARNAME)/deps/uvwasi
1232+
$(RM) -r $(TARNAME)/deps/zlib
1233+
$(RM) -r $(TARNAME)/deps/zstd
1234+
else
12161235
$(RM) -r $(TARNAME)/deps/openssl/openssl/demos
12171236
$(RM) -r $(TARNAME)/deps/openssl/openssl/doc
12181237
$(RM) -r $(TARNAME)/deps/openssl/openssl/test
12191238
$(RM) -r $(TARNAME)/deps/uv/docs
12201239
$(RM) -r $(TARNAME)/deps/uv/samples
12211240
$(RM) -r $(TARNAME)/deps/uv/test
1241+
endif
12221242
$(RM) -r $(TARNAME)/deps/v8/samples
12231243
$(RM) -r $(TARNAME)/deps/v8/tools/profviz
12241244
$(RM) -r $(TARNAME)/deps/v8/tools/run-tests.py

0 commit comments

Comments
 (0)