Skip to content

Commit b1bf1b0

Browse files
committed
feat: added new hosts build
1 parent c5001dd commit b1bf1b0

File tree

24 files changed

+329
-247
lines changed

24 files changed

+329
-247
lines changed

.github/workflows/CI.yaml

Lines changed: 84 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,22 @@ jobs:
3434
build: yarn build --target x86_64-pc-windows-msvc
3535
target: x86_64-pc-windows-msvc
3636
- host: windows-latest
37-
build: |
38-
yarn build --target i686-pc-windows-msvc
39-
yarn test
37+
build: yarn build --target i686-pc-windows-msvc
4038
target: i686-pc-windows-msvc
4139
- host: ubuntu-latest
4240
target: x86_64-unknown-linux-gnu
4341
build: yarn build --target x86_64-unknown-linux-gnu --use-napi-cross
4442
- host: ubuntu-latest
4543
target: x86_64-unknown-linux-musl
46-
build: yarn build -x --target x86_64-unknown-linux-musl
44+
build: yarn build --target x86_64-unknown-linux-musl -x
4745
- host: macos-latest
4846
target: aarch64-apple-darwin
4947
build: yarn build --target aarch64-apple-darwin
5048
- host: ubuntu-latest
5149
target: aarch64-unknown-linux-gnu
52-
build: CC=clang yarn build --target aarch64-unknown-linux-gnu --use-napi-cross
50+
build: yarn build --target aarch64-unknown-linux-gnu --use-napi-cross
5351
- host: ubuntu-latest
5452
target: armv7-unknown-linux-gnueabihf
55-
setup: |
56-
sudo apt-get update
57-
sudo apt-get install gcc-arm-linux-gnueabihf -y
5853
build: yarn build --target armv7-unknown-linux-gnueabihf --use-napi-cross
5954
- host: ubuntu-latest
6055
target: aarch64-linux-android
@@ -68,15 +63,35 @@ jobs:
6863
- host: windows-latest
6964
target: aarch64-pc-windows-msvc
7065
build: yarn build --target aarch64-pc-windows-msvc
71-
name: stable - ${{ matrix.settings.target }} - node@20
66+
- host: ubuntu-latest
67+
target: riscv64gc-unknown-linux-gnu
68+
build: |
69+
sudo apt-get update
70+
sudo apt-get install gcc-riscv64-linux-gnu g++-riscv64-linux-gnu -y
71+
export CC=riscv64-linux-gnu-gcc
72+
export TARGET_CC=riscv64-linux-gnu-gcc
73+
export CXX=riscv64-linux-gnu-g++
74+
yarn build --target riscv64gc-unknown-linux-gnu
75+
- host: ubuntu-latest
76+
target: s390x-unknown-linux-gnu
77+
build: |
78+
export CC=clang
79+
export CFLAGS="-fuse-ld=lld"
80+
yarn build --target s390x-unknown-linux-gnu --use-napi-cross
81+
- host: ubuntu-latest
82+
target: powerpc64le-unknown-linux-gnu
83+
build: yarn build --target powerpc64le-unknown-linux-gnu --use-napi-cross
84+
- host: ubuntu-latest
85+
target: aarch64-unknown-linux-ohos
86+
build: yarn build --target aarch64-unknown-linux-ohos
87+
name: stable - ${{ matrix.settings.target }} - node@22
7288
runs-on: ${{ matrix.settings.host }}
7389
steps:
7490
- uses: actions/checkout@v5
7591
- name: Setup node
7692
uses: actions/setup-node@v4
77-
if: ${{ !matrix.settings.docker }}
7893
with:
79-
node-version: 20
94+
node-version: 22
8095
cache: yarn
8196
- name: Install
8297
uses: dtolnay/rust-toolchain@stable
@@ -87,48 +102,43 @@ jobs:
87102
uses: actions/cache@v4
88103
with:
89104
path: |
90-
~/.cargo/registry
105+
~/.cargo/registry/index/
106+
~/.cargo/registry/cache/
91107
~/.cargo/git/db/
92-
.cargo-cache
93108
~/.napi-rs
109+
.cargo-cache
94110
target/
95111
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
96-
- uses: goto-bus-stop/setup-zig@v2
112+
- uses: mlugg/setup-zig@v2
97113
if: ${{ contains(matrix.settings.target, 'musl') }}
98114
with:
99-
version: 0.13.0
115+
version: 0.14.1
100116
- name: Install cargo-zigbuild
101117
uses: taiki-e/install-action@v2
102118
if: ${{ contains(matrix.settings.target, 'musl') }}
103119
env:
104120
GITHUB_TOKEN: ${{ github.token }}
105121
with:
106122
tool: cargo-zigbuild
123+
- name: Setup OpenHarmony SDK
124+
if: ${{ contains(matrix.settings.target, 'ohos') }}
125+
uses: openharmony-rs/[email protected]
107126
- name: Setup toolchain
108127
run: ${{ matrix.settings.setup }}
109128
if: ${{ matrix.settings.setup }}
110129
shell: bash
111-
- name: Setup node x86
112-
if: matrix.settings.target == 'i686-pc-windows-msvc'
113-
run: yarn config set supportedArchitectures.cpu "ia32"
114-
shell: bash
115130
- name: Install dependencies
116131
run: yarn install
117-
- name: Setup node x86
118-
uses: actions/setup-node@v4
119-
if: matrix.settings.target == 'i686-pc-windows-msvc'
120-
with:
121-
node-version: 20
122-
cache: yarn
123-
architecture: x86
124132
- name: Build
125133
run: ${{ matrix.settings.build }}
126134
shell: bash
127135
- name: Upload artifact
128136
uses: actions/upload-artifact@v4
129137
with:
130138
name: bindings-${{ matrix.settings.target }}
131-
path: ${{ env.APP_NAME }}.*.node
139+
path: |
140+
${{ env.APP_NAME }}.*.node
141+
${{ env.APP_NAME }}.*.wasm
132142
if-no-files-found: error
133143
build-freebsd:
134144
runs-on: ubuntu-latest
@@ -196,8 +206,8 @@ jobs:
196206
target: x86_64-pc-windows-msvc
197207
architecture: x64
198208
node:
199-
- '18'
200209
- '20'
210+
- '22'
201211
runs-on: ${{ matrix.settings.host }}
202212
steps:
203213
- uses: actions/checkout@v5
@@ -210,7 +220,7 @@ jobs:
210220
- name: Install dependencies
211221
run: yarn install --mode=skip-build
212222
- name: Download artifacts
213-
uses: actions/download-artifact@v4
223+
uses: actions/download-artifact@v5
214224
with:
215225
name: bindings-${{ matrix.settings.target }}
216226
path: .
@@ -219,191 +229,85 @@ jobs:
219229
shell: bash
220230
- name: Test bindings
221231
run: yarn test
222-
test-linux-x64-gnu-binding:
223-
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
224-
needs:
225-
- build
226-
strategy:
227-
fail-fast: false
228-
matrix:
229-
node:
230-
- '18'
231-
- '20'
232-
runs-on: ubuntu-latest
233-
steps:
234-
- uses: actions/checkout@v5
235-
- name: Setup node
236-
uses: actions/setup-node@v4
237-
with:
238-
node-version: ${{ matrix.node }}
239-
cache: yarn
240-
- name: Install dependencies
241-
run: yarn install
242-
- name: Download artifacts
243-
uses: actions/download-artifact@v4
244-
with:
245-
name: bindings-x86_64-unknown-linux-gnu
246-
path: .
247-
- name: List packages
248-
run: ls -R .
249-
shell: bash
250-
- name: Test bindings
251-
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test
252-
test-linux-x64-musl-binding:
253-
name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }}
232+
test-linux-binding:
233+
name: Test ${{ matrix.target }} - node@${{ matrix.node }}
254234
needs:
255235
- build
256236
strategy:
257237
fail-fast: false
258238
matrix:
239+
target:
240+
- x86_64-unknown-linux-gnu
241+
- x86_64-unknown-linux-musl
242+
- aarch64-unknown-linux-gnu
243+
- aarch64-unknown-linux-musl
244+
- armv7-unknown-linux-gnueabihf
245+
- s390x-unknown-linux-gnu
259246
node:
260-
- '18'
261247
- '20'
262-
runs-on: ubuntu-latest
248+
- '22'
249+
runs-on: ${{ contains(matrix.target, 'aarch64') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
263250
steps:
264251
- uses: actions/checkout@v5
265252
- name: Setup node
266253
uses: actions/setup-node@v4
267254
with:
268255
node-version: ${{ matrix.node }}
269256
cache: yarn
270-
- name: Install dependencies
271-
run: |
272-
yarn config set supportedArchitectures.libc "musl"
273-
yarn install --mode=skip-build
274-
- name: Download artifacts
275-
uses: actions/download-artifact@v4
276-
with:
277-
name: bindings-x86_64-unknown-linux-musl
278-
path: .
279-
- name: List packages
280-
run: ls -R .
281-
shell: bash
282-
- name: Test bindings
283-
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine yarn test
284-
test-linux-aarch64-gnu-binding:
285-
name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }}
286-
needs:
287-
- build
288-
strategy:
289-
fail-fast: false
290-
matrix:
291-
node:
292-
- '20'
293-
- '22'
294-
runs-on: ubuntu-latest
295-
steps:
296-
- uses: actions/checkout@v5
297-
- name: Download artifacts
298-
uses: actions/download-artifact@v4
299-
with:
300-
name: bindings-aarch64-unknown-linux-gnu
301-
path: .
302-
- name: List packages
303-
run: ls -R .
304-
shell: bash
305-
- name: Install dependencies
257+
- name: Output docker params
258+
id: docker
306259
run: |
307-
yarn config set supportedArchitectures.cpu "arm64"
308-
yarn config set supportedArchitectures.libc "glibc"
309-
yarn install --mode=skip-build
310-
- name: Set up QEMU
311-
uses: docker/setup-qemu-action@v3
312-
with:
313-
platforms: arm64
314-
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
315-
- name: Setup and run tests
316-
uses: addnab/docker-run-action@v3
317-
with:
318-
image: node:${{ matrix.node }}-slim
319-
options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build'
320-
run: |
321-
set -e
322-
yarn test
323-
ls -la
324-
test-linux-aarch64-musl-binding:
325-
name: Test bindings on aarch64-unknown-linux-musl - node@lts
326-
needs:
327-
- build
328-
runs-on: ubuntu-latest
329-
steps:
330-
- uses: actions/checkout@v5
331-
- name: Download artifacts
332-
uses: actions/download-artifact@v4
333-
with:
334-
name: bindings-aarch64-unknown-linux-musl
335-
path: .
336-
- name: List packages
337-
run: ls -R .
338-
shell: bash
260+
node -e "
261+
if ('${{ matrix.target }}'.startsWith('aarch64')) {
262+
console.log('PLATFORM=linux/arm64')
263+
} else if ('${{ matrix.target }}'.startsWith('armv7')) {
264+
console.log('PLATFORM=linux/arm/v7')
265+
} else if ('${{ matrix.target }}'.startsWith('s390x')) {
266+
console.log('PLATFORM=linux/s390x')
267+
} else {
268+
console.log('PLATFORM=linux/amd64')
269+
}
270+
" >> $GITHUB_OUTPUT
271+
node -e "
272+
if ('${{ matrix.target }}'.endsWith('-musl')) {
273+
console.log('IMAGE=node:${{ matrix.node }}-alpine')
274+
} else {
275+
console.log('IMAGE=node:${{ matrix.node }}-slim')
276+
}
277+
" >> $GITHUB_OUTPUT
339278
- name: Install dependencies
340279
run: |
341-
yarn config set supportedArchitectures.cpu "arm64"
342-
yarn config set supportedArchitectures.libc "musl"
343-
yarn install --mode=skip-build
344-
- name: Set up QEMU
345-
uses: docker/setup-qemu-action@v3
346-
with:
347-
platforms: arm64
348-
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
349-
- name: Setup and run tests
350-
uses: addnab/docker-run-action@v3
351-
with:
352-
image: node:lts-alpine
353-
options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build'
354-
run: |
355-
set -e
356-
yarn test
357-
test-linux-arm-gnueabihf-binding:
358-
name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }}
359-
needs:
360-
- build
361-
strategy:
362-
fail-fast: false
363-
matrix:
364-
node:
365-
- '18'
366-
- '20'
367-
runs-on: ubuntu-latest
368-
steps:
369-
- uses: actions/checkout@v5
280+
yarn config set --json supportedArchitectures.cpu '["current", "arm64", "x64", "arm", "s390x"]'
281+
yarn config set --json supportedArchitectures.libc '["current", "musl", "gnu"]'
282+
yarn install
370283
- name: Download artifacts
371-
uses: actions/download-artifact@v4
284+
uses: actions/download-artifact@v5
372285
with:
373-
name: bindings-armv7-unknown-linux-gnueabihf
286+
name: bindings-${{ matrix.target }}
374287
path: .
375288
- name: List packages
376289
run: ls -R .
377290
shell: bash
378-
- name: Install dependencies
379-
run: |
380-
yarn config set supportedArchitectures.cpu "arm"
381-
yarn install --mode=skip-build
382291
- name: Set up QEMU
383292
uses: docker/setup-qemu-action@v3
293+
if: ${{ !contains(matrix.target, 'aarch64') }}
384294
with:
385-
platforms: arm
295+
platforms: all
386296
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
387-
- name: Setup and run tests
297+
if: ${{ !contains(matrix.target, 'aarch64') }}
298+
- name: Test bindings
388299
uses: addnab/docker-run-action@v3
389300
with:
390-
image: node:${{ matrix.node }}-bullseye-slim
391-
options: '--platform linux/arm/v7 -v ${{ github.workspace }}:/build -w /build'
392-
run: |
393-
set -e
394-
yarn test
395-
ls -la
301+
image: ${{ steps.docker.outputs.IMAGE }}
302+
options: -v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} --platform ${{ steps.docker.outputs.PLATFORM }}
303+
run: yarn test
396304
publish:
397305
name: Publish
398306
runs-on: ubuntu-latest
399307
needs:
400308
- build-freebsd
401309
- test-macOS-windows-binding
402-
- test-linux-x64-gnu-binding
403-
- test-linux-x64-musl-binding
404-
- test-linux-aarch64-gnu-binding
405-
- test-linux-aarch64-musl-binding
406-
- test-linux-arm-gnueabihf-binding
310+
- test-linux-binding
407311
steps:
408312
- uses: actions/checkout@v5
409313
- name: Setup node
@@ -414,7 +318,7 @@ jobs:
414318
- name: Install dependencies
415319
run: yarn install --mode=skip-build
416320
- name: Download all artifacts
417-
uses: actions/download-artifact@v4
321+
uses: actions/download-artifact@v5
418322
with:
419323
path: artifacts
420324
- name: Move artifacts

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ansible.python.interpreterPath": "/usr/bin/python3"
3+
}

0 commit comments

Comments
 (0)