|
1 |
+ |
// Spectra's own pipeline (OxygenFlow, docs in the oxygenflow repository), in |
|
2 |
+ |
// the shape of Oxygen's. Every push to a bookmark on OxygenHub runs it in |
|
3 |
+ |
// Firecracker microVMs on Earth; the jobs appear as checks on the change. |
|
4 |
+ |
schema-version 1 |
|
5 |
+ |
|
|
6 |
+ |
// The OxygenFlow build image: Rust with rustfmt and clippy, nextest and |
|
7 |
+ |
// llvm-cov, and the crates of oxygen, oxygenhub and oxygenflow vendored |
|
8 |
+ |
// (oxygenflow/images/rust). Spectra keeps to those crates |
|
9 |
+ |
// (`make deps-check`), so the same image builds it with no network. |
|
10 |
+ |
sandbox "rust" { |
|
11 |
+ |
runtime "microvm" |
|
12 |
+ |
rootfs "cas://blob/836461b613019f62399a960c61a25c482eb74e30054ff2cd44d5594c3305872b" |
|
13 |
+ |
memory-limit "8GiB" |
|
14 |
+ |
cpu-limit 4 |
|
15 |
+ |
// Tests serve and connect on 127.0.0.1 and a Unix socket; nothing |
|
16 |
+ |
// leaves the guest. |
|
17 |
+ |
network "loopback" |
|
18 |
+ |
// CI builds are thrown away: no incremental state and no debug info, |
|
19 |
+ |
// so less to compile, link and write (as in oxygen's pipeline). |
|
20 |
+ |
env { |
|
21 |
+ |
CARGO_INCREMENTAL "0" |
|
22 |
+ |
CARGO_PROFILE_DEV_DEBUG "0" |
|
23 |
+ |
CARGO_PROFILE_TEST_DEBUG "0" |
|
24 |
+ |
CARGO_PROFILE_RELEASE_DEBUG "0" |
|
25 |
+ |
} |
|
26 |
+ |
} |
|
27 |
+ |
|
|
28 |
+ |
sandbox "rust-small" { |
|
29 |
+ |
runtime "microvm" |
|
30 |
+ |
rootfs "cas://blob/836461b613019f62399a960c61a25c482eb74e30054ff2cd44d5594c3305872b" |
|
31 |
+ |
memory-limit "1GiB" |
|
32 |
+ |
cpu-limit 1 |
|
33 |
+ |
network "isolated" |
|
34 |
+ |
} |
|
35 |
+ |
|
|
36 |
+ |
// Spectra's own packages only: `--all` would reach the pinned Oxygen in |
|
37 |
+ |
// deps/, which has its own formatting (as in oxygenhub). |
|
38 |
+ |
job "fmt" { |
|
39 |
+ |
sandbox "rust-small" |
|
40 |
+ |
exec "cargo" "fmt" "-p" "spectra" "-p" "spectra-core" "-p" "spectra-mcp" "-p" "spectra-api" "-p" "radar" "--check" |
|
41 |
+ |
} |
|
42 |
+ |
|
|
43 |
+ |
job "clippy" { |
|
44 |
+ |
sandbox "rust" |
|
45 |
+ |
depends-on "fmt" |
|
46 |
+ |
mount { |
|
47 |
+ |
source "ephemeral://disk" |
|
48 |
+ |
target "/src/target" |
|
49 |
+ |
size "16GiB" |
|
50 |
+ |
// Kept from this job's last passing run (oxygenflow#28): cargo |
|
51 |
+ |
// builds only what changed since. |
|
52 |
+ |
cache "target" |
|
53 |
+ |
key "Cargo.lock" |
|
54 |
+ |
} |
|
55 |
+ |
// One build identity for every CI state, so the cached target stays |
|
56 |
+ |
// fresh from one push to the next (oxygenflow#52). |
|
57 |
+ |
env { |
|
58 |
+ |
SPECTRA_BUILD "ci" |
|
59 |
+ |
} |
|
60 |
+ |
exec "cargo" "clippy" "--workspace" "--all-targets" "--locked" "--" "-D" "warnings" |
|
61 |
+ |
} |
|
62 |
+ |
|
|
63 |
+ |
// The tests, run under cargo-nextest and cargo-llvm-cov: a test report |
|
64 |
+ |
// (JUnit, kept whether or not they pass) for the hub's Tests tab and line |
|
65 |
+ |
// coverage (LCOV) for its Coverage tab, from one run. |
|
66 |
+ |
job "test" { |
|
67 |
+ |
sandbox "rust" |
|
68 |
+ |
depends-on "fmt" |
|
69 |
+ |
mount { |
|
70 |
+ |
source "ephemeral://disk" |
|
71 |
+ |
target "/src/target" |
|
72 |
+ |
size "16GiB" |
|
73 |
+ |
cache "target" |
|
74 |
+ |
key "Cargo.lock" |
|
75 |
+ |
} |
|
76 |
+ |
env { |
|
77 |
+ |
SPECTRA_BUILD "ci" |
|
78 |
+ |
} |
|
79 |
+ |
exec "cargo" "llvm-cov" "nextest" "--workspace" "--locked" "--profile" "ci" "--lcov" "--output-path" "/src/target/lcov.info" |
|
80 |
+ |
output { |
|
81 |
+ |
artifact "junit" { |
|
82 |
+ |
path "/src/target/nextest/ci/junit.xml" |
|
83 |
+ |
when "always" |
|
84 |
+ |
} |
|
85 |
+ |
artifact "coverage" { |
|
86 |
+ |
path "/src/target/lcov.info" |
|
87 |
+ |
} |
|
88 |
+ |
} |
|
89 |
+ |
} |
|
90 |
+ |
|
|
91 |
+ |
job "build" { |
|
92 |
+ |
sandbox "rust" |
|
93 |
+ |
depends-on "fmt" |
|
94 |
+ |
mount { |
|
95 |
+ |
source "ephemeral://disk" |
|
96 |
+ |
target "/src/target" |
|
97 |
+ |
size "16GiB" |
|
98 |
+ |
cache "target" |
|
99 |
+ |
key "Cargo.lock" |
|
100 |
+ |
} |
|
101 |
+ |
exec "cargo" "build" "--release" "--locked" |
|
102 |
+ |
// The binary, kept as a blob of this repository and named by the |
|
103 |
+ |
// job's signed receipt; the run page links it. |
|
104 |
+ |
output { |
|
105 |
+ |
artifact "spectra" { |
|
106 |
+ |
path "/src/target/release/spectra" |
|
107 |
+ |
} |
|
108 |
+ |
} |
|
109 |
+ |
} |