Skip to content

Commit 71bbcfb

Browse files
authored
refactor: split CI into reusable workflows (#1)
* refactor: split CI into reusable workflows - verify.yml: fmt and clippy checks - test.yml: cargo test on Linux/macOS/Windows - build.yml: release build with artifact upload - main.yml: orchestrator with dependencies Flow: verify -> test -> build * refactor: use rust containers, rename to Main, fix fmt - Use rust:1.75-slim container for Ubuntu jobs (lighter) - Keep dtolnay/rust-toolchain for macOS/Windows - Rename workflow from CI to Main - Fix cargo fmt in tests/error_handling.rs * refactor: use dedicated jobs per OS instead of matrix - test.yml: explicit test-linux, test-macos, test-windows jobs - build.yml: explicit build-linux, build-macos, build-windows jobs - Remove matrix strategy and OS conditionals - Cleaner, easier to maintain * style: capitalize workflow and job names - Verify / Format, Verify / Clippy - Test / Linux, Test / macOS, Test / Windows - Build / Linux, Build / macOS, Build / Windows * refactor: lowercase job names, capitalize workflow names Job names: linux, macos, windows (under their workflows) Workflow names: Verify, Test, Build (in main.yml) * chore: trigger CI
1 parent 789f5ce commit 71bbcfb

6 files changed

Lines changed: 125 additions & 68 deletions

File tree

.github/workflows/build.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build
2+
3+
on:
4+
workflow_call:
5+
6+
env:
7+
CARGO_TERM_COLOR: always
8+
9+
jobs:
10+
linux:
11+
name: Linux
12+
runs-on: ubuntu-latest
13+
container: rust:1.75-slim
14+
steps:
15+
- uses: actions/checkout@v4
16+
- run: apt-get update && apt-get install -y pkg-config libssl-dev
17+
- run: cargo build --release
18+
- uses: actions/upload-artifact@v4
19+
with:
20+
name: gitclaw-linux
21+
path: target/release/gitclaw
22+
23+
macos:
24+
name: macOS
25+
runs-on: macos-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: dtolnay/rust-toolchain@1.75
29+
- run: cargo build --release
30+
- uses: actions/upload-artifact@v4
31+
with:
32+
name: gitclaw-macos
33+
path: target/release/gitclaw
34+
35+
windows:
36+
name: Windows
37+
runs-on: windows-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
- uses: dtolnay/rust-toolchain@1.75
41+
- run: cargo build --release
42+
- uses: actions/upload-artifact@v4
43+
with:
44+
name: gitclaw-windows
45+
path: target/release/gitclaw.exe

.github/workflows/ci.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
jobs:
10+
Verify:
11+
uses: ./.github/workflows/verify.yml
12+
13+
Test:
14+
needs: Verify
15+
uses: ./.github/workflows/test.yml
16+
17+
Build:
18+
needs: Test
19+
uses: ./.github/workflows/build.yml

.github/workflows/test.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Test
2+
3+
on:
4+
workflow_call:
5+
6+
env:
7+
CARGO_TERM_COLOR: always
8+
9+
jobs:
10+
linux:
11+
name: Linux
12+
runs-on: ubuntu-latest
13+
container: rust:1.75-slim
14+
steps:
15+
- uses: actions/checkout@v4
16+
- run: apt-get update && apt-get install -y pkg-config libssl-dev
17+
- run: cargo test
18+
19+
macos:
20+
name: macOS
21+
runs-on: macos-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: dtolnay/rust-toolchain@1.75
25+
- run: cargo test
26+
27+
windows:
28+
name: Windows
29+
runs-on: windows-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: dtolnay/rust-toolchain@1.75
33+
- run: cargo test

.github/workflows/verify.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Verify
2+
3+
on:
4+
workflow_call:
5+
6+
env:
7+
CARGO_TERM_COLOR: always
8+
9+
jobs:
10+
Format:
11+
name: Format
12+
runs-on: ubuntu-latest
13+
container: rust:1.75-slim
14+
steps:
15+
- uses: actions/checkout@v4
16+
- run: rustup component add rustfmt
17+
- run: cargo fmt --check
18+
19+
Clippy:
20+
name: Clippy
21+
runs-on: ubuntu-latest
22+
container: rust:1.75-slim
23+
steps:
24+
- uses: actions/checkout@v4
25+
- run: apt-get update && apt-get install -y pkg-config libssl-dev
26+
- run: rustup component add clippy
27+
- run: cargo clippy -- -D warnings

tests/error_handling.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn test_find_matching_asset_empty_assets() {
109109
/// Test asset matching with only checksum files
110110
#[test]
111111
fn test_find_matching_asset_only_checksums() {
112-
use gitclaw::github::{Asset, find_matching_asset, Platform, Release};
112+
use gitclaw::github::{find_matching_asset, Asset, Platform, Release};
113113

114114
let release = Release {
115115
tag_name: "v1.0.0".to_string(),

0 commit comments

Comments
 (0)