-
-
Notifications
You must be signed in to change notification settings - Fork 0
269 lines (208 loc) · 6.61 KB
/
ci.yml
File metadata and controls
269 lines (208 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
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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
test:
name: Test
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build workspace
run: cargo build --workspace --all-features
- name: Run tests
run: cargo test --workspace --all-features
lint:
name: Lint
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --workspace --all-features -- -D warnings
docs:
name: Documentation
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build docs
run: cargo doc --workspace --no-deps --all-features
env:
RUSTDOCFLAGS: -D warnings
msrv:
name: MSRV (1.88)
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install Rust 1.88
uses: dtolnay/rust-toolchain@1.88
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --workspace --all-features
wasm:
name: WASM Build
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build cdx-core for WASM
run: cargo build -p cdx-core --target wasm32-unknown-unknown --features wasm --no-default-features
cli-tests:
name: CLI Integration Tests
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build CLI
run: cargo build -p cdx-cli --release
- name: Run CLI tests
run: cargo test -p cdx-cli
coverage:
name: Coverage
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin
- name: Generate coverage
run: cargo tarpaulin --workspace --all-features --out xml --timeout 180
continue-on-error: true
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
files: cobertura.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
swift-bridge:
name: Swift Bridge
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: cdx-swift-bridge -> cdx-swift-bridge/target
- name: Build Swift bridge
run: cargo build --manifest-path cdx-swift-bridge/Cargo.toml
- name: Test Swift bridge
run: cargo test --manifest-path cdx-swift-bridge/Cargo.toml
- name: Clippy Swift bridge
run: cargo clippy --manifest-path cdx-swift-bridge/Cargo.toml -- -D warnings
security:
name: Security Audit
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Install cargo-audit
run: cargo install cargo-audit --locked || true
- name: Audit dependencies
run: cargo audit --ignore RUSTSEC-2023-0071 --ignore RUSTSEC-2026-0037
- name: Install cargo-deny
run: cargo install cargo-deny --locked || true
- name: Check dependency policies
run: cargo deny check
benchmark:
name: Benchmark
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Restore baseline
uses: actions/cache@v5
with:
path: target/criterion
key: benchmark-baseline-${{ github.base_ref || 'main' }}
restore-keys: benchmark-baseline-main
- name: Run benchmarks
run: cargo bench -p cdx-core --bench document -- --save-baseline pr
- name: Compare benchmarks
run: |
if [ -d "target/criterion" ] && [ -f "target/criterion/main/estimates.json" ]; then
echo "Comparing against baseline..."
cargo bench -p cdx-core --bench document -- --baseline main --noplot 2>&1 | tee benchmark_results.txt || true
else
echo "No baseline found, skipping comparison"
fi
continue-on-error: true
- name: Save baseline
if: github.ref == 'refs/heads/main'
uses: actions/cache@v5
with:
path: target/criterion
key: benchmark-baseline-main
feature-matrix:
name: Feature Matrix (${{ matrix.features || 'no features' }})
runs-on: blacksmith-2vcpu-ubuntu-2404
strategy:
fail-fast: false
matrix:
features:
- ""
- "zstd"
- "signatures"
- "zstd,signatures"
- "signatures,encryption"
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
key: features-${{ matrix.features }}
- name: Build
run: cargo build -p cdx-core --no-default-features --features "${{ matrix.features }}"
- name: Test
run: cargo test -p cdx-core --no-default-features --features "${{ matrix.features }}"