OXYGENHUB
◆ v0.3.1 oxygen / .flow / pipeline.kdl
4.0 KiB · last changed Pin the build image readable by any job user (refs andymccall/oxygen#59) 1 month ago source blame history raw
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"
11
    rootfs "cas://blob/b1a1a6c86a751649f90618ac8aaef40b472cdeec502a4467a8520b693340ed90"
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
    // CI builds are thrown away: no incremental state and no debug info,
17
    // so less to compile, link and write (as in oxygenhub's pipeline).
18
    env {
19
        CARGO_INCREMENTAL "0"
20
        CARGO_PROFILE_DEV_DEBUG "0"
21
        CARGO_PROFILE_TEST_DEBUG "0"
22
        CARGO_PROFILE_RELEASE_DEBUG "0"
23
    }
24
}
25
26
sandbox "rust-small" {
27
    runtime "microvm"
28
    rootfs "cas://blob/b1a1a6c86a751649f90618ac8aaef40b472cdeec502a4467a8520b693340ed90"
29
    memory-limit "1GiB"
30
    cpu-limit 1
31
    network "isolated"
32
}
33
34
job "fmt" {
35
    sandbox "rust-small"
36
    exec "cargo" "fmt" "--all" "--check"
37
}
38
39
job "clippy" {
40
    sandbox "rust"
41
    depends-on "fmt"
42
    mount {
43
        source "ephemeral://disk"
44
        target "/src/target"
45
        size "24GiB"
46
    }
47
    exec "sh" ".flow/warm-target.sh" "cargo" "clippy" "--workspace" "--all-targets" "--locked" "--" "-D" "warnings"
48
}
49
50
job "test" {
51
    sandbox "rust"
52
    depends-on "fmt"
53
    mount {
54
        source "ephemeral://disk"
55
        target "/src/target"
56
        size "24GiB"
57
    }
58
    exec "sh" ".flow/warm-target.sh" "cargo" "test" "--workspace" "--locked"
59
}
60
61
job "build" {
62
    sandbox "rust"
63
    depends-on "fmt"
64
    mount {
65
        source "ephemeral://disk"
66
        target "/src/target"
67
        size "24GiB"
68
    }
69
    exec "sh" ".flow/warm-target.sh" "cargo" "build" "--release" "--locked"
70
    // The binary, kept as a blob of this repository and named by the
71
    // job's signed receipt; the run page links it.
72
    output {
73
        artifact "oxy" {
74
            path "/src/target/release/oxy"
75
        }
76
    }
77
}
78
79
// Release files for every platform (oxygen#59): scripts/dist.sh in the
80
// build image's cross toolchains. A push runs it only when it touches
81
// these paths (a release moves Cargo.toml's version); "Run pipeline" and
82
// reruns always do. The files are kept as this run's artifacts, named by
83
// its signed receipt, and attached to the release from there, so the
84
// release's trust page shows each as built here.
85
job "dist" {
86
    sandbox "rust"
87
    depends-on "fmt"
88
    scope "Cargo.toml" "scripts/dist.sh" "packaging/**"
89
    mount {
90
        source "ephemeral://disk"
91
        target "/src/target"
92
        size "24GiB"
93
    }
94
    env {
95
        DIST_FLAT "/src/target/dist-flat"
96
        ZIG_GLOBAL_CACHE_DIR "/src/target/zig-cache"
97
    }
98
    exec "bash" "scripts/dist.sh"
99
    output {
100
        artifact "oxy-linux-x86_64.tar.gz" {
101
            path "/src/target/dist-flat/oxy-linux-x86_64.tar.gz"
102
        }
103
        artifact "oxy-linux-arm64.tar.gz" {
104
            path "/src/target/dist-flat/oxy-linux-arm64.tar.gz"
105
        }
106
        artifact "oxy-linux-riscv64.tar.gz" {
107
            path "/src/target/dist-flat/oxy-linux-riscv64.tar.gz"
108
        }
109
        artifact "oxy-macos-x86_64.tar.gz" {
110
            path "/src/target/dist-flat/oxy-macos-x86_64.tar.gz"
111
        }
112
        artifact "oxy-macos-arm64.tar.gz" {
113
            path "/src/target/dist-flat/oxy-macos-arm64.tar.gz"
114
        }
115
        artifact "oxy-windows-x86_64.zip" {
116
            path "/src/target/dist-flat/oxy-windows-x86_64.zip"
117
        }
118
        artifact "oxy_amd64.deb" {
119
            path "/src/target/dist-flat/oxy_amd64.deb"
120
        }
121
        artifact "oxy_arm64.deb" {
122
            path "/src/target/dist-flat/oxy_arm64.deb"
123
        }
124
        artifact "oxy_riscv64.deb" {
125
            path "/src/target/dist-flat/oxy_riscv64.deb"
126
        }
127
        artifact "SHA256SUMS" {
128
            path "/src/target/dist-flat/SHA256SUMS"
129
        }
130
    }
131
}