OXYGENHUB
◆ v0.5.2 oxygenhub / .flow / pipeline.kdl
5.1 KiB · last changed ci: one build identity for CI states, so cached targets stay fresh (refs andymccall/oxygenflow#52) 23 days ago source blame history raw
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
// 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.
12
sandbox "rust" {
13
    runtime "microvm"
14
    rootfs "cas://blob/3fa57d4c1dc8aa5d4d92665bc13f332357f55042f658543dc21b1540b3aced69"
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
    // CI builds are thrown away: no incremental state, and no debug info
20
    // (the release profile keeps line tables for the binary Earth runs,
21
    // which is built outside CI), so less to compile, link and write.
22
    env {
23
        CARGO_INCREMENTAL "0"
24
        CARGO_PROFILE_DEV_DEBUG "0"
25
        CARGO_PROFILE_TEST_DEBUG "0"
26
        CARGO_PROFILE_RELEASE_DEBUG "0"
27
        // One build identity for every CI state, so a cached target stays
28
        // fresh from one push to the next (oxygenflow#52); dist sets the
29
        // release's own.
30
        OXY_BUILD "ci"
31
    }
32
}
33
34
sandbox "rust-small" {
35
    runtime "microvm"
36
    rootfs "cas://blob/3fa57d4c1dc8aa5d4d92665bc13f332357f55042f658543dc21b1540b3aced69"
37
    memory-limit "1GiB"
38
    cpu-limit 1
39
    network "isolated"
40
}
41
42
job "fmt" {
43
    sandbox "rust-small"
44
    // Only this workspace's packages: --all would also check the path
45
    // dependencies in deps/, which follow their own formatting.
46
    exec "cargo" "fmt" "--check" "-p" "oxygenhub" "-p" "hub-api" "-p" "oh"
47
}
48
49
job "clippy" {
50
    sandbox "rust"
51
    depends-on "fmt"
52
    mount {
53
        source "ephemeral://disk"
54
        target "/src/target"
55
        size "24GiB"
56
        // Kept from this job's last passing run (oxygenflow#28): cargo
57
        // builds only what changed since.
58
        cache "target"
59
        key "Cargo.lock"
60
    }
61
    exec "sh" ".flow/warm-target.sh" "cargo" "clippy" "--workspace" "--all-targets" "--locked" "--" "-D" "warnings"
62
}
63
64
job "test" {
65
    sandbox "rust"
66
    depends-on "fmt"
67
    mount {
68
        source "ephemeral://disk"
69
        target "/src/target"
70
        size "24GiB"
71
        // Kept from this job's last passing run (oxygenflow#28): cargo
72
        // builds only what changed since.
73
        cache "target"
74
        key "Cargo.lock"
75
    }
76
    exec "sh" ".flow/warm-target.sh" "cargo" "test" "--workspace" "--locked"
77
}
78
79
job "build" {
80
    sandbox "rust"
81
    depends-on "fmt"
82
    mount {
83
        source "ephemeral://disk"
84
        target "/src/target"
85
        size "24GiB"
86
        // Kept from this job's last passing run (oxygenflow#28): cargo
87
        // builds only what changed since.
88
        cache "target"
89
        key "Cargo.lock"
90
    }
91
    exec "sh" ".flow/warm-target.sh" "cargo" "build" "--release" "--locked"
92
}
93
94
// Release files for every platform (oxygen#59): scripts/dist.sh in the
95
// build image's cross toolchains. A push runs it only when it touches
96
// these paths (a release moves Cargo.toml's version); "Run pipeline" and
97
// reruns always do. The files are kept as this run's artifacts, named by
98
// its signed receipt, and attached to the release from there, so the
99
// release's trust page shows each as built here.
100
job "dist" {
101
    sandbox "rust"
102
    depends-on "fmt"
103
    scope "Cargo.toml" "scripts/dist.sh" "packaging/**"
104
    mount {
105
        source "ephemeral://disk"
106
        target "/src/target"
107
        size "24GiB"
108
        // Kept from this job's last passing run (oxygenflow#28): cargo
109
        // builds only what changed since.
110
        cache "target"
111
        key "Cargo.lock"
112
    }
113
    env {
114
        DIST_FLAT "/src/target/dist-flat"
115
        ZIG_GLOBAL_CACHE_DIR "/src/target/zig-cache"
116
    }
117
    exec "bash" "scripts/dist.sh"
118
    output {
119
        artifact "oh-linux-x86_64.tar.gz" {
120
            path "/src/target/dist-flat/oh-linux-x86_64.tar.gz"
121
        }
122
        artifact "oh-linux-arm64.tar.gz" {
123
            path "/src/target/dist-flat/oh-linux-arm64.tar.gz"
124
        }
125
        artifact "oh-linux-riscv64.tar.gz" {
126
            path "/src/target/dist-flat/oh-linux-riscv64.tar.gz"
127
        }
128
        artifact "oh-macos-x86_64.tar.gz" {
129
            path "/src/target/dist-flat/oh-macos-x86_64.tar.gz"
130
        }
131
        artifact "oh-macos-arm64.tar.gz" {
132
            path "/src/target/dist-flat/oh-macos-arm64.tar.gz"
133
        }
134
        artifact "oh-windows-x86_64.zip" {
135
            path "/src/target/dist-flat/oh-windows-x86_64.zip"
136
        }
137
        artifact "oh_amd64.deb" {
138
            path "/src/target/dist-flat/oh_amd64.deb"
139
        }
140
        artifact "oh_arm64.deb" {
141
            path "/src/target/dist-flat/oh_arm64.deb"
142
        }
143
        artifact "oh_riscv64.deb" {
144
            path "/src/target/dist-flat/oh_riscv64.deb"
145
        }
146
        artifact "SHA256SUMS" {
147
            path "/src/target/dist-flat/SHA256SUMS"
148
        }
149
    }
150
}