1+ name : Rust CI
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ env :
10+ CARGO_TERM_COLOR : always
11+
12+ jobs :
13+ test :
14+ name : Test
15+ runs-on : ${{ matrix.os }}
16+ strategy :
17+ matrix :
18+ os : [ubuntu-latest, windows-latest, macos-latest]
19+ rust : [stable, beta, nightly]
20+ steps :
21+ - uses : actions/checkout@v4
22+ - name : Install Rust
23+ uses : dtolnay/rust-toolchain@master
24+ with :
25+ toolchain : ${{ matrix.rust }}
26+ - name : Cache cargo registry
27+ uses : actions/cache@v4
28+ with :
29+ path : ~/.cargo/registry
30+ key : ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
31+ - name : Cache cargo index
32+ uses : actions/cache@v4
33+ with :
34+ path : ~/.cargo/git
35+ key : ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
36+ - name : Cache cargo build
37+ uses : actions/cache@v4
38+ with :
39+ path : target
40+ key : ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
41+ - name : Run tests
42+ run : cargo test --verbose
43+ - name : Run tests (release)
44+ run : cargo test --release --verbose
45+
46+ fmt :
47+ name : Rustfmt
48+ runs-on : ubuntu-latest
49+ steps :
50+ - uses : actions/checkout@v4
51+ - name : Install Rust
52+ uses : dtolnay/rust-toolchain@stable
53+ with :
54+ components : rustfmt
55+ - name : Check formatting
56+ run : cargo fmt --all -- --check
57+
58+ format :
59+ name : TOML Check Format
60+ runs-on : ubuntu-latest
61+ steps :
62+ - uses : actions/checkout@v4
63+
64+ - name : Install Taplo CLI
65+ uses : taiki-e/install-action@v2
66+ with :
67+ tool : taplo-cli
68+
69+ - name : Check TOML formatting
70+ run : taplo fmt --check
71+
72+ clippy :
73+ name : Clippy
74+ runs-on : ubuntu-latest
75+ steps :
76+ - uses : actions/checkout@v4
77+ - name : Install Rust
78+ uses : dtolnay/rust-toolchain@stable
79+ with :
80+ components : clippy
81+ - name : Install SQLite
82+ run : sudo apt-get update && sudo apt-get install -y libsqlite3-dev
83+ - name : Run clippy
84+ run : cargo clippy --all-targets --all-features -- -D warnings
85+
86+ doc :
87+ name : Documentation
88+ runs-on : ubuntu-latest
89+ steps :
90+ - uses : actions/checkout@v4
91+ - name : Install Rust
92+ uses : dtolnay/rust-toolchain@stable
93+ - name : Check documentation
94+ run : cargo doc --no-deps --document-private-items
95+ env :
96+ RUSTDOCFLAGS : -D warnings
97+
98+ coverage :
99+ name : Code Coverage
100+ runs-on : ubuntu-latest
101+ steps :
102+ - uses : actions/checkout@v4
103+ - name : Install Rust
104+ uses : dtolnay/rust-toolchain@stable
105+ - name : Install tarpaulin
106+ run : cargo install cargo-tarpaulin
107+ - name : Generate coverage
108+ run : cargo tarpaulin --verbose --engine=llvm --all-features --timeout 120 --out xml -p diesel-builders
109+ - name : Upload coverage to Codecov
110+ uses : codecov/codecov-action@v5
111+ with :
112+ token : ${{ secrets.CODECOV_TOKEN }}
113+ fail_ci_if_error : false
0 commit comments