OXYGENHUB
# a451982b1d34 oxygen / .flow / pipeline.kdl
5.7 KiB · last changed ci: keep each build job's target from its last passing run (refs andymccall/oxygenflow#28) 24 days ago source blame history raw
This file is in conflict in this state; the markers below are the conflict. All conflicts
2b668d92 Andy McCall 1
// Oxygen's own 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.
4
schema-version 1
5
6
// The OxygenFlow build image: Rust with rustfmt and clippy, Node, and every
7
// crate of Cargo.lock vendored (oxygenflow/images/rust). Rebuild and re-pin
8
// it when Cargo.lock changes.
9
sandbox "rust" {
10
    runtime "microvm"
b66a5c47 Andy McCall ↶ 11
    rootfs "cas://blob/d2d24c2211f00d6ccf89fbee63095ad2a81d0cc9af92d7a0ede9129e18d46e91"
2b668d92 Andy McCall 12
    memory-limit "8GiB"
13
    cpu-limit 4
14
    // Tests serve and connect on 127.0.0.1; nothing leaves the guest.
15
    network "loopback"
16
}
17
18
sandbox "rust-small" {
19
    runtime "microvm"
b66a5c47 Andy McCall ↶ 20
    rootfs "cas://blob/d2d24c2211f00d6ccf89fbee63095ad2a81d0cc9af92d7a0ede9129e18d46e91"
2b668d92 Andy McCall 21
    memory-limit "1GiB"
22
    cpu-limit 1
23
    network "isolated"
24
}
25
26
job "fmt" {
27
    sandbox "rust-small"
28
    exec "cargo" "fmt" "--all" "--check"
29
}
30
31
job "clippy" {
32
    sandbox "rust"
33
    depends-on "fmt"
34
    mount {
35
        source "ephemeral://disk"
36
        target "/src/target"
37
        size "24GiB"
a451982b Andy McCall ↶ 38
        // Kept from this job's last passing run (oxygenflow#28): cargo
39
        // builds only what changed since.
40
        cache "target"
41
        key "Cargo.lock"
2b668d92 Andy McCall 42
    }
43
<<<<<<< oxy conflict 1 of 3, side 1 of 2: change 110a6605 "OxygenFlow pipeline: fmt, then clippy -D warnings, tests and a release build in microVMs on Earth, on every push"
44
    env {
45
        CARGO_INCREMENTAL "0"
a451982b Andy McCall ↶ 46
    }
47
======= oxy conflict 1 of 3, side 2 of 2: change a0ef6a8c "ci: keep each build job's target from its last passing run (refs andymccall/oxygenflow#28)"
48
    // One build identity for every CI state, so the cached target stays
49
    // fresh from one push to the next (oxygenflow#52).
50
    env {
ba1731bb Andy McCall ↶ 51
        OXY_BUILD "ci"
2b668d92 Andy McCall 52
    }
53
    exec "sh" ".flow/warm-target.sh" "cargo" "clippy" "--workspace" "--all-targets" "--locked" "--" "-D" "warnings"
54
>>>>>>> oxy conflict 1 of 3 end
55
}
56
57
job "test" {
58
    sandbox "rust"
59
    depends-on "fmt"
60
    mount {
61
        source "ephemeral://disk"
62
        target "/src/target"
63
        size "24GiB"
a451982b Andy McCall ↶ 64
<<<<<<< oxy conflict 2 of 3, side 1 of 2: change 110a6605 "OxygenFlow pipeline: fmt, then clippy -D warnings, tests and a release build in microVMs on Earth, on every push"
65
    }
66
    env {
67
        CARGO_INCREMENTAL "0"
68
======= oxy conflict 2 of 3, side 2 of 2: change a0ef6a8c "ci: keep each build job's target from its last passing run (refs andymccall/oxygenflow#28)"
69
        // Kept from this job's last passing run (oxygenflow#28): cargo
70
        // builds only what changed since.
71
        cache "target"
72
        key "Cargo.lock"
2b668d92 Andy McCall 73
    }
ba1731bb Andy McCall ↶ 74
    // One build identity for every CI state, so the cached target stays
2b668d92 Andy McCall 75
    // fresh from one push to the next (oxygenflow#52).
76
    env {
77
        OXY_BUILD "ci"
78
>>>>>>> oxy conflict 2 of 3 end
79
    }
80
    exec "sh" ".flow/warm-target.sh" "cargo" "test" "--workspace" "--locked"
81
}
82
83
job "build" {
84
    sandbox "rust"
85
    depends-on "fmt"
86
    mount {
a451982b Andy McCall ↶ 87
        source "ephemeral://disk"
88
        target "/src/target"
89
        size "24GiB"
90
<<<<<<< oxy conflict 3 of 3, side 1 of 2: change 110a6605 "OxygenFlow pipeline: fmt, then clippy -D warnings, tests and a release build in microVMs on Earth, on every push"
2b668d92 Andy McCall 91
    }
ba1731bb Andy McCall ↶ 92
    env {
2b668d92 Andy McCall 93
        CARGO_INCREMENTAL "0"
b66a5c47 Andy McCall ↶ 94
======= oxy conflict 3 of 3, side 2 of 2: change a0ef6a8c "ci: keep each build job's target from its last passing run (refs andymccall/oxygenflow#28)"
95
        // Kept from this job's last passing run (oxygenflow#28): cargo
96
        // builds only what changed since.
97
        cache "target"
98
        key "Cargo.lock"
99
>>>>>>> oxy conflict 3 of 3 end
100
    }
101
    exec "sh" ".flow/warm-target.sh" "cargo" "build" "--release" "--locked"
102
}
103
104
// Release files for every platform (oxygen#59): scripts/dist.sh in the
105
// build image's cross toolchains. A push runs it only when it touches
106
// these paths (a release moves Cargo.toml's version); "Run pipeline" and
107
// reruns always do. The files are kept as this run's artifacts, named by
108
// its signed receipt, and attached to the release from there, so the
a451982b Andy McCall ↶ 109
// release's trust page shows each as built here.
110
job "dist" {
111
    sandbox "rust"
112
    depends-on "fmt"
b66a5c47 Andy McCall ↶ 113
    scope "Cargo.toml" "scripts/dist.sh" "packaging/**"
114
    mount {
115
        source "ephemeral://disk"
116
        target "/src/target"
117
        size "24GiB"
118
        // Kept from this job's last passing run (oxygenflow#28): cargo
119
        // builds only what changed since.
120
        cache "target"
121
        key "Cargo.lock"
122
    }
123
    env {
124
        DIST_FLAT "/src/target/dist-flat"
125
        ZIG_GLOBAL_CACHE_DIR "/src/target/zig-cache"
126
    }
127
    exec "bash" "scripts/dist.sh"
128
    output {
129
        artifact "oxy-linux-x86_64.tar.gz" {
130
            path "/src/target/dist-flat/oxy-linux-x86_64.tar.gz"
131
        }
132
        artifact "oxy-linux-arm64.tar.gz" {
133
            path "/src/target/dist-flat/oxy-linux-arm64.tar.gz"
134
        }
135
        artifact "oxy-linux-riscv64.tar.gz" {
136
            path "/src/target/dist-flat/oxy-linux-riscv64.tar.gz"
137
        }
138
        artifact "oxy-macos-x86_64.tar.gz" {
139
            path "/src/target/dist-flat/oxy-macos-x86_64.tar.gz"
140
        }
141
        artifact "oxy-macos-arm64.tar.gz" {
142
            path "/src/target/dist-flat/oxy-macos-arm64.tar.gz"
143
        }
144
        artifact "oxy-windows-x86_64.zip" {
145
            path "/src/target/dist-flat/oxy-windows-x86_64.zip"
146
        }
147
        artifact "oxy_amd64.deb" {
148
            path "/src/target/dist-flat/oxy_amd64.deb"
149
        }
150
        artifact "oxy_arm64.deb" {
151
            path "/src/target/dist-flat/oxy_arm64.deb"
152
        }
153
        artifact "oxy_riscv64.deb" {
154
            path "/src/target/dist-flat/oxy_riscv64.deb"
155
        }
156
        artifact "SHA256SUMS" {
157
            path "/src/target/dist-flat/SHA256SUMS"
158
        }
159
    }
160
}