| 380996db Andy McCall ↶ |
1 |
// OxygenHub's 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. oxygen and oxygenflow come |
| 4 |
// from the pinned subrepos in deps/, which the runner puts in the workspace. |
| 5 |
schema-version 1 |
| 6 |
|
| 705d11b0 Andy McCall ↶ |
7 |
// The OxygenFlow build image: Rust with rustfmt and clippy, Node, every |
| 8 |
// crate of Cargo.lock vendored, and this workspace's dependencies prebuilt |
| 9 |
// in /opt/warm/oxygenhub, which .flow/warm-target.sh copies onto a job's |
| 10 |
// target disk (oxygenflow/images/rust). Rebuild and re-pin it when |
| 11 |
// Cargo.lock changes; until then only the changed crates are compiled. |
| 380996db Andy McCall ↶ |
12 |
sandbox "rust" { |
| 13 |
runtime "microvm" |
| 1f8a37d3 Andy McCall ↶ |
14 |
rootfs "cas://blob/7705d699a4fc06862e4297b7069396cf3b5b35b1d3f15191c46dc2031af17133" |
| 380996db Andy McCall ↶ |
15 |
memory-limit "8GiB" |
| 16 |
cpu-limit 4 |
| 17 |
// Tests serve and connect on 127.0.0.1; nothing leaves the guest. |
| 18 |
network "loopback" |
| 045f967d Andy McCall ↶ |
19 |
// CI builds are thrown away: no incremental state, and no debug info |
| 20 |
// (the release profile keeps line tables for the binary Earth runs, |
| 21 |
// which is built outside CI), so less to compile, link and write. |
| 22 |
env { |
| 23 |
CARGO_INCREMENTAL "0" |
| 24 |
CARGO_PROFILE_DEV_DEBUG "0" |
| 25 |
CARGO_PROFILE_TEST_DEBUG "0" |
| 26 |
CARGO_PROFILE_RELEASE_DEBUG "0" |
| 27 |
} |
| 380996db Andy McCall ↶ |
28 |
} |
| 29 |
|
| 30 |
sandbox "rust-small" { |
| 31 |
runtime "microvm" |
| 1f8a37d3 Andy McCall ↶ |
32 |
rootfs "cas://blob/7705d699a4fc06862e4297b7069396cf3b5b35b1d3f15191c46dc2031af17133" |
| 380996db Andy McCall ↶ |
33 |
memory-limit "1GiB" |
| 34 |
cpu-limit 1 |
| 35 |
network "isolated" |
| 36 |
} |
| 37 |
|
| 38 |
job "fmt" { |
| 39 |
sandbox "rust-small" |
| 40 |
// Only this workspace's packages: --all would also check the path |
| 41 |
// dependencies in deps/, which follow their own formatting. |
| 5c6e92fd Andy McCall ↶ |
42 |
exec "cargo" "fmt" "--check" "-p" "oxygenhub" "-p" "hub-api" "-p" "oh" |
| 380996db Andy McCall ↶ |
43 |
} |
| 44 |
|
| 45 |
job "clippy" { |
| 46 |
sandbox "rust" |
| 47 |
depends-on "fmt" |
| 48 |
mount { |
| 49 |
source "ephemeral://disk" |
| 50 |
target "/src/target" |
| 51 |
size "24GiB" |
| 52 |
} |
| 705d11b0 Andy McCall ↶ |
53 |
exec "sh" ".flow/warm-target.sh" "cargo" "clippy" "--workspace" "--all-targets" "--locked" "--" "-D" "warnings" |
| 380996db Andy McCall ↶ |
54 |
} |
| 55 |
|
| 56 |
job "test" { |
| 57 |
sandbox "rust" |
| 58 |
depends-on "fmt" |
| 59 |
mount { |
| 60 |
source "ephemeral://disk" |
| 61 |
target "/src/target" |
| 62 |
size "24GiB" |
| 63 |
} |
| 705d11b0 Andy McCall ↶ |
64 |
exec "sh" ".flow/warm-target.sh" "cargo" "test" "--workspace" "--locked" |
| 380996db Andy McCall ↶ |
65 |
} |
| 66 |
|
| 67 |
job "build" { |
| 68 |
sandbox "rust" |
| 69 |
depends-on "fmt" |
| 70 |
mount { |
| 71 |
source "ephemeral://disk" |
| 72 |
target "/src/target" |
| 73 |
size "24GiB" |
| 74 |
} |
| 705d11b0 Andy McCall ↶ |
75 |
exec "sh" ".flow/warm-target.sh" "cargo" "build" "--release" "--locked" |
| 380996db Andy McCall ↶ |
76 |
} |
| 913e5ad2 Andy McCall ↶ |
77 |
|
| 78 |
// Release files for every platform (oxygen#59): scripts/dist.sh in the |
| 79 |
// build image's cross toolchains. A push runs it only when it touches |
| 80 |
// these paths (a release moves Cargo.toml's version); "Run pipeline" and |
| 81 |
// reruns always do. The files are kept as this run's artifacts, named by |
| 82 |
// its signed receipt, and attached to the release from there, so the |
| 83 |
// release's trust page shows each as built here. |
| 84 |
job "dist" { |
| 85 |
sandbox "rust" |
| 86 |
depends-on "fmt" |
| 87 |
scope "Cargo.toml" "scripts/dist.sh" "packaging/**" |
| 88 |
mount { |
| 89 |
source "ephemeral://disk" |
| 90 |
target "/src/target" |
| 91 |
size "24GiB" |
| 92 |
} |
| 93 |
env { |
| 94 |
DIST_FLAT "/src/target/dist-flat" |
| 95 |
ZIG_GLOBAL_CACHE_DIR "/src/target/zig-cache" |
| 96 |
} |
| 97 |
exec "bash" "scripts/dist.sh" |
| 98 |
output { |
| 99 |
artifact "oh-linux-x86_64.tar.gz" { |
| 100 |
path "/src/target/dist-flat/oh-linux-x86_64.tar.gz" |
| 101 |
} |
| 102 |
artifact "oh-linux-arm64.tar.gz" { |
| 103 |
path "/src/target/dist-flat/oh-linux-arm64.tar.gz" |
| 104 |
} |
| 105 |
artifact "oh-linux-riscv64.tar.gz" { |
| 106 |
path "/src/target/dist-flat/oh-linux-riscv64.tar.gz" |
| 107 |
} |
| 108 |
artifact "oh-macos-x86_64.tar.gz" { |
| 109 |
path "/src/target/dist-flat/oh-macos-x86_64.tar.gz" |
| 110 |
} |
| 111 |
artifact "oh-macos-arm64.tar.gz" { |
| 112 |
path "/src/target/dist-flat/oh-macos-arm64.tar.gz" |
| 113 |
} |
| 114 |
artifact "oh-windows-x86_64.zip" { |
| 115 |
path "/src/target/dist-flat/oh-windows-x86_64.zip" |
| 116 |
} |
| 117 |
artifact "oh_amd64.deb" { |
| 118 |
path "/src/target/dist-flat/oh_amd64.deb" |
| 119 |
} |
| 120 |
artifact "oh_arm64.deb" { |
| 121 |
path "/src/target/dist-flat/oh_arm64.deb" |
| 122 |
} |
| 123 |
artifact "oh_riscv64.deb" { |
| 124 |
path "/src/target/dist-flat/oh_riscv64.deb" |
| 125 |
} |
| 126 |
artifact "SHA256SUMS" { |
| 127 |
path "/src/target/dist-flat/SHA256SUMS" |
| 128 |
} |
| 129 |
} |
| 130 |
} |