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