1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ main, master ]
6+ pull_request :
7+ branches : [ main, master ]
8+
9+ env :
10+ CARGO_TERM_COLOR : always
11+
12+ jobs :
13+ test :
14+ name : Test
15+ runs-on : ubuntu-latest
16+ strategy :
17+ matrix :
18+ rust :
19+ - stable
20+ - beta
21+ - nightly
22+ steps :
23+ - uses : actions/checkout@v4
24+
25+ - name : Install Rust
26+ uses : dtolnay/rust-toolchain@master
27+ with :
28+ toolchain : ${{ matrix.rust }}
29+ components : rustfmt, clippy
30+
31+ - name : Cache cargo registry
32+ uses : actions/cache@v3
33+ with :
34+ path : ~/.cargo/registry
35+ key : ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
36+
37+ - name : Cache cargo index
38+ uses : actions/cache@v3
39+ with :
40+ path : ~/.cargo/git
41+ key : ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
42+
43+ - name : Cache cargo build
44+ uses : actions/cache@v3
45+ with :
46+ path : target
47+ key : ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
48+
49+ - name : Check formatting
50+ run : cargo fmt --all -- --check
51+
52+ - name : Run clippy
53+ run : cargo clippy --all-targets --all-features -- -D warnings
54+
55+ - name : Build
56+ run : cargo build --verbose
57+
58+ - name : Run tests
59+ run : cargo test --verbose
60+
61+ - name : Build examples
62+ run : cargo build --examples --verbose
63+
64+ coverage :
65+ name : Coverage
66+ runs-on : ubuntu-latest
67+ steps :
68+ - uses : actions/checkout@v4
69+
70+ - name : Install Rust
71+ uses : dtolnay/rust-toolchain@stable
72+
73+ - name : Install cargo-tarpaulin
74+ uses : taiki-e/install-action@cargo-tarpaulin
75+
76+ - name : Generate code coverage
77+ run : cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out xml
78+
79+ - name : Upload to codecov.io
80+ uses : codecov/codecov-action@v3
81+ with :
82+ file : cobertura.xml
83+ fail_ci_if_error : true
84+
85+ security :
86+ name : Security audit
87+ runs-on : ubuntu-latest
88+ steps :
89+ - uses : actions/checkout@v4
90+
91+ - name : Install Rust
92+ uses : dtolnay/rust-toolchain@stable
93+
94+ - name : Install cargo-audit
95+ uses : taiki-e/install-action@cargo-audit
96+
97+ - name : Run security audit
98+ run : cargo audit
99+
100+ msrv :
101+ name : Minimum supported Rust version
102+ runs-on : ubuntu-latest
103+ steps :
104+ - uses : actions/checkout@v4
105+
106+ - name : Install Rust
107+ uses : dtolnay/rust-toolchain@master
108+ with :
109+ toolchain : 1.70.0 # Adjust based on your MSRV
110+
111+ - name : Check MSRV
112+ run : cargo check --all-features
0 commit comments