Skip to content

Commit cbd5bec

Browse files
liuzejialiuzejia
authored andcommitted
feat: ci
1 parent c2dc328 commit cbd5bec

1 file changed

Lines changed: 28 additions & 148 deletions

File tree

.github/workflows/CI.yml

Lines changed: 28 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -21,43 +21,48 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24+
node-version: [18.x]
2425
settings:
25-
- host: macos-latest
26+
- host: macos-12
2627
target: x86_64-apple-darwin
2728
build: |
28-
yarn build
29-
strip -x *.node
29+
pnpm build:binding:release
30+
strip -x crates/native_binding/*.node
3031
- host: windows-latest
31-
build: yarn build
32+
build: pnpm build:binding:release
3233
target: x86_64-pc-windows-msvc
33-
- host: ubuntu-latest
34+
- host: ubuntu-20.04
3435
target: x86_64-unknown-linux-gnu
3536
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
3637
build: |-
3738
set -e &&
38-
yarn build --target x86_64-unknown-linux-gnu &&
39-
strip *.node
40-
- host: ubuntu-latest
39+
pnpm build:binding:release --target x86_64-unknown-linux-gnu &&
40+
strip crates/native_binding/*.node
41+
- host: ubuntu-20.04
4142
target: x86_64-unknown-linux-musl
4243
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
43-
build: set -e && yarn build && strip *.node
44-
- host: macos-latest
44+
build: set -e && pnpm build:binding:release && strip crates/native_binding/*.node
45+
- host: macos-12
4546
target: aarch64-apple-darwin
4647
build: |
47-
yarn build --target aarch64-apple-darwin
48-
strip -x *.node
49-
name: stable - ${{ matrix.settings.target }} - node@18
48+
pnpm build:binding:release --target aarch64-apple-darwin
49+
strip -x crates/native_binding/*.node
50+
name: stable - ${{ matrix.settings.target }}
5051
runs-on: ${{ matrix.settings.host }}
5152
steps:
52-
- uses: actions/checkout@v3
53-
- name: Setup node
54-
uses: actions/setup-node@v3
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
5561
if: ${{ !matrix.settings.docker }}
5662
with:
57-
node-version: 18
58-
check-latest: true
59-
cache: yarn
60-
- name: Install
63+
node-version: ${{ matrix.node-version }}
64+
cache: 'pnpm'
65+
- name: Setup Rust
6166
uses: dtolnay/rust-toolchain@stable
6267
if: ${{ !matrix.settings.docker }}
6368
with:
@@ -73,28 +78,8 @@ jobs:
7378
.cargo-cache
7479
target/
7580
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
8881
- name: Install dependencies
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
82+
run: pnpm install --filter @tarojs/binding... --frozen-lockfile
9883
- name: Build in docker
9984
uses: addnab/docker-run-action@v3
10085
if: ${{ matrix.settings.docker }}
@@ -107,119 +92,14 @@ jobs:
10792
if: ${{ !matrix.settings.docker }}
10893
shell: bash
10994
- name: Upload artifact
110-
uses: actions/upload-artifact@v3
95+
uses: actions/upload-artifact@v4
11196
with:
11297
name: bindings-${{ matrix.settings.target }}
113-
path: ${{ env.APP_NAME }}.*.node
98+
path: crates/native_binding/${{ inputs.name }}.*.node
11499
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
216100
publish:
217101
name: Publish
218102
runs-on: ubuntu-latest
219-
needs:
220-
- test-macOS-windows-binding
221-
- test-linux-x64-gnu-binding
222-
- test-linux-x64-musl-binding
223103
steps:
224104
- uses: actions/checkout@v3
225105
- name: Setup node

0 commit comments

Comments
 (0)