OXYGENHUB
# e8534c304744 oxygenhub / .flow / pipeline.kdl
5.2 KiB · last changed CI on the Rust image with cargo-nextest (refs #307) 11 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
// 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/836461b613019f62399a960c61a25c482eb74e30054ff2cd44d5594c3305872b"
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"
23
    rootfs "cas://blob/836461b613019f62399a960c61a25c482eb74e30054ff2cd44d5594c3305872b"
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.
33
    exec "cargo" "fmt" "--check" "-p" "oxygenhub" "-p" "hub-api"
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"
47
    }
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
    }
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 bce3997c "CI starts from the build image's prebuilt dependencies"
66
    exec "sh" ".flow/warm-target.sh" "cargo" "test" "--workspace" "--locked"
67
>>>>>>> oxy conflict 2 of 2 end
68
}
69
70
// The hub's tests again on PostgreSQL (#211, docs/postgres.md), against a
71
// server the job starts in its own guest.
72
job "test-postgres" {
73
    sandbox "rust"
74
    depends-on "fmt"
75
    mount {
76
        source "ephemeral://disk"
77
        target "/src/target"
78
        size "24GiB"
79
        cache "target"
80
        key "Cargo.lock"
81
    }
82
    exec "sh" ".flow/test-postgres.sh"
83
}
84
85
job "build" {
86
    sandbox "rust"
87
    depends-on "fmt"
88
    mount {
89
        source "ephemeral://disk"
90
        target "/src/target"
91
        size "24GiB"
92
    }
93
    env {
94
        CARGO_INCREMENTAL "0"
95
    }
96
    exec "sh" ".flow/warm-target.sh" "cargo" "build" "--release" "--locked"
97
}
98
99
// Release files for every platform (oxygen#59): scripts/dist.sh in the
100
// build image's cross toolchains. A push runs it only when it touches
101
// these paths (a release moves Cargo.toml's version); "Run pipeline" and
102
// reruns always do. The files are kept as this run's artifacts, named by
103
// its signed receipt, and attached to the release from there, so the
104
// release's trust page shows each as built here.
105
job "dist" {
106
    sandbox "rust"
107
    depends-on "fmt"
108
    scope "Cargo.toml" "scripts/dist.sh" "packaging/**"
109
    mount {
110
        source "ephemeral://disk"
111
        target "/src/target"
112
        size "24GiB"
113
    }
114
    env {
115
        DIST_FLAT "/src/target/dist-flat"
116
        ZIG_GLOBAL_CACHE_DIR "/src/target/zig-cache"
117
    }
118
    exec "bash" "scripts/dist.sh"
119
    output {
120
        artifact "oh-linux-x86_64.tar.gz" {
121
            path "/src/target/dist-flat/oh-linux-x86_64.tar.gz"
122
        }
123
        artifact "oh-linux-arm64.tar.gz" {
124
            path "/src/target/dist-flat/oh-linux-arm64.tar.gz"
125
        }
126
        artifact "oh-linux-riscv64.tar.gz" {
127
            path "/src/target/dist-flat/oh-linux-riscv64.tar.gz"
128
        }
129
        artifact "oh-macos-x86_64.tar.gz" {
130
            path "/src/target/dist-flat/oh-macos-x86_64.tar.gz"
131
        }
132
        artifact "oh-macos-arm64.tar.gz" {
133
            path "/src/target/dist-flat/oh-macos-arm64.tar.gz"
134
        }
135
        artifact "oh-windows-x86_64.zip" {
136
            path "/src/target/dist-flat/oh-windows-x86_64.zip"
137
        }
138
        artifact "oh_amd64.deb" {
139
            path "/src/target/dist-flat/oh_amd64.deb"
140
        }
141
        artifact "oh_arm64.deb" {
142
            path "/src/target/dist-flat/oh_arm64.deb"
143
        }
144
        artifact "oh_riscv64.deb" {
145
            path "/src/target/dist-flat/oh_riscv64.deb"
146
        }
147
        artifact "SHA256SUMS" {
148
            path "/src/target/dist-flat/SHA256SUMS"
149
        }
150
    }
151
}