-
-
Notifications
You must be signed in to change notification settings - Fork 12
272 lines (235 loc) · 8.86 KB
/
ci.yml
File metadata and controls
272 lines (235 loc) · 8.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
name: CI
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
check:
name: Check (${{ matrix.target }}, ${{ matrix.features_label }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
# ── Native Linux x86_64 ──────────────────────────────────
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
features: ""
features_label: default
use_cross: false
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
features: "--no-default-features"
features_label: no-default
use_cross: false
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
features: "--features full"
features_label: full
use_cross: false
# ── ARM64 (Raspberry Pi 3/4/5 64-bit) ───────────────────
- target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
features: "--no-default-features"
features_label: no-default
use_cross: true
- target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
features: "--no-default-features --features web-tools"
features_label: web-tools
use_cross: true
# ── ARMv7 (Raspberry Pi 2/3 32-bit) ─────────────────────
- target: armv7-unknown-linux-gnueabihf
runner: ubuntu-latest
features: "--no-default-features"
features_label: no-default
use_cross: true
# ── macOS x86_64 ─────────────────────────────────────────
- target: x86_64-apple-darwin
runner: macos-latest
features: ""
features_label: default
use_cross: false
# ── macOS Apple Silicon ──────────────────────────────────
- target: aarch64-apple-darwin
runner: macos-latest
features: ""
features_label: default
use_cross: false
# ── Windows x86_64 ───────────────────────────────────────
- target: x86_64-pc-windows-msvc
runner: windows-latest
features: ""
features_label: default
use_cross: false
- target: x86_64-pc-windows-msvc
runner: windows-latest
features: "--no-default-features"
features_label: no-default
use_cross: false
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.use_cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Check (Unix)
if: runner.os != 'Windows'
run: |
if [ "${{ matrix.use_cross }}" = "true" ]; then
cross check --target ${{ matrix.target }} ${{ matrix.features }}
else
cargo check --target ${{ matrix.target }} ${{ matrix.features }}
fi
- name: Check (Windows)
if: runner.os == 'Windows'
run: cargo check --target ${{ matrix.target }} ${{ matrix.features }}
test:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Run unit tests (default features)
run: cargo test --lib --bins
- name: Run unit tests (no default features)
run: cargo test --lib --bins --no-default-features
- name: Run doc tests
run: cargo test --doc
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
needs: [check]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build debug binary
run: cargo build
- name: Run integration tests
run: cargo test --test '*' -- --ignored --test-threads=1
env:
RUSTYCLAW_TEST_MODE: "1"
continue-on-error: true # Some integration tests may require external services
e2e-tests:
name: E2E Tests
runs-on: ubuntu-latest
needs: [check, test]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build release binary
run: cargo build --release
- name: Run E2E tests (basic)
run: |
# Run basic CLI E2E tests
./target/release/rustyclaw --version
./target/release/rustyclaw --help
./target/release/rustyclaw gateway --help
- name: Run E2E test suite
run: cargo test --test e2e -- --ignored --test-threads=1
env:
RUSTYCLAW_TEST_MODE: "1"
continue-on-error: true
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
continue-on-error: true # Treat as advisory for now
- name: Run Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
continue-on-error: true # Treat as advisory for now
security-audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rustsec/audit-check@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
build-release:
name: Build (${{ matrix.target }})
if: startsWith(github.ref, 'refs/tags/v')
needs: [check, test, integration-tests]
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
features: ""
use_cross: false
- target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
features: "--no-default-features --features web-tools"
use_cross: true
- target: armv7-unknown-linux-gnueabihf
runner: ubuntu-latest
features: "--no-default-features --features web-tools"
use_cross: true
- target: x86_64-apple-darwin
runner: macos-latest
features: ""
use_cross: false
- target: aarch64-apple-darwin
runner: macos-latest
features: ""
use_cross: false
- target: x86_64-pc-windows-msvc
runner: windows-latest
features: ""
use_cross: false
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.use_cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build release (Unix)
if: runner.os != 'Windows'
run: |
if [ "${{ matrix.use_cross }}" = "true" ]; then
cross build --release --target ${{ matrix.target }} ${{ matrix.features }}
else
cargo build --release --target ${{ matrix.target }} ${{ matrix.features }}
fi
- name: Build release (Windows)
if: runner.os == 'Windows'
run: cargo build --release --target ${{ matrix.target }} ${{ matrix.features }}
- name: Package binaries (Unix)
if: runner.os != 'Windows'
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/rustyclaw dist/rustyclaw-${{ matrix.target }} 2>/dev/null || true
cp target/${{ matrix.target }}/release/rustyclaw-gateway dist/rustyclaw-gateway-${{ matrix.target }} 2>/dev/null || true
- name: Package binaries (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path dist
Copy-Item "target/${{ matrix.target }}/release/rustyclaw.exe" "dist/rustyclaw-${{ matrix.target }}.exe" -ErrorAction SilentlyContinue
Copy-Item "target/${{ matrix.target }}/release/rustyclaw-gateway.exe" "dist/rustyclaw-gateway-${{ matrix.target }}.exe" -ErrorAction SilentlyContinue
- uses: actions/upload-artifact@v4
with:
name: rustyclaw-${{ matrix.target }}
path: dist/