OXYGENHUB
# f5bd79d06f5c oxygen / .flow / pipeline.kdl
5.5 KiB · last changed riscv64 check: init before the identity, and cache the target directory 18 days ago source blame history raw
This file is in conflict in this state; the markers below are the conflict. All conflicts
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/d2d24c2211f00d6ccf89fbee63095ad2a81d0cc9af92d7a0ede9129e18d46e91"
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
}
17
18
sandbox "rust-small" {
19
    runtime "microvm"
20
    rootfs "cas://blob/d2d24c2211f00d6ccf89fbee63095ad2a81d0cc9af92d7a0ede9129e18d46e91"
21
    memory-limit "1GiB"
22
    cpu-limit 1
23
    network "isolated"
24
}
25
26
// The riscv64 build image on narvi-1 (oxygenflow#69): Ubuntu 24.04 riscv64
27
// with Rust 1.97.1 and the same vendored crates, in the syscall tier (the
28
// board has no hardware virtualisation, so no microVM). `runs-on` keeps it
29
// on a RISC-V runner.
30
sandbox "rust-riscv64" {
31
    runtime "syscall"
32
    rootfs "cas://blob/b4edba9173ddf63aa1df46222e6a59b265071b19f2815c89d0153b593835c616"
33
    runs-on "riscv64"
34
    memory-limit "4GiB"
35
    cpu-limit 6
36
    network "loopback"
37
    env {
38
        CARGO_INCREMENTAL "0"
39
        CARGO_PROFILE_RELEASE_DEBUG "0"
40
        CARGO_BUILD_JOBS "4"
41
    }
42
}
43
44
job "fmt" {
45
    sandbox "rust-small"
46
    exec "cargo" "fmt" "--all" "--check"
47
}
48
49
job "clippy" {
50
    sandbox "rust"
51
    depends-on "fmt"
52
    mount {
53
        source "ephemeral://disk"
54
        target "/src/target"
55
        size "24GiB"
56
    }
57
<<<<<<< oxy conflict 1 of 1, side 1 of 2: change 110a6605 "OxygenFlow pipeline: fmt, then clippy -D warnings, tests and a release build in microVMs on Earth, on every push"
58
    env {
59
        CARGO_INCREMENTAL "0"
60
    }
61
======= oxy conflict 1 of 1, side 2 of 2: change 116da477 "CI starts from the build image's prebuilt dependencies"
62
    exec "sh" ".flow/warm-target.sh" "cargo" "clippy" "--workspace" "--all-targets" "--locked" "--" "-D" "warnings"
63
>>>>>>> oxy conflict 1 of 1 end
64
}
65
66
job "test" {
67
    sandbox "rust"
68
    depends-on "fmt"
69
    mount {
70
        source "ephemeral://disk"
71
        target "/src/target"
72
        size "24GiB"
73
    }
74
    env {
75
        CARGO_INCREMENTAL "0"
76
    }
77
    exec "sh" ".flow/warm-target.sh" "cargo" "test" "--workspace" "--locked"
78
}
79
80
job "build" {
81
    sandbox "rust"
82
    depends-on "fmt"
83
    mount {
84
        source "ephemeral://disk"
85
        target "/src/target"
86
        size "24GiB"
87
    }
88
    env {
89
        CARGO_INCREMENTAL "0"
90
    }
91
    exec "sh" ".flow/warm-target.sh" "cargo" "build" "--release" "--locked"
92
}
93
94
// Release files for every platform (oxygen#59): scripts/dist.sh in the
95
// build image's cross toolchains. A push runs it only when it touches
96
// these paths (a release moves Cargo.toml's version); "Run pipeline" and
97
// reruns always do. The files are kept as this run's artifacts, named by
98
// its signed receipt, and attached to the release from there, so the
99
// release's trust page shows each as built here.
100
job "dist" {
101
    sandbox "rust"
102
    depends-on "fmt"
103
    scope "Cargo.toml" "scripts/dist.sh" "packaging/**"
104
    mount {
105
        source "ephemeral://disk"
106
        target "/src/target"
107
        size "24GiB"
108
    }
109
    env {
110
        DIST_FLAT "/src/target/dist-flat"
111
        ZIG_GLOBAL_CACHE_DIR "/src/target/zig-cache"
112
    }
113
    exec "bash" "scripts/dist.sh"
114
    output {
115
        artifact "oxy-linux-x86_64.tar.gz" {
116
            path "/src/target/dist-flat/oxy-linux-x86_64.tar.gz"
117
        }
118
        artifact "oxy-linux-arm64.tar.gz" {
119
            path "/src/target/dist-flat/oxy-linux-arm64.tar.gz"
120
        }
121
        artifact "oxy-linux-riscv64.tar.gz" {
122
            path "/src/target/dist-flat/oxy-linux-riscv64.tar.gz"
123
        }
124
        artifact "oxy-macos-x86_64.tar.gz" {
125
            path "/src/target/dist-flat/oxy-macos-x86_64.tar.gz"
126
        }
127
        artifact "oxy-macos-arm64.tar.gz" {
128
            path "/src/target/dist-flat/oxy-macos-arm64.tar.gz"
129
        }
130
        artifact "oxy-windows-x86_64.zip" {
131
            path "/src/target/dist-flat/oxy-windows-x86_64.zip"
132
        }
133
        artifact "oxy_amd64.deb" {
134
            path "/src/target/dist-flat/oxy_amd64.deb"
135
        }
136
        artifact "oxy_arm64.deb" {
137
            path "/src/target/dist-flat/oxy_arm64.deb"
138
        }
139
        artifact "oxy_riscv64.deb" {
140
            path "/src/target/dist-flat/oxy_riscv64.deb"
141
        }
142
        artifact "SHA256SUMS" {
143
            path "/src/target/dist-flat/SHA256SUMS"
144
        }
145
    }
146
}
147
148
// The native RISC-V check (oxygenflow#69): oxy built and used on narvi-1,
149
// a real riscv64 board, so each release is known to run there and not
150
// only to cross-compile (dist). Like dist, a push runs it only when it
151
// touches these paths; "Run pipeline" and reruns always do. Its target
152
// directory is cached between passing runs (oxygenflow#70).
153
job "riscv64" {
154
    sandbox "rust-riscv64"
155
    depends-on "fmt"
156
    scope "Cargo.toml" "scripts/dist.sh" "packaging/**" ".flow/riscv64-check.sh"
157
    timeout "3h"
158
    mount {
159
        source "ephemeral://disk"
160
        target "/src/target"
161
        size "16GiB"
162
        // Kept from this job's last passing run in the syscall tier too
163
        // (oxygenflow#70): the first build is cold (~40 min on narvi-1),
164
        // later ones build only what changed.
165
        cache "target"
166
        key "Cargo.lock"
167
    }
168
    exec "sh" ".flow/riscv64-check.sh"
169
    output {
170
        artifact "oxy-linux-riscv64-native" {
171
            path "/src/target/release/oxy"
172
        }
173
    }
174
}