OXYGENHUB
# 40a43921ef42 oxygenhub / .flow / pipeline.kdl
6.8 KiB · last changed New repository page with board and starting files; assetlinks.json; hung tests stopped; changelog on the WASM tier (closes #360, closes #365, closes #370) 3 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
// Cheap checks on the WASM tier (oxygenflow#96): OxygenFlow's checks module,
8
// copied from oxygenflow/.flow/checks.wasm (built there from
9
// crates/flow-checks; copy it again when it changes). No image and no KVM,
10
// so any runner with the WASM tier takes it: a phone, plex, windows-1.
11
sandbox "wasm" {
12
    runtime "wasm"
13
    memory-limit "64MiB"
14
}
15
16
// The changelog's shape, and a section for the version Cargo.toml says, so a
17
// release never finds its notes missing.
18
job "changelog" {
19
    sandbox "wasm"
20
    scope "CHANGELOG.md" "Cargo.toml" ".flow/checks.wasm"
21
    exec ".flow/checks.wasm" "changelog" "CHANGELOG.md" "Cargo.toml"
22
}
23
24
// The OxygenFlow build image: Rust with rustfmt and clippy, Node, every
25
// crate of Cargo.lock vendored, and this workspace's dependencies prebuilt
26
// in /opt/warm/oxygenhub, which .flow/warm-target.sh copies onto a job's
27
// target disk (oxygenflow/images/rust). Rebuild and re-pin it when
28
// Cargo.lock changes; until then only the changed crates are compiled.
29
sandbox "rust" {
30
    runtime "microvm"
31
    rootfs "cas://blob/57aa0b34c0cadd541cfe90ac2711200be46879ac9968778e3a3417eca04357e3"
32
    memory-limit "8GiB"
33
    cpu-limit 4
34
    // Tests serve and connect on 127.0.0.1; nothing leaves the guest.
35
    network "loopback"
36
}
37
38
sandbox "rust-small" {
39
    runtime "microvm"
40
    rootfs "cas://blob/57aa0b34c0cadd541cfe90ac2711200be46879ac9968778e3a3417eca04357e3"
41
    memory-limit "1GiB"
42
    cpu-limit 1
43
    network "isolated"
44
}
45
46
job "fmt" {
47
    sandbox "rust-small"
48
    // Only this workspace's packages: --all would also check the path
49
    // dependencies in deps/, which follow their own formatting.
50
    exec "cargo" "fmt" "--check" "-p" "oxygenhub" "-p" "hub-api" "-p" "oh"
51
}
52
53
job "clippy" {
54
    sandbox "rust"
55
    depends-on "fmt"
56
    mount {
57
        source "ephemeral://disk"
58
        target "/src/target"
59
        size "24GiB"
60
    }
61
<<<<<<< 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"
62
    env {
63
        CARGO_INCREMENTAL "0"
64
    }
65
======= oxy conflict 1 of 2, side 2 of 2: change bce3997c "CI starts from the build image's prebuilt dependencies"
66
    exec "sh" ".flow/warm-target.sh" "cargo" "clippy" "--workspace" "--all-targets" "--locked" "--" "-D" "warnings"
67
>>>>>>> oxy conflict 1 of 2 end
68
}
69
70
job "test" {
71
    sandbox "rust"
72
    depends-on "fmt"
73
    mount {
74
        source "ephemeral://disk"
75
        target "/src/target"
76
        size "24GiB"
77
    }
78
<<<<<<< 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"
79
    env {
80
        CARGO_INCREMENTAL "0"
81
    }
82
======= oxy conflict 2 of 2, side 2 of 2: change 28570ce2 "A test report and coverage from the hub's CI (closes #307)"
83
    // Under cargo-nextest (#307): a JUnit report for the hub's Tests tab,
84
    // kept whether or not the tests pass.
85
    exec "sh" ".flow/warm-target.sh" "cargo" "nextest" "run" "--workspace" "--locked" "--profile" "ci"
86
    output {
87
        artifact "junit" {
88
            path "/src/target/nextest/ci/junit.xml"
89
            when "always"
90
        }
91
    }
92
}
93
94
// Line coverage (#307) for the Coverage tab: the tests again, instrumented,
95
// in a job of its own beside `test`, so neither waits for the other and the
96
// instrumented build keeps its own cached target. Not a required check.
97
job "coverage" {
98
    sandbox "rust"
99
    depends-on "fmt"
100
    mount {
101
        source "ephemeral://disk"
102
        target "/src/target"
103
        size "48GiB"
104
        cache "coverage-target"
105
        key "Cargo.lock"
106
    }
107
    exec "cargo" "llvm-cov" "nextest" "--workspace" "--locked" "--profile" "ci" "--lcov" "--output-path" "/src/target/lcov.info"
108
    output {
109
        artifact "coverage" {
110
            path "/src/target/lcov.info"
111
        }
112
    }
113
>>>>>>> oxy conflict 2 of 2 end
114
}
115
116
// The hub's tests again on PostgreSQL (#211, docs/postgres.md), against a
117
// server the job starts in its own guest.
118
job "test-postgres" {
119
    sandbox "rust"
120
    depends-on "fmt"
121
    mount {
122
        source "ephemeral://disk"
123
        target "/src/target"
124
        size "24GiB"
125
        cache "target"
126
        key "Cargo.lock"
127
    }
128
    exec "sh" ".flow/test-postgres.sh"
129
}
130
131
job "build" {
132
    sandbox "rust"
133
    depends-on "fmt"
134
    mount {
135
        source "ephemeral://disk"
136
        target "/src/target"
137
        size "24GiB"
138
    }
139
    env {
140
        CARGO_INCREMENTAL "0"
141
    }
142
    exec "sh" ".flow/warm-target.sh" "cargo" "build" "--release" "--locked"
143
}
144
145
// Release files for every platform (oxygen#59): scripts/dist.sh in the
146
// build image's cross toolchains. A push runs it only when it touches
147
// these paths (a release moves Cargo.toml's version); "Run pipeline" and
148
// reruns always do. The files are kept as this run's artifacts, named by
149
// its signed receipt, and attached to the release from there, so the
150
// release's trust page shows each as built here.
151
job "dist" {
152
    sandbox "rust"
153
    depends-on "fmt"
154
    scope "Cargo.toml" "scripts/dist.sh" "packaging/**"
155
    mount {
156
        source "ephemeral://disk"
157
        target "/src/target"
158
        size "24GiB"
159
    }
160
    env {
161
        DIST_FLAT "/src/target/dist-flat"
162
        ZIG_GLOBAL_CACHE_DIR "/src/target/zig-cache"
163
    }
164
    exec "bash" "scripts/dist.sh"
165
    output {
166
        artifact "oh-linux-x86_64.tar.gz" {
167
            path "/src/target/dist-flat/oh-linux-x86_64.tar.gz"
168
        }
169
        artifact "oh-linux-arm64.tar.gz" {
170
            path "/src/target/dist-flat/oh-linux-arm64.tar.gz"
171
        }
172
        artifact "oh-linux-riscv64.tar.gz" {
173
            path "/src/target/dist-flat/oh-linux-riscv64.tar.gz"
174
        }
175
        artifact "oh-macos-x86_64.tar.gz" {
176
            path "/src/target/dist-flat/oh-macos-x86_64.tar.gz"
177
        }
178
        artifact "oh-macos-arm64.tar.gz" {
179
            path "/src/target/dist-flat/oh-macos-arm64.tar.gz"
180
        }
181
        artifact "oh-windows-x86_64.zip" {
182
            path "/src/target/dist-flat/oh-windows-x86_64.zip"
183
        }
184
        artifact "oh_amd64.deb" {
185
            path "/src/target/dist-flat/oh_amd64.deb"
186
        }
187
        artifact "oh_arm64.deb" {
188
            path "/src/target/dist-flat/oh_arm64.deb"
189
        }
190
        artifact "oh_riscv64.deb" {
191
            path "/src/target/dist-flat/oh_riscv64.deb"
192
        }
193
        artifact "SHA256SUMS" {
194
            path "/src/target/dist-flat/SHA256SUMS"
195
        }
196
    }
197
}