OXYGENHUB
◆ v0.1.0 oxygenhub-android / .flow / pipeline.kdl
3.5 KiB · last changed A release-check job: the release's secrets checked in seconds, with no build (refs #7) 8 days ago source blame history raw
1
// The OxygenHub Android app's pipeline (OxygenFlow, #19). Every push runs
2
// the unit tests with coverage and a debug build in OxygenFlow's Android
3
// image, with no network: the JDK, the Android SDK and NDK, Gradle,
4
// cargo-ndk, rust-core's crates and the app's Gradle dependencies are all
5
// in the image (oxygenflow/images/android). Rebuild and re-pin it when the
6
// app's SDK, Gradle or dependency versions change, or rust-core's
7
// Cargo.lock does. Locally, ./gradlew :app:createDebugUnitTestCoverageReport
8
// runs the same tests.
9
schema-version 1
10
11
sandbox "android" {
12
    runtime "microvm"
13
    rootfs "cas://blob/6605d6c0b87e32667bb0b19ec473e76e7139a9f1cfa6cb36a03e773eee5af06c"
14
    memory-limit "8GiB"
15
    cpu-limit 4
16
    // Loopback only, still offline: Gradle will not start without a
17
    // usable interface for its file-lock listener.
18
    network "loopback"
19
    // Gradle reads dependencies from the image's read-only cache and
20
    // writes its own state under /tmp.
21
    env {
22
        ANDROID_HOME "/opt/android-sdk"
23
        JAVA_HOME "/usr/lib/jvm/java-17-openjdk-amd64"
24
        GRADLE_RO_DEP_CACHE "/opt/gradle-home/caches"
25
        GRADLE_USER_HOME "/tmp/gradle"
26
        CARGO_INCREMENTAL "0"
27
    }
28
}
29
30
job "test" {
31
    sandbox "android"
32
    timeout "60m"
33
    // rust-core (with oxy-core and the runner) for two ABIs is most of the
34
    // build: kept from the last passing run, so only what changed builds.
35
    mount {
36
        source "ephemeral://disk"
37
        target "/src/rust-core/target"
38
        size "20GiB"
39
        cache "rust-core-target"
40
        key "rust-core/Cargo.lock"
41
    }
42
    exec "bash" "scripts/ci.sh"
43
    output {
44
        artifact "junit" {
45
            path "/src/junit.xml"
46
            when "always"
47
        }
48
        artifact "coverage" {
49
            path "/src/coverage.xml"
50
            when "always"
51
        }
52
    }
53
}
54
55
// The release's secrets checked in seconds, with no build (#7): the
56
// keystore's SHA-256, the key its password opens and Firebase's JSON.
57
// By hand only: oh run start --job release-check.
58
job "release-check" {
59
    sandbox "android"
60
    timeout "5m"
61
    on {
62
        manual
63
    }
64
    secret "android-keystore" {
65
        mount-path "/run/secrets/android-keystore"
66
    }
67
    secret "android-keystore-password" {
68
        mount-path "/run/secrets/android-keystore-password"
69
    }
70
    secret "firebase-config" {
71
        mount-path "/run/secrets/firebase-config"
72
    }
73
    exec "bash" "scripts/release-check.sh"
74
}
75
76
// A signed release APK when the version in gradle.properties changes (#7),
77
// for a release on oxygenhub.io. The keystore and its password are the
78
// repository's secrets, mounted as files (never in the environment).
79
job "release" {
80
    sandbox "android"
81
    timeout "60m"
82
    depends-on "test"
83
    scope "gradle.properties"
84
    mount {
85
        source "ephemeral://disk"
86
        target "/src/rust-core/target"
87
        size "20GiB"
88
        cache "rust-core-target"
89
        key "rust-core/Cargo.lock"
90
    }
91
    secret "android-keystore" {
92
        mount-path "/run/secrets/android-keystore"
93
    }
94
    secret "android-keystore-password" {
95
        mount-path "/run/secrets/android-keystore-password"
96
    }
97
    // Firebase's client settings (google-services.json) for alerts (#16).
98
    secret "firebase-config" {
99
        mount-path "/run/secrets/firebase-config"
100
    }
101
    exec "bash" "scripts/release.sh"
102
    output {
103
        artifact "oxygenhub-android-universal.apk" {
104
            path "/src/dist/oxygenhub-android-universal.apk"
105
        }
106
        artifact "SHA256SUMS" {
107
            path "/src/dist/SHA256SUMS"
108
        }
109
    }
110
}