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+ format :
14+ name : Format Check
15+ runs-on : ubuntu-latest
16+ steps :
17+ - uses : actions/checkout@v4
18+
19+ - name : Install Rust toolchain
20+ uses : dtolnay/rust-toolchain@stable
21+ with :
22+ components : rustfmt
23+
24+ - name : Check formatting
25+ run : cargo fmt --all -- --check
26+
27+ clippy :
28+ name : Clippy Lint
29+ runs-on : ubuntu-latest
30+ steps :
31+ - uses : actions/checkout@v4
32+
33+ - name : Install Rust toolchain
34+ uses : dtolnay/rust-toolchain@stable
35+ with :
36+ components : clippy
37+
38+ - name : Cache cargo registry
39+ uses : actions/cache@v4
40+ with :
41+ path : |
42+ ~/.cargo/registry
43+ ~/.cargo/git
44+ target
45+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
46+ restore-keys : |
47+ ${{ runner.os }}-cargo-
48+
49+ - name : Run clippy
50+ run : cargo clippy --all-targets --all-features -- -D warnings
51+
52+ test :
53+ name : Test Suite
54+ runs-on : ubuntu-latest
55+ steps :
56+ - uses : actions/checkout@v4
57+
58+ - name : Install Rust toolchain
59+ uses : dtolnay/rust-toolchain@stable
60+
61+ - name : Cache cargo registry
62+ uses : actions/cache@v4
63+ with :
64+ path : |
65+ ~/.cargo/registry
66+ ~/.cargo/git
67+ target
68+ key : ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
69+ restore-keys : |
70+ ${{ runner.os }}-cargo-test-
71+ ${{ runner.os }}-cargo-
72+
73+ - name : Run tests
74+ run : cargo test --all --verbose
75+
76+ build :
77+ name : Build Check
78+ runs-on : ubuntu-latest
79+ steps :
80+ - uses : actions/checkout@v4
81+
82+ - name : Install Rust toolchain
83+ uses : dtolnay/rust-toolchain@stable
84+
85+ - name : Cache cargo registry
86+ uses : actions/cache@v4
87+ with :
88+ path : |
89+ ~/.cargo/registry
90+ ~/.cargo/git
91+ target
92+ key : ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
93+ restore-keys : |
94+ ${{ runner.os }}-cargo-build-
95+ ${{ runner.os }}-cargo-
96+
97+ - name : Build all crates
98+ run : cargo build --all --verbose
99+
100+ wasm-check :
101+ name : WASM Compatibility Check
102+ runs-on : ubuntu-latest
103+ steps :
104+ - uses : actions/checkout@v4
105+
106+ - name : Install Rust toolchain
107+ uses : dtolnay/rust-toolchain@stable
108+ with :
109+ targets : wasm32-unknown-unknown
110+
111+ - name : Cache cargo registry
112+ uses : actions/cache@v4
113+ with :
114+ path : |
115+ ~/.cargo/registry
116+ ~/.cargo/git
117+ target
118+ key : ${{ runner.os }}-cargo-wasm-${{ hashFiles('**/Cargo.lock') }}
119+ restore-keys : |
120+ ${{ runner.os }}-cargo-wasm-
121+ ${{ runner.os }}-cargo-
122+
123+ - name : Build for WASM target
124+ run : cargo build --all --target wasm32-unknown-unknown --verbose
125+
126+ # Combined status check job
127+ ci-success :
128+ name : CI Success
129+ runs-on : ubuntu-latest
130+ needs : [format, clippy, test, build, wasm-check]
131+ if : always()
132+ steps :
133+ - name : Check all jobs
134+ run : |
135+ if [[ "${{ needs.format.result }}" != "success" || \
136+ "${{ needs.clippy.result }}" != "success" || \
137+ "${{ needs.test.result }}" != "success" || \
138+ "${{ needs.build.result }}" != "success" || \
139+ "${{ needs.wasm-check.result }}" != "success" ]]; then
140+ echo "One or more CI jobs failed"
141+ exit 1
142+ fi
143+ echo "All CI jobs passed successfully"
0 commit comments