Skip to content

Commit 1d7bd36

Browse files
authored
ci: fix & improve SWC workflow (jantimon#29)
- Make YAML valid again - Introduce build cache - Add new Rust test & lint job
1 parent 5a94376 commit 1d7bd36

File tree

1 file changed

+62
-19
lines changed

1 file changed

+62
-19
lines changed

.github/workflows/swc.yml

Lines changed: 62 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,76 @@
1-
name: SWC Test
1+
name: SWC validation
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- main
67
pull_request:
7-
branches: [ main ]
88

99
env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
13-
cross-os:
13+
rust:
14+
name: Rust tests & lints
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout sources
18+
uses: actions/checkout@v3
19+
- name: Install stable toolchain
20+
uses: actions-rs/toolchain@v1
21+
with:
22+
profile: minimal
23+
toolchain: stable
24+
- name: Enable caching
25+
uses: Swatinem/rust-cache@v2
26+
with:
27+
workspaces: swc
28+
- name: Run cargo check
29+
uses: actions-rs/cargo@v1
30+
with:
31+
command: check
32+
args: --manifest-path swc/Cargo.toml
33+
- name: Run cargo test
34+
uses: actions-rs/cargo@v1
35+
with:
36+
command: test
37+
args: --manifest-path swc/Cargo.toml
38+
- name: Run cargo fmt
39+
uses: actions-rs/cargo@v1
40+
with:
41+
command: fmt
42+
args: --manifest-path swc/Cargo.toml --all -- --check
43+
- name: Run cargo clippy
44+
uses: actions-rs/cargo@v1
45+
with:
46+
command: clippy
47+
args: --manifest-path swc/Cargo.toml -- -D warnings
48+
49+
wasm:
50+
name: Wasm plugin tests
1451
strategy:
52+
fail-fast: false
1553
matrix:
16-
node-version: [16]
1754
os: [ubuntu-latest, windows-latest]
1855
runs-on: ${{ matrix.os }}
1956
steps:
20-
- uses: actions/checkout@v2
21-
- name: RustUp
22-
run: rustup target add wasm32-wasi
23-
- name: Use Node.js ${{ matrix.node-version }}
24-
- uses: actions/setup-node@v3
25-
with: ${{ matrix.node-version }}
26-
- name: Install NPM Dependencies
27-
run: npm i
28-
- name: Build JS
29-
run: npm run build
30-
- name: Build SWC RUST Plugin
31-
run: npm run build:swc
32-
- name: Run tests
33-
run: npm run test:swc
57+
- name: Checkout sources
58+
uses: actions/checkout@v3
59+
- name: Add wasm32-wasi target
60+
run: rustup target add wasm32-wasi
61+
- name: Enable caching
62+
uses: Swatinem/rust-cache@v2
63+
with:
64+
workspaces: swc
65+
- name: Use Node.js 16
66+
uses: actions/setup-node@v3
67+
with:
68+
node-version: 16
69+
- name: Install NPM dependencies
70+
run: npm i
71+
- name: Build JS
72+
run: npm run build
73+
- name: Build SWC plugin
74+
run: npm run build:swc
75+
- name: Run tests
76+
run: npm run test:swc:jest

0 commit comments

Comments
 (0)