-
Notifications
You must be signed in to change notification settings - Fork 29
127 lines (122 loc) · 3.83 KB
/
nodejs.yml
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
name: CI
on:
push:
branches: [ master, 1.x ]
pull_request:
branches: [ master, 1.x ]
jobs:
Job:
name: Node.js
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
os: 'ubuntu-latest'
version: '8, 10, 12, 14, 16, 18, 20, 22'
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
build-with-zig:
strategy:
fail-fast: false
matrix:
targets:
[
'x86_64-unknown-linux-gnu',
'aarch64-unknown-linux-gnu'
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
target: ${{ matrix.targets }}
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install ziglang
uses: goto-bus-stop/setup-zig@v1
with:
version: 0.10.0
- run: npm install
- run: rustup toolchain install nightly-2022-12-12
- run: rustup target add --toolchain nightly-2022-12-12 ${{ matrix.targets }}
- run: (cd ./lib/v2rust && cargo test -- --nocapture --test-threads=1)
- run: npx napi build --cargo-cwd ./lib/v2rust --platform --release ./lib/v2rust/harness/dist/ --zig --zig-abi-suffix 2.17 --target ${{ matrix.targets }}
- uses: actions/upload-artifact@v3
with:
name: bindings-${{ matrix.targets }}
path: lib/v2rust/harness/dist/
if-no-files-found: error
build:
strategy:
fail-fast: false
matrix:
targets:
[
'x86_64-pc-windows-msvc',
'aarch64-pc-windows-msvc',
'x86_64-apple-darwin',
'aarch64-apple-darwin'
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
target: ${{ matrix.targets }}
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install ziglang
uses: goto-bus-stop/setup-zig@v1
with:
version: 0.10.0
- run: cargo install cargo-xwin
- run: npm install
- run: rustup toolchain install nightly-2022-12-12
- run: rustup target add --toolchain nightly-2022-12-12 ${{ matrix.targets }}
- run: (cd ./lib/v2rust && cargo test -- --nocapture --test-threads=1)
- run: npx napi build --cargo-cwd ./lib/v2rust --platform --release ./lib/v2rust/harness/dist/ --target ${{ matrix.targets }}
- uses: actions/upload-artifact@v3
with:
name: bindings-${{ matrix.targets }}
path: lib/v2rust/harness/dist/
if-no-files-found: error
test-rust-v2:
strategy:
fail-fast: false
matrix:
settings:
- target: x86_64-unknown-linux-gnu
docker: node:18-slim
setup: 'exit 0'
runs-on: ubuntu-latest
needs:
- build-with-zig
steps:
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: npm install
- name: Download bindings
uses: actions/download-artifact@v3
with:
name: bindings-${{ matrix.settings.target }}
path: lib/v2rust/harness/dist/
- name: Run tests
uses: addnab/docker-run-action@v3
with:
image: ${{ matrix.settings.docker }}
options: -v ${{ github.workspace }}:/build -w /build
run: |
set -e ${{ matrix.settings.setup }}
apt update
apt install make
make test-v2rust