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
# ═══════════════════════════════════════════════════════════════════════════════
# CI/CD Pipeline for graph_d - Optimized for Speed
# ═══════════════════════════════════════════════════════════════════════════════
# Satisfies: RT-4 (Code quality MUST be continuously validated)
# Satisfies: RT-10 (CI validates all platforms and security)
# Satisfies: RT-3 (Conventional commit validation)
# Satisfies: O3 (CI/CD pipeline with automated testing)
# ═══════════════════════════════════════════════════════════════════════════════
name: CI
on:
push:
branches:
pull_request:
branches:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# Speed up cargo
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
jobs:
# ═══════════════════════════════════════════════════════════════════════════════
# Fast Quality Gates - Run in parallel, no dependencies
# ═══════════════════════════════════════════════════════════════════════════════
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- run: cargo clippy --all-targets --all-features -- -D warnings
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: -D warnings
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Use cached binary install instead of cargo install
- uses: taiki-e/install-action@v2
with:
tool: cargo-audit
- run: cargo audit
# ═══════════════════════════════════════════════════════════════════════════════
# Cross-Platform Tests - Run in parallel
# ═══════════════════════════════════════════════════════════════════════════════
test:
name: Test (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
include:
# Ubuntu - fastest, run full tests
- os: ubuntu-latest
run-doc-tests: true
# macOS - medium speed
- os: macos-latest
run-doc-tests: false
# Windows - slowest, skip doc tests to save time
- os: windows-latest
run-doc-tests: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
# Separate cache per OS for better hit rate
prefix-key: "v1-rust"
- name: Run tests
run: cargo test --all-features
- name: Run doc tests
if: matrix.run-doc-tests
run: cargo test --doc
# ═══════════════════════════════════════════════════════════════════════════════
# MSRV - Check only, skip full tests for speed
# ═══════════════════════════════════════════════════════════════════════════════
msrv:
name: MSRV (1.92)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.92.0
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v1-msrv"
# Just check compilation, skip tests for speed
- run: cargo check --all-features
# ═══════════════════════════════════════════════════════════════════════════════
# Commit Lint - Only on PRs
# ═══════════════════════════════════════════════════════════════════════════════
commitlint:
name: Commit Lint
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm install -g @commitlint/cli @commitlint/config-conventional
- run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
# ═══════════════════════════════════════════════════════════════════════════════
# Code Coverage - Only on Ubuntu, uses cached tool
# ═══════════════════════════════════════════════════════════════════════════════
coverage:
name: Code Coverage
runs-on: ubuntu-latest
needs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
# Use cached binary install
- uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- run: cargo llvm-cov --all-features --lcov --output-path lcov.info
- uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: false
# ═══════════════════════════════════════════════════════════════════════════════
# Memory Limits Validation - GAP-6
# Satisfies: B3 (≤1GB memory for 1M docs), RT-5 (Memory within bounds)
# ═══════════════════════════════════════════════════════════════════════════════
memory-check:
name: Memory Limits
runs-on: ubuntu-latest
needs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Run memory limit tests
# Satisfies: RT-5 (Memory usage MUST stay within bounds)
run: |
cargo test --release --test memory_limits -- --nocapture 2>&1 | tee memory_check.txt || true
echo "Memory limit tests completed"
- name: Check memory constraints
run: |
# Verify memory usage is within bounds
if grep -q "MEMORY_LIMIT_EXCEEDED" memory_check.txt; then
echo "❌ Memory limit exceeded!"
exit 1
fi
echo "✅ Memory usage within bounds"
- name: Upload memory report
uses: actions/upload-artifact@v4
with:
name: memory-report
path: memory_check.txt
retention-days: 7
# ═══════════════════════════════════════════════════════════════════════════════
# CI Summary - Fast check that all required jobs passed
# ═══════════════════════════════════════════════════════════════════════════════
ci-success:
name: CI Success
needs:
runs-on: ubuntu-latest
if: always()
steps:
- name: Check all jobs
run: |
if [[ "${{ needs.fmt.result }}" != "success" ]] || \
[[ "${{ needs.clippy.result }}" != "success" ]] || \
[[ "${{ needs.test.result }}" != "success" ]] || \
[[ "${{ needs.msrv.result }}" != "success" ]] || \
[[ "${{ needs.docs.result }}" != "success" ]] || \
[[ "${{ needs.security.result }}" != "success" ]]; then
echo "One or more jobs failed"
exit 1
fi
echo "✅ All CI checks passed!"