-
Notifications
You must be signed in to change notification settings - Fork 1
299 lines (272 loc) · 9.28 KB
/
ci.yml
File metadata and controls
299 lines (272 loc) · 9.28 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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
name: CI
on:
push:
branches: [main]
paths-ignore:
- '**.md'
- 'docs/**'
- 'LICENSE*'
- '.gitignore'
pull_request:
branches: [main]
paths-ignore:
- '**.md'
- 'docs/**'
- 'LICENSE*'
- '.gitignore'
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
jobs:
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --check --all
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-clippy-
- run: cargo clippy --all-targets --all-features -- -D warnings
- run: cargo run -p xtask -- check-clippy-sync
xtask-checks:
name: Tree-sitter enforcement
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-rust
- name: Run tree-sitter enforcement checks
run: |
cargo run -p xtask -- check-curve-agnostic
cargo run -p xtask -- check-anchor-discipline
cargo run -p xtask -- check-constant-time
cargo run -p xtask -- check-rfc6979
schemas:
name: Schema validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-schemas-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-schemas-
- name: Regenerate schemas and check for drift
run: |
cargo run -p xtask -- generate-schemas
git diff --exit-code schemas/
- name: Validate fixtures against schemas
run: cargo run -p xtask -- validate-schemas
test:
name: Test (${{ matrix.os }})
needs: [fmt, clippy]
strategy:
fail-fast: false
matrix:
# TODO: add os: [ubuntu-latest, macos-latest, windows-latest]
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-test-
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Install SoftHSMv2 (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install -y softhsm2
mkdir -p /tmp/softhsm/tokens
echo "directories.tokendir = /tmp/softhsm/tokens" > /tmp/softhsm2.conf
export SOFTHSM2_CONF=/tmp/softhsm2.conf
softhsm2-util --init-token --slot 0 --label "auths-test" --pin 12345678 --so-pin 12345678
echo "SOFTHSM2_CONF=/tmp/softhsm2.conf" >> "$GITHUB_ENV"
- name: Install SoftHSMv2 (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install softhsm
mkdir -p /tmp/softhsm/tokens
echo "directories.tokendir = /tmp/softhsm/tokens" > /tmp/softhsm2.conf
export SOFTHSM2_CONF=/tmp/softhsm2.conf
softhsm2-util --init-token --slot 0 --label "auths-test" --pin 12345678 --so-pin 12345678
echo "SOFTHSM2_CONF=/tmp/softhsm2.conf" >> "$GITHUB_ENV"
- name: Configure Git
run: |
git config --global user.name "CI"
git config --global user.email "ci@auths.dev"
- name: Install Go (Ubuntu, needed for aws-lc-fips-sys)
if: matrix.os == 'ubuntu-latest'
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Run tests (Ubuntu — all features incl. FIPS)
if: matrix.os == 'ubuntu-latest'
run: cargo nextest run --workspace --all-features --no-fail-fast
- name: Run tests (macOS — exclude FIPS, requires Go + Linux)
if: matrix.os == 'macos-latest'
run: cargo nextest run --workspace --features test-utils,witness-client --no-fail-fast
- name: Run doc tests
run: cargo test --all --doc
- name: Install cargo-audit
if: matrix.os == 'ubuntu-latest'
uses: taiki-e/install-action@cargo-audit
- name: Security audit
if: matrix.os == 'ubuntu-latest'
run: cargo audit
# capsec-audit:
# name: Capability Audit
# runs-on: ubuntu-latest
# permissions:
# contents: read
# security-events: write
# pull-requests: write
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - uses: dtolnay/rust-toolchain@stable
# - name: Audit clean crates (zero I/O expected)
# uses: bordumb/capsec-github-action@v1
# with:
# only: auths-crypto,auths-verifier,auths-policy,auths-keri
# fail-on: low
# upload-sarif: false
# comment-on-pr: false
# - name: Audit dirty crates (no new high-risk I/O)
# uses: bordumb/capsec-github-action@v1
# with:
# only: auths-core,auths-id
# fail-on: high
# diff: 'true'
# upload-sarif: true
# sarif-category: capsec-audit-dirty
# comment-on-pr: true
pq-hybrid:
name: PQ hybrid build (auths-pairing-protocol)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-pq-hybrid-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-pq-hybrid-
- name: Install nextest
uses: taiki-e/install-action@nextest
# fn-129.T10: exercise the experimental `pq-hybrid` feature. The
# `ml-kem` crate is unaudited; we build and run its tests to freeze
# the wire format + combiner ordering ahead of a security review.
- name: Build with pq-hybrid feature
run: cargo build -p auths-pairing-protocol --features pq-hybrid
- name: Test with pq-hybrid feature
run: cargo nextest run -p auths-pairing-protocol --features pq-hybrid --no-fail-fast
- name: Clippy with pq-hybrid feature
run: cargo clippy -p auths-pairing-protocol --features pq-hybrid --all-targets -- -D warnings -D unsafe_code
msrv:
name: MSRV check (1.93)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.93
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-msrv-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-msrv-
- run: cargo check --workspace
wasm:
name: WASM build (auths-verifier)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-wasm-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-wasm-
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build WASM with wasm-pack
working-directory: crates/auths-verifier
run: wasm-pack build --target bundler --no-default-features --features wasm
e2e-tests:
name: E2E Tests (${{ matrix.os }})
needs: [test]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.93
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-e2e-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-e2e-
- uses: astral-sh/setup-uv@v4
- name: Build auths binaries
run: cargo build --package auths-cli
- name: Configure git
run: |
git config --global user.name "CI"
git config --global user.email "ci@auths.dev"
- name: Run E2E tests
working-directory: tests/e2e
run: uv run pytest -v --junitxml=../../results-${{ matrix.os }}.xml
env:
AUTHS_BIN: ${{ github.workspace }}/target/debug/auths
AUTHS_SIGN_BIN: ${{ github.workspace }}/target/debug/auths-sign
AUTHS_VERIFY_BIN: ${{ github.workspace }}/target/debug/auths-verify
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-results-${{ matrix.os }}
path: results-*.xml