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