OXYGENHUB
◆ main spectra / .flow / pipeline.kdl
3.5 KiB · last changed Remove Radar: Spectra serves only signed requests (spec Draft 0.7) 1 day ago source blame history raw
1
// Spectra's own pipeline (OxygenFlow, docs in the oxygenflow repository), in
2
// the shape of Oxygen's. Every push to a bookmark on OxygenHub runs it in
3
// Firecracker microVMs on Earth; the jobs appear as checks on the change.
4
schema-version 1
5
6
// The OxygenFlow build image: Rust with rustfmt and clippy, nextest and
7
// llvm-cov, and the crates of oxygen, oxygenhub and oxygenflow vendored
8
// (oxygenflow/images/rust). Spectra keeps to those crates
9
// (`make deps-check`), so the same image builds it with no network.
10
sandbox "rust" {
11
    runtime "microvm"
12
    rootfs "cas://blob/836461b613019f62399a960c61a25c482eb74e30054ff2cd44d5594c3305872b"
13
    memory-limit "8GiB"
14
    cpu-limit 4
15
    // Tests serve and connect on 127.0.0.1 and a Unix socket; nothing
16
    // leaves the guest.
17
    network "loopback"
18
    // CI builds are thrown away: no incremental state and no debug info,
19
    // so less to compile, link and write (as in oxygen's pipeline).
20
    env {
21
        CARGO_INCREMENTAL "0"
22
        CARGO_PROFILE_DEV_DEBUG "0"
23
        CARGO_PROFILE_TEST_DEBUG "0"
24
        CARGO_PROFILE_RELEASE_DEBUG "0"
25
    }
26
}
27
28
sandbox "rust-small" {
29
    runtime "microvm"
30
    rootfs "cas://blob/836461b613019f62399a960c61a25c482eb74e30054ff2cd44d5594c3305872b"
31
    memory-limit "1GiB"
32
    cpu-limit 1
33
    network "isolated"
34
}
35
36
// Spectra's own packages only, here and in clippy and test: `--all` and
37
// `--workspace` would reach the pinned Oxygen in deps/, which has its own
38
// formatting, lints and tests (as in oxygenhub).
39
job "fmt" {
40
    sandbox "rust-small"
41
    exec "cargo" "fmt" "-p" "spectra" "-p" "spectra-core" "-p" "spectra-mcp" "-p" "spectra-api" "--check"
42
}
43
44
job "clippy" {
45
    sandbox "rust"
46
    depends-on "fmt"
47
    mount {
48
        source "ephemeral://disk"
49
        target "/src/target"
50
        size "16GiB"
51
        // Kept from this job's last passing run (oxygenflow#28): cargo
52
        // builds only what changed since.
53
        cache "target"
54
        key "Cargo.lock"
55
    }
56
    // One build identity for every CI state, so the cached target stays
57
    // fresh from one push to the next (oxygenflow#52).
58
    env {
59
        SPECTRA_BUILD "ci"
60
    }
61
    exec "cargo" "clippy" "-p" "spectra" "-p" "spectra-core" "-p" "spectra-mcp" "-p" "spectra-api" "--all-targets" "--locked" "--" "-D" "warnings"
62
}
63
64
// The tests, run under cargo-nextest and cargo-llvm-cov: a test report
65
// (JUnit, kept whether or not they pass) for the hub's Tests tab and line
66
// coverage (LCOV) for its Coverage tab, from one run.
67
job "test" {
68
    sandbox "rust"
69
    depends-on "fmt"
70
    mount {
71
        source "ephemeral://disk"
72
        target "/src/target"
73
        size "16GiB"
74
        cache "target"
75
        key "Cargo.lock"
76
    }
77
    env {
78
        SPECTRA_BUILD "ci"
79
    }
80
    exec "cargo" "llvm-cov" "nextest" "-p" "spectra" "-p" "spectra-core" "-p" "spectra-mcp" "-p" "spectra-api" "--locked" "--profile" "ci" "--lcov" "--output-path" "/src/target/lcov.info"
81
    output {
82
        artifact "junit" {
83
            path "/src/target/nextest/ci/junit.xml"
84
            when "always"
85
        }
86
        artifact "coverage" {
87
            path "/src/target/lcov.info"
88
        }
89
    }
90
}
91
92
job "build" {
93
    sandbox "rust"
94
    depends-on "fmt"
95
    mount {
96
        source "ephemeral://disk"
97
        target "/src/target"
98
        size "16GiB"
99
        cache "target"
100
        key "Cargo.lock"
101
    }
102
    exec "cargo" "build" "--release" "--locked"
103
    // The binary, kept as a blob of this repository and named by the
104
    // job's signed receipt; the run page links it.
105
    output {
106
        artifact "spectra" {
107
            path "/src/target/release/spectra"
108
        }
109
    }
110
}