OXYGENHUB
◆ v0.1.0 oxygenhub / .flow / pipeline.kdl
2.5 KiB · last changed oh: OxygenHub from the command line 1 month 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/9d76e1aef3ab096c57dfdab6ed2cfb4de1dc70e67ca0e7f299e087f7abb7e61a"
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
    }
28
}
29
30
sandbox "rust-small" {
31
    runtime "microvm"
32
    rootfs "cas://blob/9d76e1aef3ab096c57dfdab6ed2cfb4de1dc70e67ca0e7f299e087f7abb7e61a"
33
    memory-limit "1GiB"
34
    cpu-limit 1
35
    network "isolated"
36
}
37
38
job "fmt" {
39
    sandbox "rust-small"
40
    // Only this workspace's packages: --all would also check the path
41
    // dependencies in deps/, which follow their own formatting.
42
    exec "cargo" "fmt" "--check" "-p" "oxygenhub" "-p" "hub-api" "-p" "oh"
43
}
44
45
job "clippy" {
46
    sandbox "rust"
47
    depends-on "fmt"
48
    mount {
49
        source "ephemeral://disk"
50
        target "/src/target"
51
        size "24GiB"
52
    }
53
    exec "sh" ".flow/warm-target.sh" "cargo" "clippy" "--workspace" "--all-targets" "--locked" "--" "-D" "warnings"
54
}
55
56
job "test" {
57
    sandbox "rust"
58
    depends-on "fmt"
59
    mount {
60
        source "ephemeral://disk"
61
        target "/src/target"
62
        size "24GiB"
63
    }
64
    exec "sh" ".flow/warm-target.sh" "cargo" "test" "--workspace" "--locked"
65
}
66
67
job "build" {
68
    sandbox "rust"
69
    depends-on "fmt"
70
    mount {
71
        source "ephemeral://disk"
72
        target "/src/target"
73
        size "24GiB"
74
    }
75
    exec "sh" ".flow/warm-target.sh" "cargo" "build" "--release" "--locked"
76
}