-
Notifications
You must be signed in to change notification settings - Fork 2
276 lines (234 loc) · 7.24 KB
/
ci.yml
File metadata and controls
276 lines (234 loc) · 7.24 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
273
274
275
276
name: CI
on:
push:
branches: [master, main, develop]
pull_request:
branches: [master, main, develop]
schedule:
# Weekly security audit on Sundays at midnight
- cron: "0 0 * * 0"
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
# Don't use RUSTFLAGS=-D warnings, use workspace lints configuration instead
RUSTUP_MAX_RETRIES: 10
# Cancel previous runs on new push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Quick checks first - fail fast strategy
check:
name: Check
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Install Rust nightly (for rustfmt)
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "check"
save-if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
- name: Check formatting (nightly)
run: cargo +nightly fmt --all -- --check
- name: Clippy (all targets, all features)
run: cargo +stable clippy --all-targets --all-features --workspace
- name: Check documentation
run: cargo +stable doc --no-deps --all-features --workspace
env:
RUSTDOCFLAGS: "-D warnings"
# Security audit using cargo-deny
security:
name: Security Audit
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Run cargo-deny (advisories, licenses, bans, sources)
uses: EmbarkStudios/cargo-deny-action@v2
with:
log-level: warn
command: check
arguments: --all-features
command-arguments: advisories licenses bans sources
# Cross-platform tests with matrix
test:
name: Test (${{ matrix.os }}, Rust ${{ matrix.rust }})
needs: [check]
runs-on: ${{ matrix.os }}
timeout-minutes: 45
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [stable]
include:
# Test on beta channel on Linux only
- os: ubuntu-latest
rust: beta
steps:
- uses: actions/checkout@v6
- name: Install Rust ${{ matrix.rust }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "test-${{ matrix.os }}-${{ matrix.rust }}"
save-if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
- name: Install nextest
uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Build (all targets, all features)
run: cargo build --all-targets --all-features --workspace
- name: Run tests (nextest)
run: cargo nextest run --all-features --workspace --no-fail-fast
- name: Run doctests
run: cargo test --doc --all-features --workspace
# Code coverage (Linux only for speed)
coverage:
name: Code Coverage
needs: [check]
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
actions: write # For uploading artifacts
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- name: Install nextest
uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "coverage"
save-if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
- name: Generate coverage (nextest)
run: |
cargo llvm-cov --all-features --workspace --lcov \
--output-path lcov.info nextest
- name: Upload to codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: false
verbose: true
flags: unittests
name: codecov-umbrella
- name: Archive coverage report
uses: actions/upload-artifact@v6
with:
name: coverage-report
path: lcov.info
retention-days: 30
# MSRV check (Minimum Supported Rust Version)
msrv:
name: Check MSRV (1.89)
needs: [check]
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Install Rust 1.89
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.89"
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "msrv"
- name: Check with MSRV
run: cargo check --all-features --workspace
# Benchmarks (build only, don't run in CI)
benchmark:
name: Benchmark Build
needs: [check]
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "bench"
- name: Build benchmarks (no run)
run: cargo bench --no-run --profile bench-fast --workspace
# Release build check
release:
name: Release Build
needs: [test]
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "release"
- name: Build release
run: cargo build --release --all-features --workspace
- name: Check binary sizes
run: |
echo "Binary sizes:"
ls -lh target/release/ | grep -E "(mcp-execution-cli|mcp-examples)" || true
echo ""
echo "Target directory size:"
du -sh target/release/
# All checks passed
ci-success:
name: CI Success
needs: [check, security, test, coverage, msrv, benchmark]
runs-on: ubuntu-latest
if: always()
permissions:
contents: read
steps:
- name: Check all jobs
run: |
if [[ "${{ needs.check.result }}" != "success" ]] || \
[[ "${{ needs.security.result }}" != "success" ]] || \
[[ "${{ needs.test.result }}" != "success" ]] || \
[[ "${{ needs.coverage.result }}" != "success" ]] || \
[[ "${{ needs.msrv.result }}" != "success" ]] || \
[[ "${{ needs.benchmark.result }}" != "success" ]]; then
echo "One or more required jobs failed or were cancelled"
exit 1
fi
echo "All required jobs passed successfully!"