OXYGENHUB
# 3a01077da29a oxygenhub / .flow / pipeline.kdl
2.7 KiB · last changed ci: one build identity for CI states, so cached targets stay fresh (refs andymccall/oxygenflow#52) 24 days ago source blame history raw
380996db Andy McCall ↶ 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
705d11b0 Andy McCall ↶ 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.
380996db Andy McCall ↶ 12
sandbox "rust" {
13
    runtime "microvm"
65be9f9c Andy McCall ↶ 14
    rootfs "cas://blob/9d76e1aef3ab096c57dfdab6ed2cfb4de1dc70e67ca0e7f299e087f7abb7e61a"
380996db Andy McCall ↶ 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"
045f967d Andy McCall ↶ 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"
3a01077d Andy McCall ↶ 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"
045f967d Andy McCall ↶ 31
    }
380996db Andy McCall ↶ 32
}
33
34
sandbox "rust-small" {
35
    runtime "microvm"
65be9f9c Andy McCall ↶ 36
    rootfs "cas://blob/9d76e1aef3ab096c57dfdab6ed2cfb4de1dc70e67ca0e7f299e087f7abb7e61a"
380996db Andy McCall ↶ 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.
5c6e92fd Andy McCall ↶ 46
    exec "cargo" "fmt" "--check" "-p" "oxygenhub" "-p" "hub-api" "-p" "oh"
380996db Andy McCall ↶ 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
    }
705d11b0 Andy McCall ↶ 57
    exec "sh" ".flow/warm-target.sh" "cargo" "clippy" "--workspace" "--all-targets" "--locked" "--" "-D" "warnings"
380996db Andy McCall ↶ 58
}
59
60
job "test" {
61
    sandbox "rust"
62
    depends-on "fmt"
63
    mount {
64
        source "ephemeral://disk"
65
        target "/src/target"
66
        size "24GiB"
67
    }
705d11b0 Andy McCall ↶ 68
    exec "sh" ".flow/warm-target.sh" "cargo" "test" "--workspace" "--locked"
380996db Andy McCall ↶ 69
}
70
71
job "build" {
72
    sandbox "rust"
73
    depends-on "fmt"
74
    mount {
75
        source "ephemeral://disk"
76
        target "/src/target"
77
        size "24GiB"
78
    }
705d11b0 Andy McCall ↶ 79
    exec "sh" ".flow/warm-target.sh" "cargo" "build" "--release" "--locked"
380996db Andy McCall ↶ 80
}