forked from web-infra-dev/rspack
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (56 loc) · 1.71 KB
/
check-rs.yaml
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
name: check-rs
on:
push:
branches:
- main
tags-ignore:
- "**"
pull_request:
paths: # Only run when changes are made to rust code or root Cargo
- "crates/**"
- "examples/**"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- "rustfmt.toml"
- "clippy.toml"
# cancel previous job runs for the same workflow + pr
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
lint-format-test:
name: lint, format, spell check, test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install toolchain
run: rustup show
- name: Pnpm Cache
uses: ./.github/actions/pnpm-cache
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: check
save-if: ${{ github.ref_name == 'main' }}
- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Run Cargo Check
run: |
cargo check --workspace --all-targets --release --locked
cd crates/node_binding && cargo check --workspace --all-targets --release --locked --target-dir ../../target && cd ../../
- name: Run Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --all-targets -- -D warnings
- name: Check Dependencies
run: node ./scripts/check_rust_dependency.cjs
- name: Run test
run: |
node -e "console.log(process.arch)"
cargo test --workspace -- --nocapture --test-threads=1