Skip to content

Commit 7acb1d3

Browse files
liuzejialiuzejia
authored andcommitted
feat: ci
1 parent 230dc6e commit 7acb1d3

1 file changed

Lines changed: 144 additions & 28 deletions

File tree

.github/workflows/CI.yml

Lines changed: 144 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,48 +21,43 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
node-version: [18.x]
2524
settings:
26-
- host: macos-12
25+
- host: macos-latest
2726
target: x86_64-apple-darwin
2827
build: |
29-
pnpm build:binding:release
30-
strip -x crates/native_binding/*.node
28+
yarn build --target x86_64-apple-darwin
29+
strip -x *.node
3130
- host: windows-latest
32-
build: pnpm build:binding:release
31+
build: yarn build
3332
target: x86_64-pc-windows-msvc
34-
- host: ubuntu-20.04
33+
- host: ubuntu-latest
3534
target: x86_64-unknown-linux-gnu
3635
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
3736
build: |-
3837
set -e &&
39-
pnpm build:binding:release --target x86_64-unknown-linux-gnu &&
40-
strip crates/native_binding/*.node
41-
- host: ubuntu-20.04
38+
yarn build --target x86_64-unknown-linux-gnu &&
39+
strip *.node
40+
- host: ubuntu-latest
4241
target: x86_64-unknown-linux-musl
4342
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
44-
build: set -e && pnpm build:binding:release && strip crates/native_binding/*.node
45-
- host: macos-12
43+
build: set -e && yarn build && strip *.node
44+
- host: macos-latest
4645
target: aarch64-apple-darwin
4746
build: |
48-
pnpm build:binding:release --target aarch64-apple-darwin
49-
strip -x crates/native_binding/*.node
50-
name: stable - ${{ matrix.settings.target }}
47+
yarn build --target aarch64-apple-darwin
48+
strip -x *.node
49+
name: stable - ${{ matrix.settings.target }} - node@18
5150
runs-on: ${{ matrix.settings.host }}
5251
steps:
53-
- name: Checkout
54-
uses: actions/checkout@v4
55-
- name: Setup pnpm
56-
uses: pnpm/action-setup@v3.0.0
57-
with:
58-
version: 8
59-
- name: Setup Node.js ${{ matrix.node-version }}
60-
uses: actions/setup-node@v4
52+
- uses: actions/checkout@v3
53+
- name: Setup node
54+
uses: actions/setup-node@v3
6155
if: ${{ !matrix.settings.docker }}
6256
with:
63-
node-version: ${{ matrix.node-version }}
64-
cache: 'pnpm'
65-
- name: Setup Rust
57+
node-version: 18
58+
check-latest: true
59+
cache: yarn
60+
- name: Install
6661
uses: dtolnay/rust-toolchain@stable
6762
if: ${{ !matrix.settings.docker }}
6863
with:
@@ -78,8 +73,28 @@ jobs:
7873
.cargo-cache
7974
target/
8075
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
76+
- uses: goto-bus-stop/setup-zig@v2
77+
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }}
78+
with:
79+
version: 0.10.1
80+
- name: Setup toolchain
81+
run: ${{ matrix.settings.setup }}
82+
if: ${{ matrix.settings.setup }}
83+
shell: bash
84+
- name: Setup node x86
85+
if: matrix.settings.target == 'i686-pc-windows-msvc'
86+
run: yarn config set supportedArchitectures.cpu "ia32"
87+
shell: bash
8188
- name: Install dependencies
82-
run: pnpm install --filter @tarojs/binding... --frozen-lockfile
89+
run: yarn install
90+
- name: Setup node x86
91+
uses: actions/setup-node@v3
92+
if: matrix.settings.target == 'i686-pc-windows-msvc'
93+
with:
94+
node-version: 18
95+
check-latest: true
96+
cache: yarn
97+
architecture: x86
8398
- name: Build in docker
8499
uses: addnab/docker-run-action@v3
85100
if: ${{ matrix.settings.docker }}
@@ -92,11 +107,112 @@ jobs:
92107
if: ${{ !matrix.settings.docker }}
93108
shell: bash
94109
- name: Upload artifact
95-
uses: actions/upload-artifact@v4
110+
uses: actions/upload-artifact@v3
96111
with:
97112
name: bindings-${{ matrix.settings.target }}
98-
path: crates/native_binding/${{ inputs.name }}.*.node
113+
path: ${{ env.APP_NAME }}.*.node
99114
if-no-files-found: error
115+
test-macOS-windows-binding:
116+
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
117+
needs:
118+
- build
119+
strategy:
120+
fail-fast: false
121+
matrix:
122+
settings:
123+
- host: windows-latest
124+
target: x86_64-pc-windows-msvc
125+
node:
126+
- '14'
127+
- '16'
128+
- '18'
129+
runs-on: ${{ matrix.settings.host }}
130+
steps:
131+
- uses: actions/checkout@v3
132+
- name: Setup node
133+
uses: actions/setup-node@v3
134+
with:
135+
node-version: ${{ matrix.node }}
136+
check-latest: true
137+
cache: yarn
138+
- name: Install dependencies
139+
run: yarn install
140+
- name: Download artifacts
141+
uses: actions/download-artifact@v3
142+
with:
143+
name: bindings-${{ matrix.settings.target }}
144+
path: .
145+
- name: List packages
146+
run: ls -R .
147+
shell: bash
148+
- name: Test bindings
149+
run: yarn test
150+
test-linux-x64-gnu-binding:
151+
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
152+
needs:
153+
- build
154+
strategy:
155+
fail-fast: false
156+
matrix:
157+
node:
158+
- '14'
159+
- '16'
160+
- '18'
161+
runs-on: ubuntu-latest
162+
steps:
163+
- uses: actions/checkout@v3
164+
- name: Setup node
165+
uses: actions/setup-node@v3
166+
with:
167+
node-version: ${{ matrix.node }}
168+
check-latest: true
169+
cache: yarn
170+
- name: Install dependencies
171+
run: yarn install
172+
- name: Download artifacts
173+
uses: actions/download-artifact@v3
174+
with:
175+
name: bindings-x86_64-unknown-linux-gnu
176+
path: .
177+
- name: List packages
178+
run: ls -R .
179+
shell: bash
180+
- name: Test bindings
181+
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test
182+
test-linux-x64-musl-binding:
183+
name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }}
184+
needs:
185+
- build
186+
strategy:
187+
fail-fast: false
188+
matrix:
189+
node:
190+
- '14'
191+
- '16'
192+
- '18'
193+
runs-on: ubuntu-latest
194+
steps:
195+
- uses: actions/checkout@v3
196+
- name: Setup node
197+
uses: actions/setup-node@v3
198+
with:
199+
node-version: ${{ matrix.node }}
200+
check-latest: true
201+
cache: yarn
202+
- name: Install dependencies
203+
run: |
204+
yarn config set supportedArchitectures.libc "musl"
205+
yarn install
206+
- name: Download artifacts
207+
uses: actions/download-artifact@v3
208+
with:
209+
name: bindings-x86_64-unknown-linux-musl
210+
path: .
211+
- name: List packages
212+
run: ls -R .
213+
shell: bash
214+
- name: Test bindings
215+
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine yarn test
100216
publish:
101217
name: Publish
102218
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)