Add CI workflow for formatting, lint, tests, and Apple targets
Seto Elkahfi committed
Apr 3, 2026 at 11:26 UTC
be117b5ca4b3b64022cd9a9329fb0c530725b75d
1 file changed
+102
.github/workflows/ci.yml
new
+102
@@ -0,0 +1,102 @@
1
+name: CI
2
+
3
+on:
4
+ push:
5
+ branches: [main, development]
6
+ pull_request:
7
+ branches: [main, development]
8
+ workflow_dispatch:
9
+
10
+concurrency:
11
+ group: ci-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+permissions:
15
+ contents: read
16
+
17
+jobs:
18
+ # ── Formatting ────────────────────────────────────────────────────────────
19
+ fmt:
20
+ name: Format
21
+ runs-on: macos-15
22
+ steps:
23
+ - uses: actions/checkout@v6
24
+ - uses: dtolnay/rust-toolchain@stable
25
+ with:
26
+ components: rustfmt
27
+ - run: cargo fmt --all -- --check
28
+
29
+ # ── Lint ──────────────────────────────────────────────────────────────────
30
+ clippy:
31
+ name: Clippy (macOS)
32
+ runs-on: macos-15
33
+ steps:
34
+ - uses: actions/checkout@v6
35
+ - uses: dtolnay/rust-toolchain@stable
36
+ with:
37
+ components: clippy
38
+ - uses: Swatinem/rust-cache@v2
39
+ - run: cargo clippy --all-targets -- -D warnings
40
+
41
+ # ── Tests (macOS — the only platform where tests run natively) ────────────
42
+ test:
43
+ name: Test (macOS)
44
+ runs-on: macos-15
45
+ steps:
46
+ - uses: actions/checkout@v6
47
+ - uses: dtolnay/rust-toolchain@stable
48
+ - uses: Swatinem/rust-cache@v2
49
+ - run: cargo test --lib
50
+
51
+ # ── Cross-compile checks for all Apple platforms ──────────────────────────
52
+ check-ios:
53
+ name: Check (iOS device)
54
+ runs-on: macos-15
55
+ steps:
56
+ - uses: actions/checkout@v6
57
+ - uses: dtolnay/rust-toolchain@stable
58
+ with:
59
+ targets: aarch64-apple-ios
60
+ - uses: Swatinem/rust-cache@v2
61
+ with:
62
+ key: ios
63
+ - run: cargo check --target aarch64-apple-ios
64
+
65
+ check-ios-sim:
66
+ name: Check (iOS simulator)
67
+ runs-on: macos-15
68
+ steps:
69
+ - uses: actions/checkout@v6
70
+ - uses: dtolnay/rust-toolchain@stable
71
+ with:
72
+ targets: aarch64-apple-ios-sim
73
+ - uses: Swatinem/rust-cache@v2
74
+ with:
75
+ key: ios-sim
76
+ - run: cargo check --target aarch64-apple-ios-sim
77
+
78
+ check-tvos:
79
+ name: Check (tvOS device)
80
+ runs-on: macos-15
81
+ steps:
82
+ - uses: actions/checkout@v6
83
+ - uses: dtolnay/rust-toolchain@nightly
84
+ with:
85
+ components: rust-src
86
+ - uses: Swatinem/rust-cache@v2
87
+ with:
88
+ key: tvos
89
+ - run: cargo +nightly check -Z build-std --target aarch64-apple-tvos
90
+
91
+ check-tvos-sim:
92
+ name: Check (tvOS simulator)
93
+ runs-on: macos-15
94
+ steps:
95
+ - uses: actions/checkout@v6
96
+ - uses: dtolnay/rust-toolchain@nightly
97
+ with:
98
+ components: rust-src
99
+ - uses: Swatinem/rust-cache@v2
100
+ with:
101
+ key: tvos-sim
102
+ - run: cargo +nightly check -Z build-std --target aarch64-apple-tvos-sim