OXYGENHUB
◆ v0.5.2 oxygenflow / .flow / pipeline.kdl
5.3 KiB · last changed The cheap checks run as WASM: layout, todos, size and summary are one WASI module (crates/flow-checks, .flow/checks.wasm), so any runner with the WASM tier takes them; the fmt job checks the module is what its source builds; the build image gains wasm32-wasip1 (re-pinned e52c41a1) (closes #96) 8 days 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
job "size" {
35
    sandbox "wasm"
36
    scope "crates/**" ".flow/checks.wasm"
37
    exec ".flow/checks.wasm" "size" "crates"
38
}
39
40
job "isolation" {
41
    sandbox "alpine"
42
    exec "sh" "-eu" ".flow/jobs/isolation.sh"
43
}
44
45
// The build image (images/rust): Rust with rustfmt and clippy, Node, and the
46
// vendored crates. oxygen comes from the pinned subrepo in deps/.
47
sandbox "rust" {
48
    runtime "microvm"
49
    rootfs "cas://blob/e52c41a173956b6bacc270eb81208a1b118b652412b84d15fa24708e6f8ec392"
50
    memory-limit "8GiB"
51
    cpu-limit 4
52
    network "loopback"
53
    // CI builds are thrown away: no incremental state and no debug info,
54
    // so less to compile, link and write (as in oxygenhub's pipeline).
55
    env {
56
        CARGO_INCREMENTAL "0"
57
        CARGO_PROFILE_DEV_DEBUG "0"
58
        CARGO_PROFILE_TEST_DEBUG "0"
59
        CARGO_PROFILE_RELEASE_DEBUG "0"
60
    }
61
}
62
63
sandbox "rust-small" {
64
    runtime "microvm"
65
    rootfs "cas://blob/e52c41a173956b6bacc270eb81208a1b118b652412b84d15fa24708e6f8ec392"
66
    memory-limit "1GiB"
67
    cpu-limit 1
68
    network "isolated"
69
}
70
71
job "fmt" {
72
    sandbox "rust-small"
73
    // This workspace only (--all would reach the pinned oxygen in deps/),
74
    // and the checks' committed WASI module is what its source builds (#96).
75
    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"
76
}
77
78
job "clippy" {
79
    sandbox "rust"
80
    depends-on "fmt"
81
    mount {
82
        source "ephemeral://disk"
83
        target "/src/target"
84
        size "16GiB"
85
        // Kept from this job's last passing run (oxygenflow#28): cargo
86
        // builds only what changed since.
87
        cache "target"
88
        key "Cargo.lock"
89
    }
90
    // One build identity for every CI state, so the cached target stays
91
    // fresh from one push to the next (oxygenflow#52).
92
    env {
93
        OXY_BUILD "ci"
94
    }
95
    exec "sh" ".flow/warm-target.sh" "cargo" "clippy" "--workspace" "--all-targets" "--locked" "--" "-D" "warnings"
96
}
97
98
job "test" {
99
    sandbox "rust"
100
    depends-on "fmt"
101
    mount {
102
        source "ephemeral://disk"
103
        target "/src/target"
104
        size "16GiB"
105
        // Kept from this job's last passing run (oxygenflow#28): cargo
106
        // builds only what changed since.
107
        cache "target"
108
        key "Cargo.lock"
109
    }
110
    // One build identity for every CI state, so the cached target stays
111
    // fresh from one push to the next (oxygenflow#52).
112
    env {
113
        OXY_BUILD "ci"
114
    }
115
    // The tests under cargo-nextest and cargo-llvm-cov (#82): a test report
116
    // (JUnit, kept whether or not they pass) and line coverage (LCOV) from
117
    // one run, for the hub's Tests and Coverage tabs.
118
    exec "sh" ".flow/warm-target.sh" "cargo" "llvm-cov" "nextest" "--workspace" "--locked" "--profile" "ci" "--lcov" "--output-path" "/src/target/lcov.info"
119
    output {
120
        artifact "junit" {
121
            path "/src/target/nextest/ci/junit.xml"
122
            when "always"
123
        }
124
        artifact "coverage" {
125
            path "/src/target/lcov.info"
126
        }
127
    }
128
}
129
130
// Runner builds for releases (oxygenhub#322): flow-linux-ARCH for x86_64,
131
// aarch64 and riscv64, which runners that update themselves are offered.
132
job "dist" {
133
    sandbox "rust"
134
    depends-on "fmt"
135
    scope "Cargo.toml" "scripts/dist.sh"
136
    mount {
137
        source "ephemeral://disk"
138
        target "/src/target"
139
        size "24GiB"
140
        cache "target"
141
        key "Cargo.lock"
142
    }
143
    env {
144
        DIST_FLAT "/src/target/dist-flat"
145
        ZIG_GLOBAL_CACHE_DIR "/src/target/zig-cache"
146
    }
147
    exec "bash" "scripts/dist.sh"
148
    output {
149
        artifact "flow-linux-x86_64" {
150
            path "/src/target/dist-flat/flow-linux-x86_64"
151
        }
152
        artifact "flow-linux-aarch64" {
153
            path "/src/target/dist-flat/flow-linux-aarch64"
154
        }
155
        artifact "flow-linux-riscv64" {
156
            path "/src/target/dist-flat/flow-linux-riscv64"
157
        }
158
        artifact "flow-windows-x86_64.exe" {
159
            path "/src/target/dist-flat/flow-windows-x86_64.exe"
160
        }
161
        artifact "SHA256SUMS" {
162
            path "/src/target/dist-flat/SHA256SUMS"
163
        }
164
    }
165
}
166
167
job "summary" {
168
    sandbox "wasm"
169
    depends-on "layout" "todos" "size" "isolation" "clippy" "test"
170
    env {
171
        PROJECT "OxygenFlow"
172
    }
173
    exec ".flow/checks.wasm" "summary"
174
}