| 2b668d92 Andy McCall |
1 |
// Oxygen's own pipeline (OxygenFlow, docs in the oxygenflow repository). |
| 2 |
// Every push to a bookmark on OxygenHub runs it in Firecracker microVMs on |
| 3 |
// Earth; the jobs appear as checks on the change. |
| 4 |
schema-version 1 |
| 5 |
|
| 6 |
// The OxygenFlow build image: Rust with rustfmt and clippy, Node, and every |
| 7 |
// crate of Cargo.lock vendored (oxygenflow/images/rust). Rebuild and re-pin |
| 8 |
// it when Cargo.lock changes. |
| 9 |
sandbox "rust" { |
| 10 |
runtime "microvm" |
| f9eab811 Andy McCall ↶ |
11 |
rootfs "cas://blob/836461b613019f62399a960c61a25c482eb74e30054ff2cd44d5594c3305872b" |
| 2b668d92 Andy McCall |
12 |
memory-limit "8GiB" |
| 13 |
cpu-limit 4 |
| 14 |
// Tests serve and connect on 127.0.0.1; nothing leaves the guest. |
| 15 |
network "loopback" |
| dfe16587 Andy McCall ↶ |
16 |
// CI builds are thrown away: no incremental state and no debug info, |
| 17 |
// so less to compile, link and write (as in oxygenhub's pipeline). |
| 18 |
env { |
| 19 |
CARGO_INCREMENTAL "0" |
| 20 |
CARGO_PROFILE_DEV_DEBUG "0" |
| 21 |
CARGO_PROFILE_TEST_DEBUG "0" |
| 22 |
CARGO_PROFILE_RELEASE_DEBUG "0" |
| 23 |
} |
| 2b668d92 Andy McCall |
24 |
} |
| 25 |
|
| 26 |
sandbox "rust-small" { |
| 27 |
runtime "microvm" |
| f9eab811 Andy McCall ↶ |
28 |
rootfs "cas://blob/836461b613019f62399a960c61a25c482eb74e30054ff2cd44d5594c3305872b" |
| 2b668d92 Andy McCall |
29 |
memory-limit "1GiB" |
| 30 |
cpu-limit 1 |
| 31 |
network "isolated" |
| 32 |
} |
| 33 |
|
| 8d6cf1f2 Andy McCall ↶ |
34 |
// The riscv64 build image on narvi-1 (oxygenflow#69): Ubuntu 24.04 riscv64 |
| 35 |
// with Rust 1.97.1 and the same vendored crates, in the syscall tier (the |
| 36 |
// board has no hardware virtualisation, so no microVM). `runs-on` keeps it |
| 37 |
// on a RISC-V runner. |
| 38 |
sandbox "rust-riscv64" { |
| 39 |
runtime "syscall" |
| 40 |
rootfs "cas://blob/b4edba9173ddf63aa1df46222e6a59b265071b19f2815c89d0153b593835c616" |
| 41 |
runs-on "riscv64" |
| 42 |
memory-limit "4GiB" |
| 43 |
cpu-limit 6 |
| 44 |
network "loopback" |
| 45 |
env { |
| 46 |
CARGO_INCREMENTAL "0" |
| 47 |
CARGO_PROFILE_RELEASE_DEBUG "0" |
| 48 |
CARGO_BUILD_JOBS "4" |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 2b668d92 Andy McCall |
52 |
job "fmt" { |
| 53 |
sandbox "rust-small" |
| 54 |
exec "cargo" "fmt" "--all" "--check" |
| 55 |
} |
| 56 |
|
| 57 |
job "clippy" { |
| 58 |
sandbox "rust" |
| 59 |
depends-on "fmt" |
| 60 |
mount { |
| 61 |
source "ephemeral://disk" |
| 62 |
target "/src/target" |
| 63 |
size "24GiB" |
| a451982b Andy McCall ↶ |
64 |
// Kept from this job's last passing run (oxygenflow#28): cargo |
| 65 |
// builds only what changed since. |
| 66 |
cache "target" |
| 67 |
key "Cargo.lock" |
| 2b668d92 Andy McCall |
68 |
} |
| a451982b Andy McCall ↶ |
69 |
// One build identity for every CI state, so the cached target stays |
| 70 |
// fresh from one push to the next (oxygenflow#52). |
| 71 |
env { |
| 72 |
OXY_BUILD "ci" |
| 73 |
} |
| ba1731bb Andy McCall ↶ |
74 |
exec "sh" ".flow/warm-target.sh" "cargo" "clippy" "--workspace" "--all-targets" "--locked" "--" "-D" "warnings" |
| 2b668d92 Andy McCall |
75 |
} |
| 76 |
|
| ff698768 Andy McCall ↶ |
77 |
// The tests, run under cargo-nextest and cargo-llvm-cov: a test report |
| 78 |
// (JUnit, kept whether or not they pass; #139) for the hub's Tests tab and |
| 79 |
// line coverage (LCOV, oxygenhub#113) for its Coverage tab, from one run. |
| 2b668d92 Andy McCall |
80 |
job "test" { |
| 81 |
sandbox "rust" |
| 82 |
depends-on "fmt" |
| 83 |
mount { |
| 84 |
source "ephemeral://disk" |
| 85 |
target "/src/target" |
| 86 |
size "24GiB" |
| a451982b Andy McCall ↶ |
87 |
// Kept from this job's last passing run (oxygenflow#28): cargo |
| 88 |
// builds only what changed since. |
| 89 |
cache "target" |
| 90 |
key "Cargo.lock" |
| 91 |
} |
| 92 |
// One build identity for every CI state, so the cached target stays |
| 93 |
// fresh from one push to the next (oxygenflow#52). |
| 94 |
env { |
| 95 |
OXY_BUILD "ci" |
| 2b668d92 Andy McCall |
96 |
} |
| ff698768 Andy McCall ↶ |
97 |
exec "cargo" "llvm-cov" "nextest" "--workspace" "--locked" "--profile" "ci" "--lcov" "--output-path" "/src/target/lcov.info" |
| dfa3e8e9 Andy McCall ↶ |
98 |
output { |
| ff698768 Andy McCall ↶ |
99 |
artifact "junit" { |
| 100 |
path "/src/target/nextest/ci/junit.xml" |
| 101 |
when "always" |
| 102 |
} |
| dfa3e8e9 Andy McCall ↶ |
103 |
artifact "coverage" { |
| 104 |
path "/src/target/lcov.info" |
| 105 |
} |
| 106 |
} |
| 2b668d92 Andy McCall |
107 |
} |
| 108 |
|
| 109 |
job "build" { |
| 110 |
sandbox "rust" |
| 111 |
depends-on "fmt" |
| 112 |
mount { |
| 113 |
source "ephemeral://disk" |
| 114 |
target "/src/target" |
| 115 |
size "24GiB" |
| a451982b Andy McCall ↶ |
116 |
// Kept from this job's last passing run (oxygenflow#28): cargo |
| 117 |
// builds only what changed since. |
| 118 |
cache "target" |
| 119 |
key "Cargo.lock" |
| 2b668d92 Andy McCall |
120 |
} |
| ba1731bb Andy McCall ↶ |
121 |
exec "sh" ".flow/warm-target.sh" "cargo" "build" "--release" "--locked" |
| bdd894b5 Andy McCall ↶ |
122 |
// The binary, kept as a blob of this repository and named by the |
| 123 |
// job's signed receipt; the run page links it. |
| 124 |
output { |
| 125 |
artifact "oxy" { |
| 126 |
path "/src/target/release/oxy" |
| 127 |
} |
| 128 |
} |
| 2b668d92 Andy McCall |
129 |
} |
| b66a5c47 Andy McCall ↶ |
130 |
|
| 131 |
// Release files for every platform (oxygen#59): scripts/dist.sh in the |
| 132 |
// build image's cross toolchains. A push runs it only when it touches |
| 133 |
// these paths (a release moves Cargo.toml's version); "Run pipeline" and |
| 134 |
// reruns always do. The files are kept as this run's artifacts, named by |
| 135 |
// its signed receipt, and attached to the release from there, so the |
| 136 |
// release's trust page shows each as built here. |
| 137 |
job "dist" { |
| 138 |
sandbox "rust" |
| 139 |
depends-on "fmt" |
| 140 |
scope "Cargo.toml" "scripts/dist.sh" "packaging/**" |
| 141 |
mount { |
| 142 |
source "ephemeral://disk" |
| 143 |
target "/src/target" |
| 144 |
size "24GiB" |
| a451982b Andy McCall ↶ |
145 |
// Kept from this job's last passing run (oxygenflow#28): cargo |
| 146 |
// builds only what changed since. |
| 147 |
cache "target" |
| 148 |
key "Cargo.lock" |
| b66a5c47 Andy McCall ↶ |
149 |
} |
| 150 |
env { |
| 151 |
DIST_FLAT "/src/target/dist-flat" |
| 152 |
ZIG_GLOBAL_CACHE_DIR "/src/target/zig-cache" |
| 153 |
} |
| 154 |
exec "bash" "scripts/dist.sh" |
| 155 |
output { |
| 156 |
artifact "oxy-linux-x86_64.tar.gz" { |
| 157 |
path "/src/target/dist-flat/oxy-linux-x86_64.tar.gz" |
| 158 |
} |
| 159 |
artifact "oxy-linux-arm64.tar.gz" { |
| 160 |
path "/src/target/dist-flat/oxy-linux-arm64.tar.gz" |
| 161 |
} |
| 162 |
artifact "oxy-linux-riscv64.tar.gz" { |
| 163 |
path "/src/target/dist-flat/oxy-linux-riscv64.tar.gz" |
| 164 |
} |
| 165 |
artifact "oxy-macos-x86_64.tar.gz" { |
| 166 |
path "/src/target/dist-flat/oxy-macos-x86_64.tar.gz" |
| 167 |
} |
| 168 |
artifact "oxy-macos-arm64.tar.gz" { |
| 169 |
path "/src/target/dist-flat/oxy-macos-arm64.tar.gz" |
| 170 |
} |
| 171 |
artifact "oxy-windows-x86_64.zip" { |
| 172 |
path "/src/target/dist-flat/oxy-windows-x86_64.zip" |
| 173 |
} |
| 174 |
artifact "oxy_amd64.deb" { |
| 175 |
path "/src/target/dist-flat/oxy_amd64.deb" |
| 176 |
} |
| 177 |
artifact "oxy_arm64.deb" { |
| 178 |
path "/src/target/dist-flat/oxy_arm64.deb" |
| 179 |
} |
| 180 |
artifact "oxy_riscv64.deb" { |
| 181 |
path "/src/target/dist-flat/oxy_riscv64.deb" |
| 182 |
} |
| 183 |
artifact "SHA256SUMS" { |
| 184 |
path "/src/target/dist-flat/SHA256SUMS" |
| 8d6cf1f2 Andy McCall ↶ |
185 |
} |
| 186 |
} |
| 187 |
} |
| 188 |
|
| 189 |
// The native RISC-V check (oxygenflow#69): oxy built and used on narvi-1, |
| 190 |
// a real riscv64 board, so each release is known to run there and not |
| 191 |
// only to cross-compile (dist). Like dist, a push runs it only when it |
| f5bd79d0 Andy McCall ↶ |
192 |
// touches these paths; "Run pipeline" and reruns always do. Its target |
| 193 |
// directory is cached between passing runs (oxygenflow#70). |
| 8d6cf1f2 Andy McCall ↶ |
194 |
job "riscv64" { |
| 195 |
sandbox "rust-riscv64" |
| 196 |
depends-on "fmt" |
| 197 |
scope "Cargo.toml" "scripts/dist.sh" "packaging/**" ".flow/riscv64-check.sh" |
| 198 |
timeout "3h" |
| 199 |
mount { |
| 200 |
source "ephemeral://disk" |
| 201 |
target "/src/target" |
| 202 |
size "16GiB" |
| f5bd79d0 Andy McCall ↶ |
203 |
// Kept from this job's last passing run in the syscall tier too |
| 204 |
// (oxygenflow#70): the first build is cold (~40 min on narvi-1), |
| 205 |
// later ones build only what changed. |
| 206 |
cache "target" |
| 207 |
key "Cargo.lock" |
| 8d6cf1f2 Andy McCall ↶ |
208 |
} |
| 209 |
exec "sh" ".flow/riscv64-check.sh" |
| 210 |
output { |
| 211 |
artifact "oxy-linux-riscv64-native" { |
| 212 |
path "/src/target/release/oxy" |
| b66a5c47 Andy McCall ↶ |
213 |
} |
| 214 |
} |
| 215 |
} |