OXYGENHUB
# e0004d61958c oxygenhub-android / .flow / pipeline.kdl
2.6 KiB · last changed Releases built by OxygenFlow: the version in gradle.properties, and a release job that signs the APK with the app's key from the repository's secrets, checks it and keeps it with SHA256SUMS; 0.1.0 (refs #7) 9 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/cceb10ea42f539bed31c4bbe16e4f49961533f80a2397ca4981afb483a066d0a"
14
    memory-limit "8GiB"
15
    cpu-limit 4
16
    network "isolated"
17
    // Gradle reads dependencies from the image's read-only cache and
18
    // writes its own state under /tmp.
19
    env {
20
        ANDROID_HOME "/opt/android-sdk"
21
        JAVA_HOME "/usr/lib/jvm/java-17-openjdk-amd64"
22
        GRADLE_RO_DEP_CACHE "/opt/gradle-home/caches"
23
        GRADLE_USER_HOME "/tmp/gradle"
24
        CARGO_INCREMENTAL "0"
25
    }
26
}
27
28
job "test" {
29
    sandbox "android"
30
    timeout "60m"
31
    // rust-core (with oxy-core and the runner) for two ABIs is most of the
32
    // build: kept from the last passing run, so only what changed builds.
33
    mount {
34
        source "ephemeral://disk"
35
        target "/src/rust-core/target"
36
        size "20GiB"
37
        cache "rust-core-target"
38
        key "rust-core/Cargo.lock"
39
    }
40
    exec "bash" "scripts/ci.sh"
41
    output {
42
        artifact "junit" {
43
            path "/src/junit.xml"
44
            when "always"
45
        }
46
        artifact "coverage" {
47
            path "/src/coverage.xml"
48
            when "always"
49
        }
50
    }
51
}
52
53
// A signed release APK when the version in gradle.properties changes (#7),
54
// for a release on oxygenhub.io. The keystore and its password are the
55
// repository's secrets, mounted as files (never in the environment).
56
job "release" {
57
    sandbox "android"
58
    timeout "60m"
59
    depends-on "test"
60
    scope "gradle.properties"
61
    mount {
62
        source "ephemeral://disk"
63
        target "/src/rust-core/target"
64
        size "20GiB"
65
        cache "rust-core-target"
66
        key "rust-core/Cargo.lock"
67
    }
68
    secret "android-keystore" {
69
        mount-path "/run/secrets/android-keystore"
70
    }
71
    secret "android-keystore-password" {
72
        mount-path "/run/secrets/android-keystore-password"
73
    }
74
    exec "bash" "scripts/release.sh"
75
    output {
76
        artifact "oxygenhub-android-universal.apk" {
77
            path "/src/dist/oxygenhub-android-universal.apk"
78
        }
79
        artifact "SHA256SUMS" {
80
            path "/src/dist/SHA256SUMS"
81
        }
82
    }
83
}