|
1
|
name: CI |
|
2
|
|
|
3
|
on: |
|
4
|
push: |
|
5
|
branches: [main] |
|
6
|
pull_request: |
|
7
|
|
|
8
|
env: |
|
9
|
CARGO_TERM_COLOR: always |
|
10
|
|
|
11
|
jobs: |
|
12
|
test: |
|
13
|
name: fmt / clippy / test |
|
14
|
runs-on: ubuntu-latest |
|
15
|
steps: |
|
16
|
- uses: actions/checkout@v4 |
|
17
|
|
|
18
|
- name: Read Rust toolchain |
|
19
|
shell: bash |
|
20
|
run: | |
|
21
|
rust_toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml | head -n 1)" |
|
22
|
echo "RUST_TOOLCHAIN=${rust_toolchain}" >> "$GITHUB_ENV" |
|
23
|
|
|
24
|
- uses: dtolnay/rust-toolchain@stable |
|
25
|
with: |
|
26
|
toolchain: ${{ env.RUST_TOOLCHAIN }} |
|
27
|
components: rustfmt, clippy |
|
28
|
|
|
29
|
- uses: Swatinem/rust-cache@v2 |
|
30
|
|
|
31
|
- name: Check formatting |
|
32
|
run: cargo fmt --all -- --check |
|
33
|
|
|
34
|
- name: Clippy |
|
35
|
run: cargo clippy --workspace --all-targets -- -D warnings |
|
36
|
|
|
37
|
- name: Test |
|
38
|
run: cargo test --workspace |