-
Notifications
You must be signed in to change notification settings - Fork 11
94 lines (75 loc) · 2.45 KB
/
swc-plugin.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
name: SWC Plugin CI
on:
push:
branches: [ master ]
paths:
- 'packages/engine.swc-plugin-syntax/**'
pull_request:
paths:
- 'packages/engine.swc-plugin-syntax/**'
jobs:
build-and-test:
name: Build and Test SWC Plugin
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/engine.swc-plugin-syntax
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-wasi
override: true
components: rustfmt, clippy
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
packages/engine.swc-plugin-syntax/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Check formatting
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Run Rust tests
run: cargo test
- name: Build WASM
run: |
cargo build --release --target wasm32-wasi
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: swc-plugin-wasm
path: packages/engine.swc-plugin-syntax/target/wasm32-wasi/release/engine_swc_plugin_syntax.wasm
integration:
name: Integration with Node.js
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "20"
- name: Download WASM artifact
uses: actions/download-artifact@v3
with:
name: swc-plugin-wasm
path: packages/engine.swc-plugin-syntax/dist
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
run: yarn install --immutable
- name: Run integration tests
run: yarn test
working-directory: packages/engine.swc-plugin-syntax