-
Notifications
You must be signed in to change notification settings - Fork 86
54 lines (51 loc) · 1.29 KB
/
rust.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
name: Cargo & Clippy Test
on:
push:
branches: [master]
paths:
- src/**
- test_files/**
- .cargo/**
- Cargo.toml
- Cargo.lock
- rust-toolchain.toml
- flake.nix
- flake.lock
pull_request:
paths:
- src/**
- test_files/**
- .cargo/**
- Cargo.toml
- Cargo.lock
- rust-toolchain.toml
- flake.nix
- flake.lock
env:
CARGO_TERM_COLOR: always
jobs:
build_and_test:
name: Rust and clippy tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: bc shfmt
version: 1.0
- uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies installed with cargo
uses: actions/cache@v4
with:
path: |
./target/deps
~/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Build binary
# the binary will be used by the next cargo test step
run: cargo build
- name: Run cargo tests
run: cargo test --all-targets --all-features
- name: Run clippy check
run: cargo clippy --all-targets --all-features -- -D warnings