Skip to content

Commit 243bf79

Browse files
committed
ci: split build (WASM) and test (native) into separate jobs
1 parent bd7c2e4 commit 243bf79

1 file changed

Lines changed: 32 additions & 22 deletions

File tree

.github/workflows/ci.yml

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,54 @@ name: CI
33
on:
44
push:
55
branches: [ main ]
6-
pull_request:
7-
branches: [ main ]
86
workflow_dispatch:
97

108
jobs:
11-
build:
9+
build-wasm:
10+
name: Build WebAssembly
1211
runs-on: ubuntu-latest
13-
1412
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v3
13+
- uses: actions/checkout@v3
1714

1815
- name: Set up Rust
1916
uses: actions-rs/toolchain@v1
2017
with:
2118
toolchain: stable
22-
target: wasm32-unknown-unknown
23-
override: true
19+
components: "rustfmt,clippy"
20+
21+
- name: Install wasm target
22+
run: rustup target add wasm32-unknown-unknown
2423

2524
- name: Install wasm-pack
2625
run: cargo install wasm-pack
2726

28-
- name: Build WebAssembly
29-
run: wasm-pack build --target web --out-dir pkg
27+
- name: Build WASM bundle
28+
run: wasm-pack build --target web --dev
3029

3130
- name: Set up Node.js
3231
uses: actions/setup-node@v3
33-
with:
34-
node-version: 18
35-
cache: 'npm'
3632

3733
- name: npm ci & build
38-
run: |
39-
npm ci
40-
npm run build
41-
42-
- name: Run Rust lints & tests
43-
run: |
44-
cargo fmt -- --check
45-
cargo clippy -- -D warnings
46-
# cargo test -- --nocapture
34+
run: npm ci && npm run build
35+
36+
test:
37+
name: Lint & Test (native)
38+
runs-on: ubuntu-latest
39+
needs: build-wasm
40+
steps:
41+
- uses: actions/checkout@v3
42+
43+
- name: Set up Rust (native)
44+
uses: actions-rs/toolchain@v1
45+
with:
46+
toolchain: stable
47+
components: "rustfmt,clippy"
48+
49+
- name: Run rustfmt check
50+
run: cargo fmt -- --check
51+
52+
- name: Run clippy
53+
run: cargo clippy -- -D warnings
54+
55+
- name: Run tests
56+
run: cargo test --all -- --nocapture

0 commit comments

Comments
 (0)