OXYGENHUB
◆ v0.5.0 oxygen / .flow / pipeline.kdl
6.9 KiB · last changed riscv64 check: init before the identity, and cache the target directory 16 days 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
// 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"
11
    rootfs "cas://blob/3fa57d4c1dc8aa5d4d92665bc13f332357f55042f658543dc21b1540b3aced69"
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"
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
    }
24
}
25
26
sandbox "rust-small" {
27
    runtime "microvm"
28
    rootfs "cas://blob/3fa57d4c1dc8aa5d4d92665bc13f332357f55042f658543dc21b1540b3aced69"
29
    memory-limit "1GiB"
30
    cpu-limit 1
31
    network "isolated"
32
}
33
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
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"
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"
68
    }
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
    }
74
    exec "sh" ".flow/warm-target.sh" "cargo" "clippy" "--workspace" "--all-targets" "--locked" "--" "-D" "warnings"
75
}
76
77
// The tests, run under cargo-llvm-cov so the hub's Coverage tab
78
// (oxygenhub#113) gets a report: the same tests, instrumented, and an LCOV
79
// file kept as the job's `coverage` artifact.
80
job "test" {
81
    sandbox "rust"
82
    depends-on "fmt"
83
    mount {
84
        source "ephemeral://disk"
85
        target "/src/target"
86
        size "24GiB"
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"
96
    }
97
    exec "cargo" "llvm-cov" "--workspace" "--locked" "--lcov" "--output-path" "/src/target/lcov.info"
98
    output {
99
        artifact "coverage" {
100
            path "/src/target/lcov.info"
101
        }
102
    }
103
}
104
105
job "build" {
106
    sandbox "rust"
107
    depends-on "fmt"
108
    mount {
109
        source "ephemeral://disk"
110
        target "/src/target"
111
        size "24GiB"
112
        // Kept from this job's last passing run (oxygenflow#28): cargo
113
        // builds only what changed since.
114
        cache "target"
115
        key "Cargo.lock"
116
    }
117
    exec "sh" ".flow/warm-target.sh" "cargo" "build" "--release" "--locked"
118
    // The binary, kept as a blob of this repository and named by the
119
    // job's signed receipt; the run page links it.
120
    output {
121
        artifact "oxy" {
122
            path "/src/target/release/oxy"
123
        }
124
    }
125
}
126
127
// Release files for every platform (oxygen#59): scripts/dist.sh in the
128
// build image's cross toolchains. A push runs it only when it touches
129
// these paths (a release moves Cargo.toml's version); "Run pipeline" and
130
// reruns always do. The files are kept as this run's artifacts, named by
131
// its signed receipt, and attached to the release from there, so the
132
// release's trust page shows each as built here.
133
job "dist" {
134
    sandbox "rust"
135
    depends-on "fmt"
136
    scope "Cargo.toml" "scripts/dist.sh" "packaging/**"
137
    mount {
138
        source "ephemeral://disk"
139
        target "/src/target"
140
        size "24GiB"
141
        // Kept from this job's last passing run (oxygenflow#28): cargo
142
        // builds only what changed since.
143
        cache "target"
144
        key "Cargo.lock"
145
    }
146
    env {
147
        DIST_FLAT "/src/target/dist-flat"
148
        ZIG_GLOBAL_CACHE_DIR "/src/target/zig-cache"
149
    }
150
    exec "bash" "scripts/dist.sh"
151
    output {
152
        artifact "oxy-linux-x86_64.tar.gz" {
153
            path "/src/target/dist-flat/oxy-linux-x86_64.tar.gz"
154
        }
155
        artifact "oxy-linux-arm64.tar.gz" {
156
            path "/src/target/dist-flat/oxy-linux-arm64.tar.gz"
157
        }
158
        artifact "oxy-linux-riscv64.tar.gz" {
159
            path "/src/target/dist-flat/oxy-linux-riscv64.tar.gz"
160
        }
161
        artifact "oxy-macos-x86_64.tar.gz" {
162
            path "/src/target/dist-flat/oxy-macos-x86_64.tar.gz"
163
        }
164
        artifact "oxy-macos-arm64.tar.gz" {
165
            path "/src/target/dist-flat/oxy-macos-arm64.tar.gz"
166
        }
167
        artifact "oxy-windows-x86_64.zip" {
168
            path "/src/target/dist-flat/oxy-windows-x86_64.zip"
169
        }
170
        artifact "oxy_amd64.deb" {
171
            path "/src/target/dist-flat/oxy_amd64.deb"
172
        }
173
        artifact "oxy_arm64.deb" {
174
            path "/src/target/dist-flat/oxy_arm64.deb"
175
        }
176
        artifact "oxy_riscv64.deb" {
177
            path "/src/target/dist-flat/oxy_riscv64.deb"
178
        }
179
        artifact "SHA256SUMS" {
180
            path "/src/target/dist-flat/SHA256SUMS"
181
        }
182
    }
183
}
184
185
// The native RISC-V check (oxygenflow#69): oxy built and used on narvi-1,
186
// a real riscv64 board, so each release is known to run there and not
187
// only to cross-compile (dist). Like dist, a push runs it only when it
188
// touches these paths; "Run pipeline" and reruns always do. Its target
189
// directory is cached between passing runs (oxygenflow#70).
190
job "riscv64" {
191
    sandbox "rust-riscv64"
192
    depends-on "fmt"
193
    scope "Cargo.toml" "scripts/dist.sh" "packaging/**" ".flow/riscv64-check.sh"
194
    timeout "3h"
195
    mount {
196
        source "ephemeral://disk"
197
        target "/src/target"
198
        size "16GiB"
199
        // Kept from this job's last passing run in the syscall tier too
200
        // (oxygenflow#70): the first build is cold (~40 min on narvi-1),
201
        // later ones build only what changed.
202
        cache "target"
203
        key "Cargo.lock"
204
    }
205
    exec "sh" ".flow/riscv64-check.sh"
206
    output {
207
        artifact "oxy-linux-riscv64-native" {
208
            path "/src/target/release/oxy"
209
        }
210
    }
211
}