259 lines (220 loc) · 9.68 KB
/
Copy pathci.yml
File metadata and controls
259 lines (220 loc) · 9.68 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
name: CI
on:
pull_request:
branches: [dev]
paths-ignore:
- '**.md'
- '**.markdown'
# Pull requests can only restore caches saved by their own ref or by the base
# branch, so `dev` has to run CI to seed the caches every PR starts from.
push:
branches: [dev]
paths-ignore:
- '**.md'
- '**.markdown'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
# There is no separate `cargo check` or MSRV job. Clippy type-checks the whole
# workspace, and rust-toolchain.toml pins the same Rust (1.98) that every
# crate declares as its rust-version, so both would repeat Clippy's work. A
# `dtolnay/rust-toolchain@<version>` step cannot test an older Rust here
# anyway: rust-toolchain.toml overrides the toolchain it installs. If the pin
# ever moves above rust-version, add an MSRV job that runs
# `cargo +<msrv> check` so the override does not apply.
#
# Format and Clippy run first; every other job waits for both to pass, so a PR
# with a lint or formatting error does not also start the macOS and Windows
# test runs. Clippy takes about a minute and a half with a warm cache.
jobs:
test:
needs: [fmt, clippy]
name: Test (${{ matrix.os }}${{ matrix.shards > 1 && format(' {0}/{1}', matrix.shard, matrix.shards) || '' }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# macOS and Windows run in two halves: their nextest steps took 26
# and 22 minutes against 10.5 on Linux. Both halves of an OS share
# one rust-cache key and restore the same build. A second macOS job
# takes one more of the organization's few concurrent macOS runners.
include:
- { os: ubuntu-latest, shard: 1, shards: 1 }
- { os: macos-latest, shard: 1, shards: 2 }
- { os: macos-latest, shard: 2, shards: 2 }
- { os: windows-latest, shard: 1, shards: 2 }
- { os: windows-latest, shard: 2, shards: 2 }
env:
# Line tables keep file:line in backtraces but link far faster and keep
# target/ (and the cache) much smaller than full debug info.
CARGO_PROFILE_DEV_DEBUG: line-tables-only
CARGO_PROFILE_TEST_DEBUG: line-tables-only
# Build-script dependencies default to no debug info, except crates that
# are also normal dependencies, which take the line above. Which crates
# those are differs between the nextest build and the lib-only doctest
# build (shlex, which cc depends on), so without this the doctest step
# rebuilt cc, every crate whose build script uses it, and everything
# above them.
CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG: line-tables-only
CARGO_PROFILE_TEST_BUILD_OVERRIDE_DEBUG: line-tables-only
steps:
- uses: actions/checkout@v4
# Filesystem-heavy tests run ~12x slower on Windows than on Linux
# (atomic_repository unit tests: 11m vs 54s). A ReFS Dev Drive skips
# NTFS overhead and runs Defender in performance mode, so the build
# and the tests' temp directories live there.
- name: Set up Dev Drive
if: runner.os == 'Windows'
uses: samypr100/setup-dev-drive@v4
with:
# Dynamic VHDX on the runner's D: disk: it only uses what target/ needs.
# 14GB ran out while linking the test binaries.
drive-size: 60GB
mount-path: ${{ runner.workspace }}/devdrive
env-mapping: |
CARGO_TARGET_DIR,{{ DEV_DRIVE }}/target
TMP,{{ DEV_DRIVE }}/tmp
TEMP,{{ DEV_DRIVE }}/tmp
- name: Create Dev Drive temp directory
if: runner.os == 'Windows'
shell: pwsh
run: New-Item -ItemType Directory -Force -Path $env:TMP | Out-Null
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-node@v4
with:
node-version: '22'
- name: Test native runtime packaging
run: node --test libatomic/scripts/package-runtime.test.mjs
- name: Cache cargo registry and dependency builds
uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ runner.os == 'Windows' && '. -> ../devdrive/target' || '. -> target' }}
save-if: ${{ github.ref == 'refs/heads/dev' }}
- uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- name: Run tests
# Temporary PR #207 policy: Git shim integration suites are Unix-only
# (cfg(unix)); Linux/macOS still run them. Keep Windows native tests on.
# Re-enable the shim suites after Windows support is defined and its
# path/mode/locking behavior is validated; see the RFC platform policy.
#
# Two tests per CPU. The integration tests mostly wait on git and
# atomic subprocesses and the filesystem: on 4 CPUs, 86 of the git
# shim/adoption/anchor tests used 1.5 CPUs at one test per CPU and
# finished 1.8x faster at two. nextest's default of one per CPU left
# the 3-CPU macOS runner running exactly 3 tests at a time.
shell: bash
run: >-
cargo nextest run --workspace --features atomic-cli/adoption-test-injection --profile ci
--partition count:${{ matrix.shard }}/${{ matrix.shards }}
--test-threads $(( 2 * $(getconf _NPROCESSORS_ONLN 2>/dev/null || nproc) ))
# nextest does not run doctests. They exercise the same code on every
# platform and took 4.5 minutes on Windows, so they run on Linux only.
- name: Run doctests
if: matrix.os == 'ubuntu-latest'
run: cargo test --workspace --doc --features atomic-cli/adoption-test-injection --no-fail-fast
- name: Run CLI semantic diff harness
if: matrix.os == 'ubuntu-latest'
shell: bash
run: ATOMIC_BIN="$PWD/target/debug/atomic" bash tests/harness/run_all.sh 09
- name: Run knowledge graph closure harness
if: matrix.os == 'ubuntu-latest'
shell: bash
# The harness's own cargo test suites already ran under nextest above.
env:
ATOMIC_HARNESS_SKIP_CARGO_TESTS: 1
run: ATOMIC_BIN="$PWD/target/debug/atomic" bash tests/harness/46_knowledge_graph_closure.sh
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: cargo fmt --check
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
- name: Cache cargo registry and dependency builds
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/dev' }}
- name: cargo clippy
run: cargo clippy --workspace -- -D warnings
# The DSSE export code is behind a feature the workspace run leaves off.
- name: cargo clippy (dsse-export feature)
run: cargo clippy --locked --no-deps -p atomic-canonical -p atomic-cli --features dsse-export -- -D warnings
doc:
needs: [fmt, clippy]
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry and dependency builds
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/dev' }}
- name: cargo doc
run: cargo doc --workspace --no-deps
env:
RUSTDOCFLAGS: -Dwarnings
conformance:
needs: [fmt, clippy]
name: Conformance vectors
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# The ai-agent-action suite from agent-evidence-vectors, pinned to the
# commit of a release tag. Raise both to take the vectors a new release adds.
- uses: actions/checkout@v4
with:
repository: probityai/agent-evidence-vectors
ref: e7508ced37dacc89decacd857e97930860ee08cd # v0.25.0
path: agent-evidence-vectors
- uses: dtolnay/rust-toolchain@stable
# Not actions/cache: that saved a new full target/ from every PR that
# changed Cargo.lock, which only that PR could restore, and which counts
# against the repository's 10 GB cache limit that the test caches need.
- name: Cache cargo registry and dependency builds
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/dev' }}
- name: Replay the suite through the JSON admission
run: cargo test -p atomic-canonical --test conformance_corpus -- --ignored
env:
AEV_SUITE: ${{ github.workspace }}/agent-evidence-vectors/vectors-ai-agent-action
# Formerly the separate "Provenance DSSE interoperability" workflow. Its
# feature lint now runs in the Clippy job.
export-consumer:
needs: [fmt, clippy]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Cache cargo registry and dependency builds
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/dev' }}
- name: Install independent Ed25519 verifier
run: python -m pip install 'cryptography==50.0.0'
- name: Feature API tests and examples
run: cargo test --locked -p atomic-canonical --features dsse-export
- name: Real CLI export and independent consumption
run: cargo test --locked -p atomic-cli --features dsse-export --test it provenance_integration_test
env:
ATOMIC_DSSE_PYTHON: python