OXYGENHUB
◆ v0.6.0 oxygenhub / .flow / pipeline.kdl
7.2 KiB · last changed CI: test-postgres gets a 40 GiB disk (24 GiB filled; the linker died with SIGBUS) 16 days ago source blame history raw
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
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.
12
sandbox "rust" {
13
    runtime "microvm"
14
    rootfs "cas://blob/57aa0b34c0cadd541cfe90ac2711200be46879ac9968778e3a3417eca04357e3"
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"
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
        // One build identity for every CI state, so a cached target stays
28
        // fresh from one push to the next (oxygenflow#52); dist sets the
29
        // release's own.
30
        OXY_BUILD "ci"
31
    }
32
}
33
34
sandbox "rust-small" {
35
    runtime "microvm"
36
    rootfs "cas://blob/57aa0b34c0cadd541cfe90ac2711200be46879ac9968778e3a3417eca04357e3"
37
    memory-limit "1GiB"
38
    cpu-limit 1
39
    network "isolated"
40
}
41
42
// The riscv64 build image on narvi-1 (oxygenflow#69): Ubuntu 24.04 riscv64
43
// with Rust 1.97.1 and the same vendored crates, in the syscall tier (the
44
// board has no hardware virtualisation, so no microVM). `runs-on` keeps it
45
// on a RISC-V runner.
46
sandbox "rust-riscv64" {
47
    runtime "syscall"
48
    rootfs "cas://blob/b4edba9173ddf63aa1df46222e6a59b265071b19f2815c89d0153b593835c616"
49
    runs-on "riscv64"
50
    memory-limit "4GiB"
51
    cpu-limit 6
52
    network "loopback"
53
    env {
54
        CARGO_INCREMENTAL "0"
55
        CARGO_PROFILE_RELEASE_DEBUG "0"
56
        CARGO_BUILD_JOBS "4"
57
    }
58
}
59
60
job "fmt" {
61
    sandbox "rust-small"
62
    // Only this workspace's packages: --all would also check the path
63
    // dependencies in deps/, which follow their own formatting.
64
    exec "cargo" "fmt" "--check" "-p" "oxygenhub" "-p" "hub-api" "-p" "oh"
65
}
66
67
job "clippy" {
68
    sandbox "rust"
69
    depends-on "fmt"
70
    mount {
71
        source "ephemeral://disk"
72
        target "/src/target"
73
        size "24GiB"
74
        // Kept from this job's last passing run (oxygenflow#28): cargo
75
        // builds only what changed since.
76
        cache "target"
77
        key "Cargo.lock"
78
    }
79
    exec "sh" ".flow/warm-target.sh" "cargo" "clippy" "--workspace" "--all-targets" "--locked" "--" "-D" "warnings"
80
}
81
82
job "test" {
83
    sandbox "rust"
84
    depends-on "fmt"
85
    mount {
86
        source "ephemeral://disk"
87
        target "/src/target"
88
        size "24GiB"
89
        // Kept from this job's last passing run (oxygenflow#28): cargo
90
        // builds only what changed since.
91
        cache "target"
92
        key "Cargo.lock"
93
    }
94
    exec "sh" ".flow/warm-target.sh" "cargo" "test" "--workspace" "--locked"
95
}
96
97
// The hub's tests again on PostgreSQL (#211, docs/postgres.md), against a
98
// server the job starts in its own guest.
99
job "test-postgres" {
100
    sandbox "rust"
101
    depends-on "fmt"
102
    mount {
103
        source "ephemeral://disk"
104
        target "/src/target"
105
        // 40 GiB (2026-10-20): its kept target holds the postgres-feature test
106
        // binaries beside older ones, and filled 24 GiB (the linker then dies
107
        // with SIGBUS writing its mmapped output).
108
        size "40GiB"
109
        cache "target"
110
        key "Cargo.lock"
111
    }
112
    exec "sh" ".flow/test-postgres.sh"
113
}
114
115
job "build" {
116
    sandbox "rust"
117
    depends-on "fmt"
118
    mount {
119
        source "ephemeral://disk"
120
        target "/src/target"
121
        size "24GiB"
122
        // Kept from this job's last passing run (oxygenflow#28): cargo
123
        // builds only what changed since.
124
        cache "target"
125
        key "Cargo.lock"
126
    }
127
    exec "sh" ".flow/warm-target.sh" "cargo" "build" "--release" "--locked"
128
}
129
130
// Release files for every platform (oxygen#59): scripts/dist.sh in the
131
// build image's cross toolchains. A push runs it only when it touches
132
// these paths (a release moves Cargo.toml's version); "Run pipeline" and
133
// reruns always do. The files are kept as this run's artifacts, named by
134
// its signed receipt, and attached to the release from there, so the
135
// release's trust page shows each as built here.
136
job "dist" {
137
    sandbox "rust"
138
    depends-on "fmt"
139
    scope "Cargo.toml" "scripts/dist.sh" "packaging/**"
140
    mount {
141
        source "ephemeral://disk"
142
        target "/src/target"
143
        size "24GiB"
144
        // Kept from this job's last passing run (oxygenflow#28): cargo
145
        // builds only what changed since.
146
        cache "target"
147
        key "Cargo.lock"
148
    }
149
    env {
150
        DIST_FLAT "/src/target/dist-flat"
151
        ZIG_GLOBAL_CACHE_DIR "/src/target/zig-cache"
152
    }
153
    exec "bash" "scripts/dist.sh"
154
    output {
155
        artifact "oh-linux-x86_64.tar.gz" {
156
            path "/src/target/dist-flat/oh-linux-x86_64.tar.gz"
157
        }
158
        artifact "oh-linux-arm64.tar.gz" {
159
            path "/src/target/dist-flat/oh-linux-arm64.tar.gz"
160
        }
161
        artifact "oh-linux-riscv64.tar.gz" {
162
            path "/src/target/dist-flat/oh-linux-riscv64.tar.gz"
163
        }
164
        artifact "oh-macos-x86_64.tar.gz" {
165
            path "/src/target/dist-flat/oh-macos-x86_64.tar.gz"
166
        }
167
        artifact "oh-macos-arm64.tar.gz" {
168
            path "/src/target/dist-flat/oh-macos-arm64.tar.gz"
169
        }
170
        artifact "oh-windows-x86_64.zip" {
171
            path "/src/target/dist-flat/oh-windows-x86_64.zip"
172
        }
173
        artifact "oh_amd64.deb" {
174
            path "/src/target/dist-flat/oh_amd64.deb"
175
        }
176
        artifact "oh_arm64.deb" {
177
            path "/src/target/dist-flat/oh_arm64.deb"
178
        }
179
        artifact "oh_riscv64.deb" {
180
            path "/src/target/dist-flat/oh_riscv64.deb"
181
        }
182
        artifact "oxygenhub-server-linux-x86_64.tar.gz" {
183
            path "/src/target/dist-flat/oxygenhub-server-linux-x86_64.tar.gz"
184
        }
185
        artifact "SHA256SUMS" {
186
            path "/src/target/dist-flat/SHA256SUMS"
187
        }
188
    }
189
}
190
191
// The native RISC-V check (oxygenflow#69): oh built and run on narvi-1, a
192
// real riscv64 board, so each release is known to run there and not only
193
// to cross-compile (dist). Like dist, a push runs it only when it touches
194
// these paths; "Run pipeline" and reruns always do. Its target directory
195
// is cached between passing runs (oxygenflow#70).
196
job "riscv64" {
197
    sandbox "rust-riscv64"
198
    depends-on "fmt"
199
    scope "Cargo.toml" "scripts/dist.sh" "packaging/**" ".flow/riscv64-check.sh"
200
    timeout "3h"
201
    mount {
202
        source "ephemeral://disk"
203
        target "/src/target"
204
        size "16GiB"
205
        cache "target"
206
        key "Cargo.lock"
207
    }
208
    exec "sh" ".flow/riscv64-check.sh"
209
    output {
210
        artifact "oh-linux-riscv64-native" {
211
            path "/src/target/release/oh"
212
        }
213
    }
214
}