1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ main, develop ]
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 : ubuntu-latest
16+ strategy :
17+ matrix :
18+ rust : [stable, beta, nightly]
19+
20+ steps :
21+ - uses : actions/checkout@v4
22+
23+ - name : Install Rust
24+ uses : dtolnay/rust-toolchain@master
25+ with :
26+ toolchain : ${{ matrix.rust }}
27+ components : rustfmt, clippy
28+
29+ - name : Cache cargo registry
30+ uses : actions/cache@v3
31+ with :
32+ path : ~/.cargo/registry
33+ key : ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
34+
35+ - name : Cache cargo index
36+ uses : actions/cache@v3
37+ with :
38+ path : ~/.cargo/git
39+ key : ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
40+
41+ - name : Cache cargo build
42+ uses : actions/cache@v3
43+ with :
44+ path : target
45+ key : ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
46+
47+ - name : Check formatting
48+ run : cargo fmt -- --check
49+
50+ - name : Run clippy
51+ run : cargo clippy -- -D warnings
52+
53+ - name : Run tests
54+ run : cargo test --verbose
55+
56+ coverage :
57+ name : Coverage
58+ runs-on : ubuntu-latest
59+
60+ steps :
61+ - uses : actions/checkout@v4
62+
63+ - name : Install Rust
64+ uses : dtolnay/rust-toolchain@stable
65+
66+ - name : Install tarpaulin
67+ run : cargo install cargo-tarpaulin
68+
69+ - name : Generate coverage report
70+ run : cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out xml
71+
72+ - name : Upload to codecov.io
73+ uses : codecov/codecov-action@v3
74+ with :
75+ fail_ci_if_error : true
76+
77+ security :
78+ name : Security audit
79+ runs-on : ubuntu-latest
80+
81+ steps :
82+ - uses : actions/checkout@v4
83+
84+ - name : Install Rust
85+ uses : dtolnay/rust-toolchain@stable
86+
87+ - name : Install cargo-audit
88+ run : cargo install cargo-audit
89+
90+ - name : Run security audit
91+ run : cargo audit
92+
93+ build :
94+ name : Build
95+ runs-on : ${{ matrix.os }}
96+ strategy :
97+ matrix :
98+ os : [ubuntu-latest, windows-latest, macos-latest]
99+
100+ steps :
101+ - uses : actions/checkout@v4
102+
103+ - name : Install Rust
104+ uses : dtolnay/rust-toolchain@stable
105+
106+ - name : Build
107+ run : cargo build --release --verbose
108+
109+ - name : Upload artifacts
110+ uses : actions/upload-artifact@v3
111+ with :
112+ name : rust-yt-upload-${{ matrix.os }}
113+ path : |
114+ target/release/rust-yt-upload*
115+ !target/release/rust-yt-upload.d
0 commit comments