Skip to content

Commit 9a1e183

Browse files
committed
docs(en): merging all conflicts
2 parents cc83271 + 9135249 commit 9a1e183

File tree

231 files changed

+6910
-2270
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+6910
-2270
lines changed

.github/workflows/build-and-tests.yml

+114-24
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,13 @@ jobs:
104104
target: x86_64-apple-darwin
105105
build: >-
106106
set -e &&
107-
npm run build:napi -- --release &&
108-
strip -x *.node
107+
npm run build:napi -- --release --target x86_64-apple-darwin
109108
- host: macos-latest
110109
target: aarch64-apple-darwin
111110
build: >-
112111
set -e &&
113112
rustup target add aarch64-apple-darwin &&
114-
npm run build:napi -- --release --target aarch64-apple-darwin &&
115-
strip -x *.node
113+
npm run build:napi -- --release --target aarch64-apple-darwin
116114
117115
# Linux
118116
- host: ubuntu-latest
@@ -121,14 +119,13 @@ jobs:
121119
build: >-
122120
set -e &&
123121
rustup target add x86_64-unknown-linux-gnu &&
124-
npm run build:napi -- --release --target x86_64-unknown-linux-gnu &&
125-
strip *.node
122+
npm run build:napi -- --release --target x86_64-unknown-linux-gnu
126123
- host: ubuntu-latest
127124
target: x86_64-unknown-linux-musl
128125
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
129126
build: >-
130127
set -e &&
131-
npm run build:napi -- --release && strip *.node
128+
npm run build:napi -- --release
132129
- host: ubuntu-latest
133130
target: armv7-unknown-linux-gnueabihf
134131
zig: true
@@ -137,8 +134,13 @@ jobs:
137134
sudo apt-get install gcc-arm-linux-gnueabihf -y
138135
build: >-
139136
set -e &&
140-
npm run build:napi -- --release --target armv7-unknown-linux-gnueabihf &&
141-
arm-linux-gnueabihf-strip *.node
137+
npm run build:napi -- --release --target armv7-unknown-linux-gnueabihf
138+
- host: ubuntu-latest
139+
target: armv7-unknown-linux-musleabihf
140+
zig: true
141+
build: >-
142+
set -e &&
143+
npm run build:napi -- --release --target armv7-unknown-linux-musleabihf
142144
- host: ubuntu-latest
143145
target: aarch64-unknown-linux-gnu
144146
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
@@ -147,8 +149,7 @@ jobs:
147149
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
148150
rustup default nightly-2023-10-05 &&
149151
rustup target add aarch64-unknown-linux-gnu &&
150-
npm run build:napi -- --release --target aarch64-unknown-linux-gnu &&
151-
aarch64-unknown-linux-gnu-strip *.node
152+
npm run build:napi -- --release --target aarch64-unknown-linux-gnu
152153
- host: ubuntu-latest
153154
target: aarch64-unknown-linux-musl
154155
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
@@ -157,20 +158,17 @@ jobs:
157158
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
158159
rustup default nightly-2023-10-05 &&
159160
rustup target add aarch64-unknown-linux-musl &&
160-
RUSTFLAGS='-C target-feature=-crt-static -C linker=aarch64-linux-musl-gcc' npm run build:napi -- --release --target aarch64-unknown-linux-musl &&
161-
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
161+
RUSTFLAGS='-C target-feature=-crt-static -C linker=aarch64-linux-musl-gcc' npm run build:napi -- --release --target aarch64-unknown-linux-musl
162162
- host: ubuntu-latest
163163
target: armv7-linux-androideabi
164164
build: >-
165165
set -e &&
166-
npm run build:napi -- --release --target armv7-linux-androideabi &&
167-
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
166+
npm run build:napi -- --release --target armv7-linux-androideabi
168167
- host: ubuntu-latest
169168
target: aarch64-linux-android
170169
build: >-
171170
set -e &&
172-
npm run build:napi -- --release --target aarch64-linux-android &&
173-
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
171+
npm run build:napi -- --release --target aarch64-linux-android
174172
- host: ubuntu-latest
175173
target: riscv64gc-unknown-linux-gnu
176174
setup: |
@@ -179,8 +177,7 @@ jobs:
179177
build: >-
180178
set -e &&
181179
rustup target add riscv64gc-unknown-linux-gnu &&
182-
npm run build:napi -- --release --target riscv64gc-unknown-linux-gnu &&
183-
riscv64-linux-gnu-strip *.node
180+
npm run build:napi -- --release --target riscv64gc-unknown-linux-gnu
184181
- host: ubuntu-latest
185182
target: powerpc64le-unknown-linux-gnu
186183
setup: |
@@ -189,8 +186,7 @@ jobs:
189186
build: >-
190187
set -e &&
191188
export CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc && rustup target add powerpc64le-unknown-linux-gnu &&
192-
npm run build:napi -- --release --target powerpc64le-unknown-linux-gnu &&
193-
powerpc64le-linux-gnu-strip *.node
189+
npm run build:napi -- --release --target powerpc64le-unknown-linux-gnu
194190
- host: ubuntu-latest
195191
target: s390x-unknown-linux-gnu
196192
setup: |
@@ -200,8 +196,7 @@ jobs:
200196
set -e &&
201197
export CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc &&
202198
rustup target add s390x-unknown-linux-gnu &&
203-
npm run build:napi -- --release --target s390x-unknown-linux-gnu &&
204-
s390x-linux-gnu-strip *.node
199+
npm run build:napi -- --release --target s390x-unknown-linux-gnu
205200
name: Build ${{ matrix.settings.name || matrix.settings.target }}
206201
runs-on: ${{ matrix.settings.host }}
207202
timeout-minutes: 30
@@ -273,6 +268,100 @@ jobs:
273268
if-no-files-found: error
274269
if: ${{ !matrix.settings.is-wasm-build }}
275270

271+
# smoke test for some architectures that do not receive the full test suite
272+
smoke-test:
273+
permissions:
274+
packages: write # for caching container images
275+
name: Smoke Test ${{ matrix.settings.target }}
276+
needs:
277+
- build
278+
strategy:
279+
fail-fast: false
280+
matrix:
281+
settings:
282+
- arch: aarch64
283+
distro: ubuntu_latest
284+
target: aarch64-unknown-linux-gnu
285+
- arch: aarch64
286+
distro: alpine_latest
287+
target: aarch64-unknown-linux-musl
288+
- arch: armv7
289+
distro: ubuntu_latest
290+
target: armv7-unknown-linux-gnueabihf
291+
# There is a bug that hangs the build when running npm
292+
# - arch: armv7
293+
# distro: alpine_latest
294+
# target: armv7-unknown-linux-musleabihf
295+
- arch: ppc64le
296+
distro: ubuntu_latest
297+
target: powerpc64le-unknown-linux-gnu
298+
use-nvm: true
299+
- arch: s390x
300+
distro: ubuntu_latest
301+
target: s390x-unknown-linux-gnu
302+
use-nvm: true
303+
# I could not find a way to install Node without compiling from source
304+
# - arch: riscv64
305+
# distro: ubuntu_latest
306+
# target: riscv64gc-unknown-linux-gnu
307+
runs-on: ubuntu-latest
308+
timeout-minutes: 120
309+
steps:
310+
- name: Checkout Commit
311+
uses: actions/checkout@v4
312+
- name: Cache Node Modules
313+
id: cache-node-modules
314+
uses: actions/cache@v4
315+
with:
316+
path: node_modules
317+
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
318+
- name: Install dependencies
319+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
320+
run: npm ci --ignore-scripts
321+
- name: Build JS
322+
run: npm run build:cjs
323+
- name: Download napi artifacts
324+
uses: actions/download-artifact@v4
325+
with:
326+
name: bindings-${{ matrix.settings.target }}
327+
path: dist/
328+
- name: Run Smoke Test
329+
uses: uraimo/run-on-arch-action@v2
330+
with:
331+
arch: ${{ matrix.settings.arch }}
332+
distro: ${{ matrix.settings.distro }}
333+
githubToken: ${{ github.token }}
334+
install: |
335+
case "${{ matrix.settings.distro }}" in
336+
ubuntu*)
337+
apt-get update -y
338+
apt-get install -y curl git
339+
if [[ -z "${{ matrix.settings.use-nvm }}" ]]; then
340+
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
341+
apt-get install -y nodejs
342+
fi
343+
;;
344+
alpine*)
345+
apk add nodejs npm git
346+
;;
347+
esac
348+
run: |
349+
set -e
350+
if [[ -n "${{ matrix.settings.use-nvm }}" ]]; then
351+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
352+
source ~/.nvm/nvm.sh
353+
nvm install --lts
354+
fi
355+
echo "Node: $(node -v)"
356+
echo "npm: $(npm -v)"
357+
git config --global --add safe.directory /home/runner/work/rollup/rollup
358+
chmod +x dist/bin/rollup
359+
dist/bin/rollup --version | grep -E 'rollup v[0-9]+\.[0-9]+\.[0-9]+'
360+
mv dist dist-build
361+
node dist-build/bin/rollup --config rollup.config.ts --configPlugin typescript --configTest --forceExit
362+
cp dist-build/rollup.*.node dist/
363+
dist/bin/rollup --version | grep -E 'rollup v[0-9]+\.[0-9]+\.[0-9]+'
364+
276365
test:
277366
name: Test${{ matrix.additionalName || '' }} Node ${{ matrix.node }} (${{ matrix.settings.target }})
278367
needs:
@@ -352,8 +441,9 @@ jobs:
352441
runs-on: ubuntu-latest
353442
timeout-minutes: 15
354443
needs:
355-
- test
356444
- lint
445+
- test
446+
- smoke-test
357447
# This needs to be adapted for Rollup 5
358448
if: startsWith(github.ref_name, 'v4')
359449
steps:
+151
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
name: Performance Report
2+
env:
3+
BUILD_BOOTSTRAP_CJS: mv dist dist-build && node dist-build/bin/rollup --config rollup.config.ts --configPlugin typescript --configTest --forceExit && rm -rf dist-build
4+
5+
on:
6+
pull_request:
7+
types:
8+
- synchronize
9+
- opened
10+
- reopened
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
build-artefacts:
21+
strategy:
22+
matrix:
23+
settings:
24+
- name: current
25+
ref: refs/pull/${{ github.event.number }}/merge
26+
- name: previous
27+
ref: ${{github.event.pull_request.base.ref}}
28+
name: Build ${{matrix.settings.name}} artefact
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout Commit
32+
uses: actions/checkout@v4
33+
with:
34+
ref: ${{matrix.settings.ref}}
35+
- name: Install Toolchain
36+
uses: dtolnay/rust-toolchain@stable
37+
with:
38+
toolchain: nightly-2023-10-05
39+
targets: x86_64-unknown-linux-gnu
40+
- name: Cache cargo
41+
uses: actions/cache@v4
42+
with:
43+
path: |
44+
~/.cargo/registry/index/
45+
~/.cargo/registry/cache/
46+
~/.cargo/git/db/
47+
.cargo-cache
48+
rust/target/
49+
key: cargo-cache-${{ hashFiles('rust/Cargo.lock') }}
50+
restore-keys: cargo-cache
51+
- name: Setup Node
52+
uses: actions/setup-node@v4
53+
with:
54+
node-version: 18
55+
- name: Cache Node Modules
56+
id: cache-node-modules
57+
uses: actions/cache@v4
58+
with:
59+
path: node_modules
60+
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
61+
- name: Install dependencies
62+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
63+
run: npm ci --ignore-scripts
64+
- name: Build artefacts 123
65+
run: npm exec -- concurrently -c green,blue 'npm:build:napi -- --release' 'npm:build:cjs' && npm run build:copy-native && ${{env.BUILD_BOOTSTRAP_CJS}} && npm run build:copy-native
66+
- name: Upload artifact
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: ${{ matrix.settings.name }}
70+
path: dist/
71+
if-no-files-found: error
72+
73+
report:
74+
needs: build-artefacts
75+
permissions:
76+
pull-requests: write
77+
runs-on: ubuntu-latest
78+
name: Report Performance
79+
steps:
80+
- name: Checkout Commit
81+
uses: actions/checkout@v4
82+
with:
83+
ref: refs/pull/${{ github.event.number }}/merge
84+
- name: Install Toolchain
85+
uses: dtolnay/rust-toolchain@stable
86+
with:
87+
toolchain: nightly-2023-10-05
88+
targets: x86_64-unknown-linux-gnu
89+
- name: Cache cargo
90+
uses: actions/cache@v4
91+
with:
92+
path: |
93+
~/.cargo/registry/index/
94+
~/.cargo/registry/cache/
95+
~/.cargo/git/db/
96+
.cargo-cache
97+
rust/target/
98+
key: cargo-cache-${{ hashFiles('rust/Cargo.lock') }}
99+
restore-keys: cargo-cache
100+
- name: Setup Node
101+
uses: actions/setup-node@v4
102+
with:
103+
node-version: 18
104+
- name: Cache Node Modules
105+
id: cache-node-modules
106+
uses: actions/cache@v4
107+
with:
108+
path: node_modules
109+
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
110+
- name: Install dependencies
111+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
112+
run: npm ci --ignore-scripts
113+
- name: Download all artifacts
114+
uses: actions/download-artifact@v4
115+
with:
116+
path: _benchmark
117+
- name: Change rollup import in internal benchmark
118+
run: |
119+
echo "export { rollup as previousRollup, VERSION as previousVersion } from '../../_benchmark/previous/rollup.js';" > ./scripts/perf-report/rollup-artefacts.js
120+
echo "export { rollup as newRollup } from '../../_benchmark/current/rollup.js';" >> ./scripts/perf-report/rollup-artefacts.js
121+
- name: Run internal benchmark
122+
run: node --expose-gc scripts/perf-report/index.js
123+
- name: Install benchmark tool
124+
run: cargo install --locked hyperfine
125+
- name: Run Rough benchmark
126+
run: |
127+
hyperfine --warmup 1 --export-markdown _benchmark/rough-report.md --show-output --runs 3 \
128+
'node _benchmark/previous/bin/rollup -i ./perf/entry.js -o _benchmark/result/previous.js' \
129+
'node _benchmark/current/bin/rollup -i ./perf/entry.js -o _benchmark/result/current.js'
130+
- name: Combine bechmark reports
131+
run: |
132+
echo "# Performance report!" > _benchmark/result.md
133+
echo "## Rough benchmark" >> _benchmark/result.md
134+
cat _benchmark/rough-report.md >> _benchmark/result.md
135+
echo "## Internal benchmark" >> _benchmark/result.md
136+
cat _benchmark/internal-report.md >> _benchmark/result.md
137+
- name: Find Performance report
138+
uses: peter-evans/find-comment@v3
139+
id: findPerformanceReport
140+
with:
141+
issue-number: ${{ github.event.number }}
142+
comment-author: 'github-actions[bot]'
143+
body-includes: 'Performance report'
144+
- name: Create or update Performance report
145+
uses: peter-evans/create-or-update-comment@v4
146+
id: createOrUpdatePerformanceReport
147+
with:
148+
comment-id: ${{ steps.findPerformanceReport.outputs.comment-id }}
149+
issue-number: ${{ github.event.number }}
150+
edit-mode: replace
151+
body-path: _benchmark/result.md

0 commit comments

Comments
 (0)