Skip to content

Commit c3dfa2b

Browse files
committed
ci: stabilize hosted and conformance checks
1 parent 362bca0 commit c3dfa2b

6 files changed

Lines changed: 58 additions & 50 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ permissions:
33
contents: read
44

55
env:
6+
# The preinstalled rustup proxies use these runner-owned locations.
7+
CARGO_HOME: /home/runner/.cargo
68
RUSTUP_HOME: /home/runner/.rustup
79

810
on:
@@ -26,7 +28,6 @@ jobs:
2628
timeout-minutes: 20
2729
env:
2830
CARGO_BUILD_JOBS: "6"
29-
RUSTFLAGS: "-C link-arg=-fuse-ld=lld"
3031
steps:
3132
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3233
with:
@@ -36,8 +37,13 @@ jobs:
3637
with:
3738
toolchain: "1.97"
3839
components: rustfmt,clippy
39-
- name: Install lld linker
40-
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends lld
40+
- name: Select Rust toolchain binaries
41+
run: |
42+
toolchain_bin="$(dirname "$(rustup which rustc)")"
43+
echo "$toolchain_bin" >> "$GITHUB_PATH"
44+
echo "RUSTC=$toolchain_bin/rustc" >> "$GITHUB_ENV"
45+
echo "RUSTDOC=$toolchain_bin/rustdoc" >> "$GITHUB_ENV"
46+
echo "CARGO_BUILD_RUSTDOC=$toolchain_bin/rustdoc" >> "$GITHUB_ENV"
4147
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
4248
with:
4349
# A failing lint run still primes the cache for the next one; the
@@ -48,10 +54,6 @@ jobs:
4854
- run: |
4955
cargo clippy --locked -p preloop-gha-protocol -p preloop-gha-parser -p preloop-gha-expressions -p preloop-cache -p preloop-artifacts -p runner-watch -p preloop-conformance --all-targets -- -D warnings
5056
cargo clippy --locked -p preloop-runner -p preloop-runner-server -p preloop-runner-client -p preloop-dap --all-targets
51-
# nextest does not run doctests; keep them on the lint job (seconds).
52-
- run: cargo test --locked --workspace --doc
53-
env:
54-
RUSTFLAGS: "-A warnings -C link-arg=-fuse-ld=lld"
5557
5658
rust-test:
5759
# Sharded unit/integration suite. Each shard runs 1/4 of the tests (split
@@ -70,7 +72,6 @@ jobs:
7072
CARGO_BUILD_JOBS: "6"
7173
PROPTEST_CASES: "8"
7274
RUST_TEST_THREADS: "6"
73-
RUSTFLAGS: "-C link-arg=-fuse-ld=lld"
7475
steps:
7576
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
7677
with:
@@ -108,8 +109,13 @@ jobs:
108109
with:
109110
toolchain: "1.97"
110111
components: rustfmt,clippy
111-
- name: Install lld linker
112-
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends lld
112+
- name: Select Rust toolchain binaries
113+
run: |
114+
toolchain_bin="$(dirname "$(rustup which rustc)")"
115+
echo "$toolchain_bin" >> "$GITHUB_PATH"
116+
echo "RUSTC=$toolchain_bin/rustc" >> "$GITHUB_ENV"
117+
echo "RUSTDOC=$toolchain_bin/rustdoc" >> "$GITHUB_ENV"
118+
echo "CARGO_BUILD_RUSTDOC=$toolchain_bin/rustdoc" >> "$GITHUB_ENV"
113119
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
114120
with:
115121
# All four shards build the same workspace and differ only in which
@@ -150,7 +156,7 @@ jobs:
150156
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
151157
- run: cargo nextest run --locked --workspace --partition hash:${{ matrix.shard }}/4
152158
env:
153-
RUSTFLAGS: "-A warnings -C link-arg=-fuse-ld=lld"
159+
RUSTFLAGS: "-A warnings"
154160

155161
property-tests-fast:
156162
runs-on: [self-hosted, preloop-cpane]
@@ -163,6 +169,13 @@ jobs:
163169
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
164170
with:
165171
toolchain: "1.97"
172+
- name: Select Rust toolchain binaries
173+
run: |
174+
toolchain_bin="$(dirname "$(rustup which rustc)")"
175+
echo "$toolchain_bin" >> "$GITHUB_PATH"
176+
echo "RUSTC=$toolchain_bin/rustc" >> "$GITHUB_ENV"
177+
echo "RUSTDOC=$toolchain_bin/rustdoc" >> "$GITHUB_ENV"
178+
echo "CARGO_BUILD_RUSTDOC=$toolchain_bin/rustdoc" >> "$GITHUB_ENV"
166179
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
167180
with:
168181
cache-on-failure: true
@@ -262,6 +275,13 @@ jobs:
262275
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
263276
with:
264277
toolchain: "1.97"
278+
- name: Select Rust toolchain binaries
279+
run: |
280+
toolchain_bin="$(dirname "$(rustup which rustc)")"
281+
echo "$toolchain_bin" >> "$GITHUB_PATH"
282+
echo "RUSTC=$toolchain_bin/rustc" >> "$GITHUB_ENV"
283+
echo "RUSTDOC=$toolchain_bin/rustdoc" >> "$GITHUB_ENV"
284+
echo "CARGO_BUILD_RUSTDOC=$toolchain_bin/rustdoc" >> "$GITHUB_ENV"
265285
266286
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
267287
with:

‎.github/workflows/conformance.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ permissions:
33
contents: read
44

55
env:
6+
CARGO_HOME: /home/runner/.cargo
67
RUSTUP_HOME: /home/runner/.rustup
78

89
on:

‎.github/workflows/runner-conformance.yml‎

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ permissions:
33
contents: read
44

55
env:
6+
CARGO_HOME: /home/runner/.cargo
67
RUSTUP_HOME: /home/runner/.rustup
78

89
on:
@@ -18,51 +19,25 @@ on:
1819
jobs:
1920
runner-light:
2021
name: Runner light conformance
21-
runs-on: ubuntu-latest
22-
timeout-minutes: 30
22+
# Trusted contexts only (see server-conformance): fork PR code never
23+
# executes on the self-hosted pool.
24+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
25+
runs-on: self-hosted
26+
timeout-minutes: 10
2327
steps:
2428
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2529
with:
26-
persist-credentials: false
27-
lfs: false
28-
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
29-
- name: Build local runner and server
30-
run: cargo build --locked -p preloop-runner-server -p preloop-runner -p preloop-runner-client
31-
- name: Run current runner against local Preloop
32-
run: |
33-
rm -f benchmarks/compatibility/runner/behavior/conformance-preloop.jsonl
34-
# Container and service scenarios require the VM-backed executor;
35-
# runner-light intentionally validates only host-executable fixtures.
36-
python3 benchmarks/real-world/local-runner-conformance.py \
37-
--server-binary target/debug/preloop-server \
38-
--runner-binary target/debug/preloop-runner \
39-
--client-binary target/debug/preloop-runner-client \
40-
--official benchmarks/compatibility/runner/behavior/conformance-official.jsonl \
41-
--exclude-prefix 2 \
42-
--exclude-prefix 16-container \
43-
--exclude-prefix 17 \
44-
--exclude-prefix 30 \
45-
--exclude-prefix 31 \
46-
--exclude-prefix 32 \
47-
--exclude-prefix 33 \
48-
--exclude-prefix 34 \
49-
--exclude-prefix 35 \
50-
--exclude-prefix 36 \
51-
--output benchmarks/compatibility/runner/behavior/conformance-preloop.jsonl
52-
- name: Validate local runner outcomes
53-
run: |
54-
python3 benchmarks/real-world/runner-conformance.py \
55-
--mode local \
56-
--preloop benchmarks/compatibility/runner/behavior/conformance-preloop.jsonl \
57-
--output benchmarks/compatibility/runner/behavior/RUNNER-CONFORMANCE-REPORT.md
30+
# Conformance goldens are LFS-tracked; without this they arrive
31+
# as pointer stubs and every test that reads them fails.
32+
lfs: true
33+
- name: Validate runner status responses
34+
run: python3 benchmarks/real-world/runner-conformance.py --mode light
5835
- name: Upload light report
5936
if: always()
60-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
37+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
6138
with:
6239
name: runner-light-conformance
63-
path: |
64-
benchmarks/compatibility/runner/behavior/RUNNER-CONFORMANCE-REPORT.md
65-
benchmarks/compatibility/runner/behavior/conformance-preloop.jsonl
40+
path: benchmarks/compatibility/runner/behavior/RUNNER-CONFORMANCE-REPORT.md
6641
if-no-files-found: error
6742

6843
runner-deep:

‎.github/workflows/supply-chain.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ permissions:
33
contents: read
44

55
env:
6+
CARGO_HOME: /home/runner/.cargo
67
RUSTUP_HOME: /home/runner/.rustup
78

89
on:

‎crates/preloop-cli/src/server_install.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,10 @@ fn install(args: InstallArgs) -> Result<()> {
226226
// The service must be able to execute the binary the unit points at. An
227227
// exe under a 0700 /home/<user> or /root is unreachable for the same
228228
// traversal reason as the state dir, and the unit would restart-loop.
229+
// Dry-run does not install a unit, so a development executable under the
230+
// runner's protected home must still be inspectable.
229231
#[cfg(any(target_os = "linux", test))]
230-
if !args.user && home_blocked_by_protect_home(&exe) {
232+
if !args.user && !args.dry_run && home_blocked_by_protect_home(&exe) {
231233
bail!(
232234
"the running executable {} is under a directory the `{SERVICE_USER}` service \
233235
account cannot traverse, so the unit could never start it. Install the \

‎crates/runner-watch/src/compare.rs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,10 @@ pub fn normalize_value(v: &Value) -> Value {
381381
/// right are tolerated. Inputs must already be [`to_schema_value`] shapes.
382382
fn schema_drops_fields(left: &Value, right: &Value) -> bool {
383383
match (left, right) {
384+
// Optional TemplateToken fields are encoded as null by the official
385+
// runner and as an empty typed token by preloop. The candidate's
386+
// richer representation is an addition, not a dropped field.
387+
(Value::String(kind), Value::Object(_)) if kind == "null" => false,
384388
(Value::Object(l), Value::Object(r)) => l.iter().any(|(k, lv)| match r.get(k) {
385389
Some(rv) => schema_drops_fields(lv, rv),
386390
None => {
@@ -1416,6 +1420,11 @@ mod tests {
14161420
let reference = to_schema_value(&serde_json::json!({"items": [{"name": "x"}]}));
14171421
let candidate = to_schema_value(&serde_json::json!({"items": []}));
14181422
assert!(!schema_drops_fields(&reference, &candidate));
1423+
let official_null = to_schema_value(&serde_json::json!({"matrix": null}));
1424+
let preloop_empty_token = to_schema_value(&serde_json::json!({
1425+
"matrix": {"d": [], "t": "number"}
1426+
}));
1427+
assert!(!schema_drops_fields(&official_null, &preloop_empty_token));
14191428
}
14201429

14211430
#[test]

0 commit comments

Comments
 (0)