OXYGENHUB
# 93f445fa50d8 +1 oxygenhub / .flow / pipeline.kdl
6.0 KiB · last changed Releases carry their source (oh-VERSION-src.tar.gz, subrepos inside) and assets have a fixed address, /OWNER/NAME/releases/download/TAG/FILE (refs andymccall/oxygen#157) 9 days ago source blame history raw
This file is in conflict in this state; the markers below are the conflict. All conflicts
380996db Andy McCall ↶ 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
705d11b0 Andy McCall ↶ 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.
380996db Andy McCall ↶ 12
sandbox "rust" {
13
    runtime "microvm"
913e5ad2 Andy McCall ↶ 14
    rootfs "cas://blob/d2d24c2211f00d6ccf89fbee63095ad2a81d0cc9af92d7a0ede9129e18d46e91"
380996db Andy McCall ↶ 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"
913e5ad2 Andy McCall ↶ 23
    rootfs "cas://blob/d2d24c2211f00d6ccf89fbee63095ad2a81d0cc9af92d7a0ede9129e18d46e91"
380996db Andy McCall ↶ 24
    memory-limit "1GiB"
25
    cpu-limit 1
26
    network "isolated"
27
}
28
29
job "fmt" {
30
    sandbox "rust-small"
31
    // Only this workspace's packages: --all would also check the path
32
    // dependencies in deps/, which follow their own formatting.
5c6e92fd Andy McCall ↶ 33
    exec "cargo" "fmt" "--check" "-p" "oxygenhub" "-p" "hub-api" "-p" "oh"
380996db Andy McCall ↶ 34
}
35
36
job "clippy" {
37
    sandbox "rust"
38
    depends-on "fmt"
39
    mount {
40
        source "ephemeral://disk"
41
        target "/src/target"
42
        size "24GiB"
43
    }
44
<<<<<<< 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"
45
    env {
46
        CARGO_INCREMENTAL "0"
705d11b0 Andy McCall ↶ 47
    }
380996db Andy McCall ↶ 48
======= oxy conflict 1 of 2, side 2 of 2: change bce3997c "CI starts from the build image's prebuilt dependencies"
49
    exec "sh" ".flow/warm-target.sh" "cargo" "clippy" "--workspace" "--all-targets" "--locked" "--" "-D" "warnings"
50
>>>>>>> oxy conflict 1 of 2 end
51
}
52
53
job "test" {
54
    sandbox "rust"
55
    depends-on "fmt"
56
    mount {
57
        source "ephemeral://disk"
58
        target "/src/target"
59
        size "24GiB"
60
    }
fbd7c855 Andy McCall ↶ 61
<<<<<<< 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"
62
    env {
63
        CARGO_INCREMENTAL "0"
64
    }
65
======= oxy conflict 2 of 2, side 2 of 2: change 28570ce2 "A test report and coverage from the hub's CI (closes #307)"
66
    // Under cargo-nextest (#307): a JUnit report for the hub's Tests tab,
67
    // kept whether or not the tests pass.
68
    exec "sh" ".flow/warm-target.sh" "cargo" "nextest" "run" "--workspace" "--locked" "--profile" "ci"
69
    output {
70
        artifact "junit" {
71
            path "/src/target/nextest/ci/junit.xml"
72
            when "always"
73
        }
74
    }
75
}
76
77
// Line coverage (#307) for the Coverage tab: the tests again, instrumented,
78
// in a job of its own beside `test`, so neither waits for the other and the
79
// instrumented build keeps its own cached target. Not a required check.
80
job "coverage" {
81
    sandbox "rust"
82
    depends-on "fmt"
83
    mount {
84
        source "ephemeral://disk"
85
        target "/src/target"
86
        size "48GiB"
87
        cache "coverage-target"
88
        key "Cargo.lock"
89
    }
90
    exec "cargo" "llvm-cov" "nextest" "--workspace" "--locked" "--profile" "ci" "--lcov" "--output-path" "/src/target/lcov.info"
380996db Andy McCall ↶ 91
    output {
92
        artifact "coverage" {
93
            path "/src/target/lcov.info"
94
        }
95
    }
96
>>>>>>> oxy conflict 2 of 2 end
97
}
98
99
job "build" {
100
    sandbox "rust"
101
    depends-on "fmt"
102
    mount {
103
        source "ephemeral://disk"
705d11b0 Andy McCall ↶ 104
        target "/src/target"
380996db Andy McCall ↶ 105
        size "24GiB"
913e5ad2 Andy McCall ↶ 106
    }
107
    env {
108
        CARGO_INCREMENTAL "0"
109
    }
110
    exec "sh" ".flow/warm-target.sh" "cargo" "build" "--release" "--locked"
111
}
112
113
// Release files for every platform (oxygen#59): scripts/dist.sh in the
114
// build image's cross toolchains. A push runs it only when it touches
115
// these paths (a release moves Cargo.toml's version); "Run pipeline" and
116
// reruns always do. The files are kept as this run's artifacts, named by
117
// its signed receipt, and attached to the release from there, so the
118
// release's trust page shows each as built here.
119
job "dist" {
120
    sandbox "rust"
121
    depends-on "fmt"
122
    scope "Cargo.toml" "scripts/dist.sh" "packaging/**"
123
    mount {
124
        source "ephemeral://disk"
125
        target "/src/target"
126
        size "24GiB"
127
    }
128
    env {
129
        DIST_FLAT "/src/target/dist-flat"
130
        ZIG_GLOBAL_CACHE_DIR "/src/target/zig-cache"
131
    }
132
    exec "bash" "scripts/dist.sh"
133
    output {
134
        artifact "oh-linux-x86_64.tar.gz" {
135
            path "/src/target/dist-flat/oh-linux-x86_64.tar.gz"
136
        }
137
        artifact "oh-linux-arm64.tar.gz" {
138
            path "/src/target/dist-flat/oh-linux-arm64.tar.gz"
139
        }
140
        artifact "oh-linux-riscv64.tar.gz" {
141
            path "/src/target/dist-flat/oh-linux-riscv64.tar.gz"
142
        }
143
        artifact "oh-macos-x86_64.tar.gz" {
144
            path "/src/target/dist-flat/oh-macos-x86_64.tar.gz"
145
        }
146
        artifact "oh-macos-arm64.tar.gz" {
147
            path "/src/target/dist-flat/oh-macos-arm64.tar.gz"
148
        }
149
        artifact "oh-windows-x86_64.zip" {
150
            path "/src/target/dist-flat/oh-windows-x86_64.zip"
151
        }
152
        artifact "oh_amd64.deb" {
153
            path "/src/target/dist-flat/oh_amd64.deb"
154
        }
e1540908 Andy McCall ↶ 155
        artifact "oh_arm64.deb" {
156
            path "/src/target/dist-flat/oh_arm64.deb"
157
        }
93f445fa Andy McCall ↶ 158
        artifact "oh_riscv64.deb" {
159
            path "/src/target/dist-flat/oh_riscv64.deb"
160
        }
913e5ad2 Andy McCall ↶ 161
        artifact "oxygenhub-server-linux-x86_64.tar.gz" {
162
            path "/src/target/dist-flat/oxygenhub-server-linux-x86_64.tar.gz"
163
        }
164
        artifact "oh-src.tar.gz" {
165
            path "/src/target/dist-flat/oh-src.tar.gz"
166
        }
167
        artifact "SHA256SUMS" {
168
            path "/src/target/dist-flat/SHA256SUMS"
169
        }
170
    }
171
}