@@ -3,13 +3,25 @@ name: CI
33on :
44 workflow_dispatch :
55 push :
6- branches : [master]
6+ branches : [master, dev]
7+ paths-ignore :
8+ - ' **.md'
9+ - ' LICENSE'
10+ - ' assets/**'
711 pull_request :
8- branches : [master]
12+ branches : [master, dev]
13+ paths-ignore :
14+ - ' **.md'
15+ - ' LICENSE'
16+ - ' assets/**'
917
1018env :
1119 CARGO_TERM_COLOR : always
1220
21+ concurrency :
22+ group : ${{ github.workflow }}-${{ github.ref }}
23+ cancel-in-progress : true
24+
1325jobs :
1426 hygiene :
1527 name : Hygiene
@@ -28,17 +40,18 @@ jobs:
2840 runs-on : ${{ matrix.os }}
2941 strategy :
3042 matrix :
31- os : [ubuntu-latest, macos-latest, windows-latest]
32- rust : [stable]
33-
43+ # Full cross-platform matrix only when promoting dev -> master;
44+ # everything else runs on Linux to keep billable minutes down
45+ # (macOS minutes bill at 10x, Windows at 2x).
46+ os : ${{ (github.event_name == 'pull_request' && github.base_ref == 'master') && fromJSON('["ubuntu-latest", "macos-latest", "windows-latest"]') || fromJSON('["ubuntu-latest"]') }}
47+
3448 steps :
3549 - name : Checkout code
3650 uses : actions/checkout@v4
3751
3852 - name : Install Rust toolchain
3953 uses : dtolnay/rust-toolchain@stable
4054 with :
41- toolchain : ${{ matrix.rust }}
4255 components : rustfmt, clippy
4356
4457 - name : Install Linux dependencies (GUI + audio)
@@ -72,184 +85,32 @@ jobs:
7285 path : target
7386 key : ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
7487
75- - name : Run cargo check
76- run : cargo check --verbose
77-
7888 - name : Run cargo fmt check
89+ if : runner.os == 'Linux'
7990 run : cargo fmt --all -- --check
8091
81- - name : Run cargo clippy
92+ # Compiling the full GUI stack (iced/wgpu) is expensive; lint it on
93+ # Linux only. Release builds still compile gui on every platform.
94+ - name : Run cargo clippy (all features)
95+ if : runner.os == 'Linux'
8296 run : cargo clippy --all-targets --all-features -- -D warnings
8397
98+ - name : Run cargo clippy
99+ if : runner.os != 'Linux'
100+ run : cargo clippy --all-targets -- -D warnings
101+
84102 - name : Run cargo test
85103 run : cargo test --verbose
86104
87- build :
88- name : Build Release
89- needs : hygiene
90- runs-on : ${{ matrix.os }}
91- strategy :
92- matrix :
93- os : [ubuntu-latest, macos-latest, windows-latest]
94- include :
95- - os : ubuntu-latest
96- artifact_name : tslime
97- asset_name : tslime-linux-x86_64
98- - os : macos-latest
99- artifact_name : tslime
100- asset_name : tslime-macos-x86_64
101- - os : windows-latest
102- artifact_name : tslime.exe
103- asset_name : tslime-windows-x86_64.exe
104-
105- steps :
106- - name : Checkout code
107- uses : actions/checkout@v4
108-
109- - name : Install Rust toolchain
110- uses : dtolnay/rust-toolchain@stable
111-
112- - name : Cache cargo registry
113- uses : actions/cache@v4
114- with :
115- path : ~/.cargo/registry
116- key : ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
117-
118- - name : Cache cargo index
119- uses : actions/cache@v4
120- with :
121- path : ~/.cargo/git
122- key : ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
123-
124- - name : Cache cargo build
125- uses : actions/cache@v4
126- with :
127- path : target
128- key : ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
129-
130- - name : Build release binary
131- run : cargo build --release --verbose
132-
133- - name : Upload artifact
134- uses : actions/upload-artifact@v4
135- with :
136- name : ${{ matrix.asset_name }}
137- path : target/release/${{ matrix.artifact_name }}
138-
139- gui-build :
140- name : GUI Build
141- needs : hygiene
142- runs-on : ${{ matrix.os }}
143- strategy :
144- matrix :
145- os : [ubuntu-latest, macos-latest, windows-latest]
146- include :
147- - os : ubuntu-latest
148- artifact_name : tslime
149- asset_name : tslime-gui-linux-x86_64
150- - os : macos-latest
151- artifact_name : tslime
152- asset_name : tslime-gui-macos
153- - os : windows-latest
154- artifact_name : tslime.exe
155- asset_name : tslime-gui-windows.exe
156-
157- steps :
158- - name : Checkout code
159- uses : actions/checkout@v4
160-
161- - name : Install Rust toolchain
162- uses : dtolnay/rust-toolchain@stable
163-
164- - name : Install Linux GUI dependencies
165- if : runner.os == 'Linux'
166- run : |
167- sudo apt-get update -qq
168- sudo apt-get install -y --no-install-recommends \
169- libxkbcommon-dev \
170- libwayland-dev \
171- libx11-dev libxcursor-dev libxrandr-dev libxi-dev \
172- libvulkan-dev mesa-vulkan-drivers \
173- libfontconfig1-dev libfreetype6-dev \
174- libegl1-mesa-dev
175-
176- - name : Cache cargo registry
177- uses : actions/cache@v4
178- with :
179- path : ~/.cargo/registry
180- key : ${{ runner.os }}-cargo-registry-gui-${{ hashFiles('**/Cargo.lock') }}
181-
182- - name : Cache cargo index
183- uses : actions/cache@v4
184- with :
185- path : ~/.cargo/git
186- key : ${{ runner.os }}-cargo-index-gui-${{ hashFiles('**/Cargo.lock') }}
187-
188- - name : Cache cargo build
189- uses : actions/cache@v4
190- with :
191- path : target
192- key : ${{ runner.os }}-cargo-build-gui-${{ hashFiles('**/Cargo.lock') }}
193-
194- - name : Build GUI binary
195- run : cargo build --release --features gui --verbose
196-
197- - name : Upload artifact
198- uses : actions/upload-artifact@v4
199- with :
200- name : ${{ matrix.asset_name }}
201- path : target/release/${{ matrix.artifact_name }}
202-
203- benchmarks :
204- name : Benchmarks
105+ licenses :
106+ name : License Check
205107 needs : hygiene
206108 runs-on : ubuntu-latest
207109 steps :
208110 - name : Checkout code
209111 uses : actions/checkout@v4
210112
211- - name : Install Rust toolchain
212- uses : dtolnay/rust-toolchain@stable
213-
214- - name : Cache cargo registry
215- uses : actions/cache@v4
216- with :
217- path : ~/.cargo/registry
218- key : ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
219-
220- - name : Cache cargo index
221- uses : actions/cache@v4
222- with :
223- path : ~/.cargo/git
224- key : ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
225-
226- - name : Cache cargo build
227- uses : actions/cache@v4
113+ - name : Check dependency licenses
114+ uses : EmbarkStudios/cargo-deny-action@v2
228115 with :
229- path : target
230- key : ${{ runner.os }}-cargo-build-bench-${{ hashFiles('**/Cargo.lock') }}
231-
232- - name : Run benchmarks
233- run : cargo bench --verbose
234-
235- - name : Upload benchmark results
236- uses : actions/upload-artifact@v4
237- with :
238- name : benchmarks
239- path : target/criterion/
240-
241- - name : Check binary size
242- run : |
243- # cargo bench leaves a bench-profile binary (no strip/LTO) in
244- # target/release; build the real release binary before measuring.
245- cargo build --release
246- size target/release/tslime
247- SIZE=$(stat -c%s target/release/tslime)
248- # Headroom over the ~3.1MB Linux release binary; this artifact is a
249- # smoke check, not the shipped binary, so the bound is intentionally loose.
250- MAX_SIZE=4000000
251- if [ $SIZE -gt $MAX_SIZE ]; then
252- echo "Binary size $SIZE exceeds $MAX_SIZE limit"
253- exit 1
254- fi
255- echo "Binary size $SIZE is under $MAX_SIZE limit"
116+ command : check licenses
0 commit comments