Skip to content

Commit f5c1914

Browse files
committed
Update CI workflow
1 parent 547faa2 commit f5c1914

2 files changed

Lines changed: 90 additions & 48 deletions

File tree

.github/workflows/ci.yml

Lines changed: 76 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,95 @@
11
name: Automated Testing
22

3-
on: push
3+
on:
4+
push:
5+
branches: ["*"]
46

57
env:
68
CARGO_TERM_COLOR: always
79

810
jobs:
9-
check:
10-
name: Check
11+
clippy:
1112
runs-on: ubuntu-latest
1213
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions-rs/toolchain@v1
15-
with:
16-
profile: minimal
17-
toolchain: stable
18-
override: true
19-
- uses: actions-rs/cargo@v1
20-
with:
21-
command: check
14+
- name: Checkout
15+
uses: actions/checkout@v4
2216

23-
test:
24-
name: Test Suite
25-
runs-on: ubuntu-latest
26-
steps:
27-
- uses: actions/checkout@v2
28-
- uses: actions-rs/toolchain@v1
17+
- name: Set up cache
18+
uses: actions/cache@v3
2919
with:
30-
profile: minimal
31-
toolchain: stable
32-
override: true
33-
- uses: actions-rs/cargo@v1
34-
with:
35-
command: test
20+
path: |
21+
~/.cargo/.crates.toml
22+
~/.cargo/.crates2.json
23+
~/.cargo/bin/
24+
~/.cargo/registry/index/
25+
~/.cargo/registry/cache/
26+
~/.cargo/git/db/
27+
~/.rustup/toolchains/
28+
target/
29+
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }}
30+
31+
- name: Install WASM toolchain
32+
run: rustup target add wasm32-unknown-unknown
33+
34+
- name: Check project
35+
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
3636

37-
format:
38-
name: Format
37+
- name: Check project (WASM)
38+
# Note lack of --all-targets here because tests and examples are not wasm compatible
39+
run: cargo clippy --workspace --all-features --target wasm32-unknown-unknown -- -D warnings
40+
41+
clippy-stable:
3942
runs-on: ubuntu-latest
4043
steps:
41-
- uses: actions/checkout@v2
42-
- uses: actions-rs/toolchain@v1
43-
with:
44-
profile: minimal
45-
toolchain: stable
46-
override: true
47-
components: rustfmt
48-
- uses: actions-rs/cargo@v1
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
47+
- name: Set up cache
48+
uses: actions/cache@v3
4949
with:
50-
command: fmt
51-
args: --all -- --check
50+
path: |
51+
~/.cargo/.crates.toml
52+
~/.cargo/.crates2.json
53+
~/.cargo/bin/
54+
~/.cargo/registry/index/
55+
~/.cargo/registry/cache/
56+
~/.cargo/git/db/
57+
~/.rustup/toolchains/
58+
target/
59+
key: ${{ runner.os }}-cargo-check-stable-${{ hashFiles('**/Cargo.lock') }}
5260

53-
clippy:
54-
name: Clippy
61+
- name: Install stable toolchain
62+
run: rustup toolchain install stable
63+
64+
- name: Install WASM toolchain
65+
run: rustup target add wasm32-unknown-unknown --toolchain stable
66+
67+
- name: Check on stable
68+
run: cargo +stable clippy --all-targets -- -D warnings
69+
70+
- name: Check project (WASM) on stable
71+
# Note lack of --all-targets here because tests and examples are not wasm compatible
72+
run: cargo +stable clippy --target wasm32-unknown-unknown -- -D warnings
73+
74+
test:
5575
runs-on: ubuntu-latest
5676
steps:
57-
- uses: actions/checkout@v2
58-
- uses: actions-rs/toolchain@v1
59-
with:
60-
profile: minimal
61-
toolchain: stable
62-
override: true
63-
components: clippy
64-
- uses: actions-rs/cargo@v1
77+
- name: Checkout
78+
uses: actions/checkout@v4
79+
80+
- name: Set up cache
81+
uses: actions/cache@v3
6582
with:
66-
command: clippy
67-
args: -- -D warnings
83+
path: |
84+
~/.cargo/.crates.toml
85+
~/.cargo/.crates2.json
86+
~/.cargo/bin/
87+
~/.cargo/registry/index/
88+
~/.cargo/registry/cache/
89+
~/.cargo/git/db/
90+
~/.rustup/toolchains/
91+
target/
92+
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
93+
94+
- name: Test project
95+
run: RUST_BACKTRACE=1 cargo test --workspace --all-targets --all-features

rust-toolchain.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
11
[toolchain]
22
channel = "1.90"
3+
components = [
4+
"rustc",
5+
"cargo",
6+
"rustfmt",
7+
"rust-std",
8+
"rust-docs",
9+
"rust-analyzer",
10+
"clippy",
11+
"miri",
12+
"rust-src",
13+
# "rust-mingw",
14+
# "llvm-tools",
15+
# "rustc-dev",
16+
]

0 commit comments

Comments
 (0)