Commit 65ee32ec authored by Matthew Finkel's avatar Matthew Finkel
Browse files

Bug #40002: Add GitLab CI

parent 998b6286
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+107 −0
Original line number Diff line number Diff line
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

    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