.gitlab-ci.yml 3.26 KB
Newer Older
Matthew Finkel's avatar
Matthew Finkel committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
variables:
    DEBIAN_FRONTEND: noninteractive

    ANDROID_CLI_TOOLS: "6609375"

    ANDROID_CLI_TOOLS_DIGEST: "89f308315e041c93a37a79e0627c47f21d5c5edbe5e80ea8dc0aac8a649e0e92"
    ANDROID_COMPILE_SDK: "28"
    ANDROID_BUILD_TOOLS: "28.0.3"

    MAVEN_REPOSITORIES: "${CI_PROJECT_DIR}/gradle_storage"
    GRADLE_MAVEN_REPOSITORIES: "file://${MAVEN_REPOSITORIES}"


default:
    # See https://about.gitlab.com/blog/2018/10/24/setting-up-gitlab-ci-for-android-projects/
    # https://github.com/docker-library/openjdk/blob/master/8/jdk/buster/Dockerfile
    image: openjdk:8-jdk
    tags:
        - 32GB

    before_script:
        # Prepare our Debian environment.
        - apt-get update -qq
        - apt-get upgrade -qy

        # Install needed packages from Debian.
        - apt-get install -qy --fix-missing wget tar unzip lib32stdc++6 lib32z1 bzip2

        #- ./taskcluster/scripts/toolchain/android-gradle-dependencies.sh

        # Install the Android SDK Tools.
        - wget --quiet --output-document=android-cli-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_CLI_TOOLS}_latest.zip
        - echo "${ANDROID_CLI_TOOLS_DIGEST} android-cli-tools.zip" | sha256sum -c
        - unzip -qd cmdline-tools android-cli-tools.zip
        - echo y | cmdline-tools/tools/bin/sdkmanager --install "platforms;android-${ANDROID_COMPILE_SDK}" > /dev/null
        - echo y | cmdline-tools/tools/bin/sdkmanager --install "platform-tools" > /dev/null
        - echo y | cmdline-tools/tools/bin/sdkmanager --install "build-tools;${ANDROID_BUILD_TOOLS}" > /dev/null

        # Install the Android NDK.
        - echo y | cmdline-tools/tools/bin/sdkmanager ndk-bundle > /dev/null

        # Accept all the licenses.
        - set +o pipefail
        - yes | cmdline-tools/tools/bin/sdkmanager --licenses > /dev/null
        - set -o pipefail

        # Create local.properties file.
        - echo "sdk.dir=$PWD" > local.properties

stages:
    - build
    - buildFenixProduction
    - buildFennecBeta
    - buildFennecProduction
    - test

buildDebug:
    stage: build
    script:
        - ./gradlew clean app:assembleDebug --stacktrace

    # Disable for now.
    #artifacts:
    #    paths:
    #        - app/build/outputs/apk/geckoBeta/debug/*.apk
    #    expire_in: 1 day

testLight:
    stage: test
    script:
        # from config/pre-push-recommended.sh
        # `tee` into a log file because resulting output is larger than 4 MB
        # (4 MB is max log size)
        - ./gradlew ktlint detekt assembleDebug assembleDebugAndroidTest testDebug | tee testLight_gradle.log
    artifacts:
        paths:
            - testLight_gradle.log
        expire_in: 1 day
        when: always

#### Scheduled Jobs (build* stages run serially) ###

buildFenixProduction:
    stage: buildFenixProduction
    only:
        - schedules
    script:
        - ./gradlew clean app:assembleNightly --stacktrace

buildFennecBeta:
    stage: buildFennecBeta
    only:
        - schedules
    script:
        - ./gradlew clean app:assembleBeta --stacktrace

buildFennecProduction:
    stage: buildFennecProduction
    only:
        - schedules
    script:
        - ./gradlew clean app:assembleRelease --stacktrace

testAll:
    stage: test
    only:
        - schedules
    script:
        - ./gradlew clean test