This repository was archived by the owner on Apr 13, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
231 lines (195 loc) · 6.61 KB
/
Copy pathci.yml
File metadata and controls
231 lines (195 loc) · 6.61 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
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
env:
CARGO_TERM_COLOR: never
TERM: dumb
jobs:
# Check PR titles follow conventional commits
semantic-pr:
if: github.event_name == 'pull_request'
name: Semantic PR Title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
fix
docs
style
refactor
perf
test
build
ci
chore
requireScope: false
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
doesn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character.
# Python removal safety check
python-safety-check:
name: Python Removal Safety Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Python removal safety checks
shell: bash
run: set -euo pipefail; bash ./scripts/verify_removals.sh
# Linting job
lint:
name: Lint
runs-on: ubuntu-latest
needs: python-safety-check
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
key: lint-${{ hashFiles('**/Cargo.toml') }}
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Run security audit
run: cargo audit
# Testing and coverage job
test-and-coverage:
name: Test and Coverage
runs-on: ubuntu-latest
needs: python-safety-check
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
key: test-${{ hashFiles('**/Cargo.toml') }}
- name: Run tests with coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info --fail-under-lines 80
env:
CARGO_TERM_COLOR: never
TERM: dumb
- name: Generate HTML coverage report
run: cargo llvm-cov --all-features --workspace --html
env:
CARGO_TERM_COLOR: never
TERM: dumb
- name: Generate documentation
run: cargo doc --no-deps --all-features --workspace
env:
CARGO_TERM_COLOR: never
TERM: dumb
- name: Upload lcov.info as artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: lcov-report
path: lcov.info
retention-days: 30
- name: Upload HTML coverage report as artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: html-coverage-report
path: target/llvm-cov/html/
retention-days: 30
- name: Upload documentation as artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: rust-documentation
path: target/doc/
retention-days: 30
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: always()
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: lcov.info
flags: rust
name: rust-coverage
fail_ci_if_error: false
# Benchmarking job
benches:
name: Benchmarks
runs-on: ubuntu-latest
needs: python-safety-check
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
key: bench-${{ hashFiles('**/Cargo.toml') }}
- name: Run benchmarks
run: cargo bench
env:
CARGO_TERM_COLOR: never
TERM: dumb
# Note: Benchmark comparison removed due to cargo bench compatibility issues
# For PR benchmark comparison, use the HTML reports in artifacts
- name: Track benchmark performance (main/develop)
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')
uses: rhysd/github-action-benchmark@v1
with:
tool: "criterion"
output-file-path: "target/criterion/*/base/estimates.json"
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
comment-on-alert: true
alert-threshold: "150%"
fail-on-alert: false
max-items-in-chart: 100
- name: Upload Criterion HTML reports as artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: criterion-html-reports-${{ github.sha }}
path: target/criterion/
retention-days: 30
if-no-files-found: warn
- name: Comment on PR with benchmark results
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const comment = `## Benchmark Results
Benchmarks completed for commit \`${{ github.sha }}\`.
**Detailed HTML Reports**: Download the [criterion-html-reports-${{ github.sha }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) artifact and open \`target/criterion/report/index.html\` in your browser.
**Performance Analysis**: Review the HTML reports to compare performance with previous runs. The reports include statistical analysis and performance trends.
> **Note**: Artifacts are available for 30 days. For detailed performance comparison, download the HTML reports and review the statistical analysis.`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});