1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ main, develop ]
6+ pull_request :
7+ branches : [ main, develop ]
8+
9+ env :
10+ CARGO_TERM_COLOR : always
11+
12+ jobs :
13+ test :
14+ name : Test
15+ runs-on : ubuntu-latest
16+ steps :
17+ - uses : actions/checkout@v4
18+
19+ - name : Install Rust
20+ uses : dtolnay/rust-toolchain@stable
21+ with :
22+ components : rustfmt, clippy
23+
24+ - name : Cache cargo dependencies
25+ uses : actions/cache@v3
26+ with :
27+ path : |
28+ ~/.cargo/registry
29+ ~/.cargo/git
30+ target/
31+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
32+
33+ - name : Check formatting
34+ run : cargo fmt -- --check
35+
36+ - name : Run clippy
37+ run : cargo clippy --all-targets --all-features -- -D warnings
38+
39+ - name : Run tests
40+ run : cargo test --verbose
41+
42+ - name : Check documentation
43+ run : cargo doc --no-deps --document-private-items
44+
45+ build :
46+ name : Build
47+ runs-on : ${{ matrix.os }}
48+ strategy :
49+ matrix :
50+ os : [ubuntu-latest, windows-latest, macos-latest]
51+ steps :
52+ - uses : actions/checkout@v4
53+
54+ - name : Install Rust
55+ uses : dtolnay/rust-toolchain@stable
56+
57+ - name : Cache cargo dependencies
58+ uses : actions/cache@v3
59+ with :
60+ path : |
61+ ~/.cargo/registry
62+ ~/.cargo/git
63+ target/
64+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
65+
66+ - name : Build
67+ run : cargo build --release --verbose
68+
69+ security :
70+ name : Security audit
71+ runs-on : ubuntu-latest
72+ steps :
73+ - uses : actions/checkout@v4
74+
75+ - name : Install Rust
76+ uses : dtolnay/rust-toolchain@stable
77+
78+ - name : Install cargo-audit
79+ run : cargo install cargo-audit
80+
81+ - name : Run security audit
82+ run : cargo audit
83+
84+ coverage :
85+ name : Code coverage
86+ runs-on : ubuntu-latest
87+ steps :
88+ - uses : actions/checkout@v4
89+
90+ - name : Install Rust
91+ uses : dtolnay/rust-toolchain@stable
92+ with :
93+ components : llvm-tools-preview
94+
95+ - name : Install cargo-llvm-cov
96+ run : cargo install cargo-llvm-cov
97+
98+ - name : Generate code coverage
99+ run : cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
100+
101+ - name : Upload coverage to Codecov
102+ uses : codecov/codecov-action@v3
103+ with :
104+ files : lcov.info
105+ fail_ci_if_error : true
0 commit comments