-
Notifications
You must be signed in to change notification settings - Fork 45
353 lines (337 loc) · 13.6 KB
/
Copy pathnode-test.yaml
File metadata and controls
353 lines (337 loc) · 13.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
name: "[impit-node] Test & Build"
env:
DEBUG: napi:*
APP_NAME: impit-node
MACOSX_DEPLOYMENT_TARGET: '10.13'
RUSTFLAGS: '--cfg reqwest_unstable'
permissions:
contents: write
id-token: write
'on':
push:
branches:
- master
tags-ignore:
- '**'
paths:
- 'impit-node/**'
pull_request:
paths:
- 'impit-node/**'
- 'impit/**'
- '.github/workflows/node-test.yaml'
workflow_call:
jobs:
build:
defaults:
run:
working-directory: impit-node
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
build: pnpm build --target x86_64-apple-darwin
- host: windows-latest
build: pnpm build --target x86_64-pc-windows-msvc
target: x86_64-pc-windows-msvc
- host: ubuntu-22.04
target: x86_64-unknown-linux-gnu
build: pnpm build --target x86_64-unknown-linux-gnu
- host: ubuntu-22.04-arm
target: aarch64-unknown-linux-musl
docker: arm64v8/node:20-alpine
build: |-
export PATH="/usr/local/cargo/bin/rustup:/root/.cargo/bin:$PATH" RUSTFLAGS="-C target-feature=-crt-static --cfg reqwest_unstable" CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=gcc CC=gcc CXX="g++" GN_EXE=gn
apk add --update --no-cache bash wget cmake musl-dev clang llvm build-base python3 gcc g++ perl
sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories
apk add --update --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing rustup git gn tar ninja
apk update
apk upgrade
rustup-init -y
corepack enable
cd impit-node && pnpm install --frozen-lockfile && pnpm build
- host: ubuntu-22.04-arm
target: aarch64-unknown-linux-gnu
build: pnpm build --target aarch64-unknown-linux-gnu
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: node:20-alpine
# Script taken from https://github.com/napi-rs/napi-rs/blob/main/alpine.Dockerfile
build: |
export PATH="/aarch64-linux-musl-cross/bin:/usr/local/cargo/bin/rustup:/root/.cargo/bin:$PATH" RUSTFLAGS="-C target-feature=-crt-static --cfg reqwest_unstable" CC="clang" CXX="clang++" GN_EXE=gn
apk add --update --no-cache bash wget cmake musl-dev clang llvm build-base python3
sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories
apk add --update --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing rustup git gn tar ninja
apk update
apk upgrade
rustup-init -y
corepack enable
rustup target add aarch64-unknown-linux-musl
wget https://github.com/napi-rs/napi-rs/releases/download/linux-musl-cross%4010/aarch64-linux-musl-cross.tgz
tar -xvf aarch64-linux-musl-cross.tgz
rm aarch64-linux-musl-cross.tgz
apk add perl
ln -s /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/crtbeginS.o /usr/lib/crtbeginS.o
ln -s /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/crtendS.o /usr/lib/crtendS.o
ln -s /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/libgcc.a /usr/lib/libgcc.a
cd impit-node && pnpm install --frozen-lockfile && pnpm build --target x86_64-unknown-linux-musl
- host: macos-latest
target: aarch64-apple-darwin
build: pnpm build --target aarch64-apple-darwin
- host: windows-latest
target: aarch64-pc-windows-msvc
build: pnpm build --target aarch64-pc-windows-msvc
name: stable - ${{ matrix.settings.target }} - node@22
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Use Node.js 24
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: 24
- name: Install pnpm and dependencies
if: ${{ !matrix.settings.docker }}
uses: apify/actions/pnpm-install@v1.5.0
with:
working-directory: impit-node
- name: Install
uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
if: ${{ !matrix.settings.docker }}
with:
toolchain: stable
targets: ${{ matrix.settings.target }}
- name: Cache cargo
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
.cargo-cache
target/
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
- uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' || matrix.settings.target == 'armv7-unknown-linux-musleabihf' }}
with:
version: 0.13.0
- name: Setup toolchain
run: ${{ matrix.settings.setup }}
if: ${{ matrix.settings.setup }}
shell: bash
- name: Setup node x86
if: matrix.settings.target == 'i686-pc-windows-msvc'
run: pnpm config set supportedArchitectures.cpu "ia32"
shell: bash
- name: Setup node x86
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
if: matrix.settings.target == 'i686-pc-windows-msvc'
with:
node-version: 24
architecture: x86
- name: Build in docker
uses: maus007/docker-run-action-fork@207a4e2a8ebf7e4b985656ba990b1e53715dce2a
if: ${{ matrix.settings.docker }}
with:
image: ${{ matrix.settings.docker }}
options: '--user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build'
run: ${{ matrix.settings.build }}
- name: Build
if: ${{ !matrix.settings.docker }}
shell: bash
run: ${{ matrix.settings.build }}
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: bindings-${{ matrix.settings.target }}
path: impit-node/${{ env.APP_NAME }}.*.node
if-no-files-found: error
test-macOS-windows-binding:
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
needs:
- build
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
node:
- '20'
- '22'
- '24'
exclude:
# @pnpm/exe does not ship a working binary for Intel macOS (darwin-x64) due to an upstream Node.js SEA bug.
# See https://github.com/pnpm/pnpm/issues/11423 and https://github.com/nodejs/node/issues/62893.
# We just skip this combination, as Node 20 is EOL anyway,
# and we test the same target on Node 22+, so chances are that the bindings work on Node 20 as well.
- settings:
host: macos-latest
target: x86_64-apple-darwin
node: '20'
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: ${{ matrix.node }}
architecture: x64
- name: Install pnpm and dependencies
if: runner.os != 'Windows'
uses: apify/actions/pnpm-install@v1.5.0
with:
working-directory: impit-node
- name: Install pnpm and dependencies (Windows)
# pnpm/action-setup bootstraps its own bundled pnpm version, then pnpm's
# self-management switches it to the packageManager-pinned version. That
# switch computes the new binary's location relative to wherever the
# bootstrap installed it, which differs by Node version on Windows and
# produces a broken path on Node 22/24. corepack installs the pinned
# version directly, skipping the switch entirely.
if: runner.os == 'Windows'
shell: bash
run: |
corepack enable
cd impit-node && pnpm install --frozen-lockfile
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: bindings-${{ matrix.settings.target }}
path: impit-node
- name: List packages
run: ls -R .
shell: bash
- name: Test bindings
working-directory: impit-node
env:
APIFY_HTTPBIN_TOKEN: ${{ secrets.APIFY_HTTPBIN_TOKEN }}
run: pnpm test
test-linux-x64-gnu-binding:
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
needs:
- build
strategy:
fail-fast: false
matrix:
node:
- '20'
- '22'
- '24'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: ${{ matrix.node }}
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.5.0
with:
working-directory: impit-node
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: bindings-x86_64-unknown-linux-gnu
path: impit-node
- name: List packages
run: ls -R .
shell: bash
- name: Test bindings
run: docker run -e CI=1 -e APIFY_HTTPBIN_TOKEN=${{ secrets.APIFY_HTTPBIN_TOKEN }} --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim sh -c "corepack enable && cd impit-node && pnpm test"
test-linux-aarch64-gnu-binding:
name: Test bindings on Linux-aarch64-gnu - node@${{ matrix.node }}
needs:
- build
strategy:
fail-fast: false
matrix:
node:
- '20'
- '22'
- '24'
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: ${{ matrix.node }}
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.5.0
with:
working-directory: impit-node
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: bindings-aarch64-unknown-linux-gnu
path: impit-node
- name: List packages
run: ls -R .
shell: bash
- name: Test bindings
working-directory: impit-node
env:
APIFY_HTTPBIN_TOKEN: ${{ secrets.APIFY_HTTPBIN_TOKEN }}
run: pnpm test
test-linux-aarch64-musl-binding:
name: Test bindings on Linux-aarch64-musl - node@${{ matrix.node }}
needs:
- build
strategy:
fail-fast: false
matrix:
node:
- '20'
- '22'
- '24'
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: ${{ matrix.node }}
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: bindings-aarch64-unknown-linux-musl
path: impit-node
- name: List packages
run: ls -R .
shell: bash
- name: Test bindings
run: |
docker run -e CI=1 -e APIFY_HTTPBIN_TOKEN=${{ secrets.APIFY_HTTPBIN_TOKEN }} --rm -v $(pwd):/build -w /build arm64v8/node:${{ matrix.node }}-alpine sh -c "corepack enable && cd impit-node && pnpm install --frozen-lockfile && pnpm test"
test-linux-x64-musl-binding:
name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }}
needs:
- build
strategy:
fail-fast: false
matrix:
node:
- '20'
- '22'
- '24'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: ${{ matrix.node }}
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: bindings-x86_64-unknown-linux-musl
path: impit-node
- name: List packages
run: ls -R .
shell: bash
- name: Test bindings
run: |
docker run -e CI=1 -e APIFY_HTTPBIN_TOKEN=${{ secrets.APIFY_HTTPBIN_TOKEN }} --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine sh -c "corepack enable && cd impit-node && pnpm install --frozen-lockfile && pnpm test"