Repository navigation
Expand file tree
/
Copy pathminimal.toml
More file actions
189 lines (165 loc) · 6.44 KB
/
Copy pathminimal.toml
File metadata and controls
189 lines (165 loc) · 6.44 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
[upstream] # Source of software & tooling
repo = "https://github.com/gominimal/pkgs"
branch = "main"
locked_commit = "981dbe7a6f43a704c559b3a244c24f0f3dcfc645"
[stack]
use = "rust"
runtime_packages = [
"socat",
"pkgconf",
"openssl",
"linux_headers",
"zlib",
"protobuf",
"skopeo",
"coreutils",
"git",
]
[defaults.task]
state_key = "dev"
[defaults.session]
packages = ["just", "shellcheck", "python", "cargo-nextest"]
[tasks.build]
description = "Builds the minimal CLI"
exec = "cargo build --verbose"
inherit_cwd = true
[tasks.build-smoke]
description = "Smoke-test that a task can build something"
exec = "cargo build -p common"
inherit_cwd = true
[tasks.test]
exec = "cargo test --verbose"
inherit_cwd = true
[tasks.startup-time]
exec = "date"
[tasks.fmt-check]
exec = "cargo fmt -- --check"
inherit_cwd = true
[tasks.clippy]
exec = "cargo clippy --all-targets -- -D warnings"
inherit_cwd = true
# Mutation-test the lines this branch changed. Runs in the
# Linux sandbox, where the baseline test suite is green (the spec_hasher hash
# assertions that fail on macOS pass here), which cargo-mutants requires
# before it tests a single mutant. The diff against the merge-base bounds
# the run; the nightly shards cover the rest of the tree.
[tasks.metrics-mutants]
description = "cargo-mutants over this branch's changed lines (Linux; baseline suite must be green)"
inherit_cwd = true
bash = """
set -e
# The two tools run.sh needs, at the pins install-tools.sh owns; without
# either, run.sh fails the run rather than skipping it.
scripts/metrics/install-tools.sh --only cargo-mutants --only cargo-nextest
scripts/metrics/run.sh mutants ""
"""
[tasks.ci]
inherit_cwd = true
bash = """
set -e
cargo test --verbose
# cargo fmt -- --check
# cargo clippy --all-targets -- -D warnings
"""
# The agent runtime runs this one on the coder's files and amends the result
# into its last commit (runner/runner/jobs/implement.py, `run_fmt`). It must be
# `bash = `: a `spec.get("bash")` that is not a string reads as "no fmt task",
# and the PR then lands red on CI's `fmt` job for whitespace.
[tasks.fmt]
description = "rustfmt across the workspace; the runtime amends it into the coder's commit"
inherit_cwd = true
bash = """
set -e
cargo fmt --all
"""
# The gate the agent runtime runs after a task's `test:` lines, in a fresh
# clone at the pushed sha under a 10-minute budget (probeWallClockSeconds,
# worker/src/config.ts). The runtime prefers this name over `verify`.
# Without either block it falls back to the plan survey's `just test-one`,
# which has no filter to run.
#
# rustfmt, then clippy and the test suite of each crate the coder touched,
# read off `MINIMAL_CHANGED_PATHS` — the changed files the runtime puts in
# this task's env, one per line. No paths means no suites and a
# workspace-wide clippy. Clippy is scoped like nextest because a cold
# workspace clippy alone ran 9 m 10 s of the gate's 600 s on #1673 and the
# gate was stopped before nextest began; `-p` still checks every dependency
# of the touched crates, so a warning there is still caught.
[tasks.agent-verify]
description = "the gate the agent runtime runs after a task's test lines"
inherit_cwd = true
bash = """
set -e
cargo fmt --all -- --check
# Crate names out of `crates/<name>/...`, deduplicated; other paths ignored.
crates=$(printf '%s\\n' "${MINIMAL_CHANGED_PATHS:-}" \\
| sed -n 's|^crates/\\([^/][^/]*\\)/.*|\\1|p' \\
| sort -u)
args=""
for c in $crates; do args="$args -p $c"; done
# shellcheck disable=SC2086 - the package flags are meant to split
cargo clippy --all-targets --locked $args -- -D warnings
if [ -n "$crates" ]; then
# shellcheck disable=SC2086 - the package flags are meant to split
cargo nextest run --locked $args
fi
# The quality gate, the same run the `quality-gate` task below
# makes: no compiler, seconds, exit 2 on a regression against the base ref.
# Non-blocking until the gate has soaked: it runs and prints its report, and
# a non-zero exit (2 failed, 3 incomplete) is logged rather than failing the task.
scripts/metrics/run.sh gate --out .scratch/metrics/quality-gate \\
|| echo "quality gate exited $? (non-blocking while it beds in)"
"""
# The review runtime runs a declared task as a probe: a 300-second budget, no
# arguments delivered, and the sha256 of the recorded output cited as
# attested evidence. So this task takes no parameters, derives its own base
# ref (the merge-base with origin/main), invokes no compiler — `cargo metadata
# --no-deps` is the one cargo call, and cargo-shear is left to `just
# metrics-diff` because it probes rustc — and ends stdout with one line,
# `quality-gate: <verdict> report=<path> sha256=<hex>`, the hash being
# report.json's, which carries no times. The
# report itself is metrics/README.md "Grading a change".
[tasks.quality-gate]
description = "grade the change against its base ref without compiling; the review runtime's probe"
inherit_cwd = true
bash = """
set -e
scripts/metrics/run.sh gate --out .scratch/metrics/quality-gate
"""
# `min task run verify` — the same two checks a person can run over the
# whole tree. No crate scoping: nothing sets MINIMAL_CHANGED_PATHS at a
# terminal, and a gate that silently narrows itself is worse than one that
# says what it covers.
[tasks.verify]
description = "rustfmt and clippy over the whole workspace"
inherit_cwd = true
bash = """
set -e
cargo fmt --all -- --check
cargo clippy --all-targets --locked -- -D warnings
"""
[outputs.bash-img]
type = "oci-image"
packages = ["bash", "coreutils", "diffutils", "findutils", "tar"]
env_vars.test = "ello"
cmd = ["/usr/bin/bash", "-l"]
# Raw (uncompressed) kernel Image from the upstream virtio-kernel-raw package,
# loaded via KRUN_KERNEL_FORMAT_RAW (no in-VMM gzip decompress) for faster boot.
[outputs.virtio-kernel]
type = "raw-file"
packages = ["virtio-kernel-raw"]
path = "usr/share/virtio-linux/Image"
# Guest rootfs ext4 image from the upstream microvm-rootfs package.
[outputs.minvmd-rootfs]
type = "raw-file"
packages = ["microvm-rootfs"]
path = "usr/share/microvm-rootfs/rootfs.img"
# libkrun KVM backend (shared lib + its libkrunfw firmware) from the upstream
# libkrun package. Materialized as an OCI image whose layers carry the full
# runtime closure; scripts/fetch-libkrun.sh extracts just libkrun.so* and
# libkrunfw.so* into a link/runtime prefix. This replaces the former from-source
# build — libkrunfw compiles a guest kernel, far too heavy to rebuild in CI on
# every run.
[outputs.libkrun]
type = "oci-image"
packages = ["libkrun"]