OXYGENHUB
◆ main oxygenflow / .flow / pipeline.kdl
5.6 KiB · last changed A changelog check on the WASM tier, a job in Flow's pipeline 23 hours ago source blame history raw
1
// OxygenFlow's own pipeline (docs/m0.md). Runs in Firecracker microVMs on
2
// Earth for every push to a bookmark; see the Flow tab on OxygenHub.
3
schema-version 1
4
5
sandbox "alpine" {
6
    runtime "microvm"
7
    // Alpine 3.24.2 minirootfs, imported on Earth with `flow rootfs import`.
8
    rootfs "cas://blob/e95d22fb2380b67193f2640a12c2f8c7bae485f6fd14330bdb0c7157faa588dc"
9
    memory-limit "256MiB"
10
    cpu-limit 1
11
    network "isolated"
12
}
13
14
// The cheap checks as one WASI module (#96): crates/flow-checks, built by
15
// scripts/checks-wasm.sh and committed as .flow/checks.wasm (the fmt job
16
// fails if it is not what the source builds). No image and no KVM, so any
17
// runner with the WASM tier takes them: the phone, plex, windows-1.
18
sandbox "wasm" {
19
    runtime "wasm"
20
    memory-limit "64MiB"
21
}
22
23
job "layout" {
24
    sandbox "wasm"
25
    exec ".flow/checks.wasm" "layout" "Cargo.toml" "docs/m0.md" "crates/flow-core/src/pipeline.rs" "crates/flow-init/src/main.rs" "crates/flow/src/microvm.rs"
26
}
27
28
job "todos" {
29
    sandbox "wasm"
30
    scope "crates/**" ".flow/checks.wasm"
31
    exec ".flow/checks.wasm" "todos" "crates"
32
}
33
34
// The changelog's shape, and a section for the version Cargo.toml says, so
35
// a release never finds its notes missing.
36
job "changelog" {
37
    sandbox "wasm"
38
    scope "CHANGELOG.md" "Cargo.toml" ".flow/checks.wasm"
39
    exec ".flow/checks.wasm" "changelog" "CHANGELOG.md" "Cargo.toml"
40
}
41
42
job "size" {
43
    sandbox "wasm"
44
    scope "crates/**" ".flow/checks.wasm"
45
    exec ".flow/checks.wasm" "size" "crates"
46
}
47
48
job "isolation" {
49
    sandbox "alpine"
50
    exec "sh" "-eu" ".flow/jobs/isolation.sh"
51
}
52
53
// The build image (images/rust): Rust with rustfmt and clippy, Node, and the
54
// vendored crates. oxygen comes from the pinned subrepo in deps/.
55
sandbox "rust" {
56
    runtime "microvm"
57
    rootfs "cas://blob/e52c41a173956b6bacc270eb81208a1b118b652412b84d15fa24708e6f8ec392"
58
    memory-limit "8GiB"
59
    cpu-limit 4
60
    network "loopback"
61
    // CI builds are thrown away: no incremental state and no debug info,
62
    // so less to compile, link and write (as in oxygenhub's pipeline).
63
    env {
64
        CARGO_INCREMENTAL "0"
65
        CARGO_PROFILE_DEV_DEBUG "0"
66
        CARGO_PROFILE_TEST_DEBUG "0"
67
        CARGO_PROFILE_RELEASE_DEBUG "0"
68
    }
69
}
70
71
sandbox "rust-small" {
72
    runtime "microvm"
73
    rootfs "cas://blob/e52c41a173956b6bacc270eb81208a1b118b652412b84d15fa24708e6f8ec392"
74
    memory-limit "1GiB"
75
    cpu-limit 1
76
    network "isolated"
77
}
78
79
job "fmt" {
80
    sandbox "rust-small"
81
    // This workspace only (--all would reach the pinned oxygen in deps/),
82
    // and the checks' committed WASI module is what its source builds (#96).
83
    exec "sh" "-euc" "cargo fmt --check -p flow -p flow-core -p flow-init -p flow-casfs -p flow-checks && sh scripts/checks-wasm.sh --check"
84
}
85
86
job "clippy" {
87
    sandbox "rust"
88
    depends-on "fmt"
89
    mount {
90
        source "ephemeral://disk"
91
        target "/src/target"
92
        size "16GiB"
93
        // Kept from this job's last passing run (oxygenflow#28): cargo
94
        // builds only what changed since.
95
        cache "target"
96
        key "Cargo.lock"
97
    }
98
    // One build identity for every CI state, so the cached target stays
99
    // fresh from one push to the next (oxygenflow#52).
100
    env {
101
        OXY_BUILD "ci"
102
    }
103
    exec "sh" ".flow/warm-target.sh" "cargo" "clippy" "--workspace" "--all-targets" "--locked" "--" "-D" "warnings"
104
}
105
106
job "test" {
107
    sandbox "rust"
108
    depends-on "fmt"
109
    mount {
110
        source "ephemeral://disk"
111
        target "/src/target"
112
        size "16GiB"
113
        // Kept from this job's last passing run (oxygenflow#28): cargo
114
        // builds only what changed since.
115
        cache "target"
116
        key "Cargo.lock"
117
    }
118
    // One build identity for every CI state, so the cached target stays
119
    // fresh from one push to the next (oxygenflow#52).
120
    env {
121
        OXY_BUILD "ci"
122
    }
123
    // The tests under cargo-nextest and cargo-llvm-cov (#82): a test report
124
    // (JUnit, kept whether or not they pass) and line coverage (LCOV) from
125
    // one run, for the hub's Tests and Coverage tabs.
126
    exec "sh" ".flow/warm-target.sh" "cargo" "llvm-cov" "nextest" "--workspace" "--locked" "--profile" "ci" "--lcov" "--output-path" "/src/target/lcov.info"
127
    output {
128
        artifact "junit" {
129
            path "/src/target/nextest/ci/junit.xml"
130
            when "always"
131
        }
132
        artifact "coverage" {
133
            path "/src/target/lcov.info"
134
        }
135
    }
136
}
137
138
// Runner builds for releases (oxygenhub#322): flow-linux-ARCH for x86_64,
139
// aarch64 and riscv64, which runners that update themselves are offered.
140
job "dist" {
141
    sandbox "rust"
142
    depends-on "fmt"
143
    scope "Cargo.toml" "scripts/dist.sh"
144
    mount {
145
        source "ephemeral://disk"
146
        target "/src/target"
147
        size "24GiB"
148
        cache "target"
149
        key "Cargo.lock"
150
    }
151
    env {
152
        DIST_FLAT "/src/target/dist-flat"
153
        ZIG_GLOBAL_CACHE_DIR "/src/target/zig-cache"
154
    }
155
    exec "bash" "scripts/dist.sh"
156
    output {
157
        artifact "flow-linux-x86_64" {
158
            path "/src/target/dist-flat/flow-linux-x86_64"
159
        }
160
        artifact "flow-linux-aarch64" {
161
            path "/src/target/dist-flat/flow-linux-aarch64"
162
        }
163
        artifact "flow-linux-riscv64" {
164
            path "/src/target/dist-flat/flow-linux-riscv64"
165
        }
166
        artifact "flow-windows-x86_64.exe" {
167
            path "/src/target/dist-flat/flow-windows-x86_64.exe"
168
        }
169
        artifact "SHA256SUMS" {
170
            path "/src/target/dist-flat/SHA256SUMS"
171
        }
172
    }
173
}
174
175
job "summary" {
176
    sandbox "wasm"
177
    depends-on "layout" "todos" "size" "isolation" "clippy" "test"
178
    env {
179
        PROJECT "OxygenFlow"
180
    }
181
    exec ".flow/checks.wasm" "summary"
182
}