@@ -3,8 +3,20 @@ name: CI
33on :
44 push :
55 branches : [main]
6+ paths-ignore :
7+ - ' **.md'
8+ - ' docs/**'
9+ - ' LICENSE'
10+ - ' .gitignore'
11+ - ' HomebrewFormula/**'
612 pull_request :
713 branches : [main]
14+ paths-ignore :
15+ - ' **.md'
16+ - ' docs/**'
17+ - ' LICENSE'
18+ - ' .gitignore'
19+ - ' HomebrewFormula/**'
820
921concurrency :
1022 group : ${{ github.workflow }}-${{ github.ref }}
@@ -13,10 +25,12 @@ concurrency:
1325env :
1426 CARGO_TERM_COLOR : always
1527 RUST_BACKTRACE : 1
28+ CARGO_INCREMENTAL : 0
29+ CARGO_NET_RETRY : 10
1630
1731jobs :
1832 # ============================================================
19- # Code Quality
33+ # Code Quality (always runs)
2034 # ============================================================
2135 quality :
2236 name : Quality
2741 with :
2842 components : rustfmt, clippy
2943 - uses : Swatinem/rust-cache@v2
44+ with :
45+ cache-all-crates : true
3046
3147 - name : Format
3248 run : cargo fmt --all --check
3551 run : cargo clippy --all-targets --all-features -- -D clippy::correctness -D clippy::suspicious -W clippy::all
3652
3753 # ============================================================
38- # Security
54+ # Security (always runs)
3955 # ============================================================
4056 security :
4157 name : Security
@@ -44,36 +60,67 @@ jobs:
4460 - uses : actions/checkout@v4
4561 - uses : dtolnay/rust-toolchain@stable
4662 - uses : Swatinem/rust-cache@v2
63+ with :
64+ cache-all-crates : true
65+
66+ - name : Cache security tools
67+ uses : actions/cache@v4
68+ with :
69+ path : |
70+ ~/.cargo/bin/cargo-audit
71+ ~/.cargo/bin/cargo-deny
72+ key : security-tools-${{ runner.os }}
4773
4874 - name : Audit
49- run : cargo install cargo-audit && cargo audit
75+ run : command -v cargo-audit || cargo install cargo-audit && cargo audit
76+ continue-on-error : true # Advisory warnings in transitive deps
5077
5178 - name : Licenses
52- run : cargo install cargo-deny && cargo deny check
79+ run : command -v cargo-deny || cargo install cargo-deny && cargo deny check
5380
5481 # ============================================================
55- # Tests
82+ # Tests - Linux (always runs)
5683 # ============================================================
57- test :
84+ test-linux :
85+ name : Test (Linux)
86+ runs-on : ubuntu-latest
87+ steps :
88+ - uses : actions/checkout@v4
89+ - uses : dtolnay/rust-toolchain@stable
90+ - uses : Swatinem/rust-cache@v2
91+ with :
92+ cache-all-crates : true
93+
94+ - name : Run tests
95+ run : cargo test --all-features --workspace
96+
97+ # ============================================================
98+ # Tests - Cross Platform (PRs only)
99+ # ============================================================
100+ test-cross :
58101 name : Test
102+ if : github.event_name == 'pull_request'
59103 runs-on : ${{ matrix.os }}
60104 strategy :
61105 fail-fast : false
62106 matrix :
63- os : [ubuntu-latest, macos-latest, windows-latest]
107+ os : [macos-latest, windows-latest]
64108 steps :
65109 - uses : actions/checkout@v4
66110 - uses : dtolnay/rust-toolchain@stable
67111 - uses : Swatinem/rust-cache@v2
112+ with :
113+ cache-all-crates : true
68114
69115 - name : Run tests
70116 run : cargo test --all-features --workspace
71117
72118 # ============================================================
73- # Build Verification
119+ # Build Verification (PRs only)
74120 # ============================================================
75121 build :
76122 name : Build
123+ if : github.event_name == 'pull_request'
77124 runs-on : ${{ matrix.os }}
78125 strategy :
79126 fail-fast : false
89136 targets : ${{ matrix.target }}
90137 - uses : Swatinem/rust-cache@v2
91138 with :
92- key : ${{ matrix.target }}
139+ key : build-${{ matrix.target }}
140+ cache-all-crates : true
93141
94142 - name : Build
95143 run : cargo build --release --target ${{ matrix.target }}
0 commit comments