.gitlab-ci.yml 5.59 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
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
18 19
    tags:
        - 32GB
Matthew Finkel's avatar
Matthew Finkel committed
20 21

    before_script:
22 23
        - set -e

Matthew Finkel's avatar
Matthew Finkel committed
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
        # 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

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
        # Fetch tor library build dependencies
        - wget --quiet https://people.torproject.org/~sysrqb/mirrors/tor-onion-proxy-library/0.0.3/android-release.aar
        - wget --quiet https://people.torproject.org/~sysrqb/mirrors/tor-onion-proxy-library/0.0.3/universal-0.0.3.jar
        - wget --quiet https://people.torproject.org/~sysrqb/mirrors/tor-android-service/1.0/jsocksAndroid-release.aar
        - wget --quiet https://people.torproject.org/~sysrqb/mirrors/tor-android-service/1.0/service-release.aar
        - wget --quiet https://people.torproject.org/~sysrqb/mirrors/tor/0.4.4.4-rc/tor_x86.tar.gz
        - wget --quiet https://people.torproject.org/~sysrqb/mirrors/tor/0.4.4.4-rc/tor_x86_64.tar.gz
        - wget --quiet https://people.torproject.org/~sysrqb/mirrors/tor/0.4.4.4-rc/tor_armv7.tar.gz
        - wget --quiet https://people.torproject.org/~sysrqb/mirrors/tor/0.4.4.4-rc/tor_aarch64.tar.gz

        - echo "4e2bd087df6128a31c598d297367c106762f539c25d71cc343aae25386e4bee9  android-release.aar" | sha256sum -c
        - echo "0082d1d035a0808d03d7e1009398ed2c3e3ea4c51811198f6ff83ccda456036f  universal-0.0.3.jar" | sha256sum -c
        - echo "3dca44a48fdbd3f6c44f7ea335ae85fe542676d8e48c6438f84a2c852daf4f54  jsocksAndroid-release.aar" | sha256sum -c
        - echo "d38967569af56d809f09f08b888962971149411832c3bc2b7b0b64a43ceb0dcd  service-release.aar" | sha256sum -c
        - echo "0faa344f658d2e38c7cc881f51c1d8658aac56801f7def1b75be72a8d3f90c54  tor_x86.tar.gz" | sha256sum -c
        - echo "acf1d403ca12e3302d1150d2b5fba6585aa83d46db16f15ad33fae39645c5b5d  tor_x86_64.tar.gz" | sha256sum -c
        - echo "132cb40bbc15bd8f72abd15324705ab720f8b316a2fca84baaeb5db37f602c32  tor_armv7.tar.gz" | sha256sum -c
        - echo "6c453c5f7566c87d422ef60750cba794d9616e9197114be5dc1194f75b55b04e  tor_aarch64.tar.gz" | sha256sum -c

        - mv android-release.aar universal-0.0.3.jar jsocksAndroid-release.aar service-release.aar app/

        - tar -C app/src/main -xf tor_x86.tar.gz
        - tar -C app/src/main -xf tor_x86_64.tar.gz
        - tar -C app/src/main -xf tor_armv7.tar.gz
        - tar -C app/src/main -xf tor_aarch64.tar.gz
        - rm tor_x86.tar.gz tor_x86_64.tar.gz tor_armv7.tar.gz tor_aarch64.tar.gz

Matthew Finkel's avatar
Matthew Finkel committed
79 80 81 82 83 84 85 86 87 88
stages:
    - build
    - buildFenixProduction
    - buildFennecBeta
    - buildFennecProduction
    - test

buildDebug:
    stage: build
    script:
89
        - ./gradlew -PdisableTor=true clean app:assembleDebug --stacktrace
Matthew Finkel's avatar
Matthew Finkel committed
90 91 92 93 94 95 96 97 98 99 100 101 102

    # 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)
103
        - ./gradlew -PdisableTor=true ktlint detekt assembleDebug assembleDebugAndroidTest testDebug | tee testLight_gradle.log
Matthew Finkel's avatar
Matthew Finkel committed
104 105 106 107 108 109 110 111 112 113 114 115 116
    artifacts:
        paths:
            - testLight_gradle.log
        expire_in: 1 day
        when: always

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

buildFenixProduction:
    stage: buildFenixProduction
    only:
        - schedules
    script:
117
        - ./gradlew -PdisableTor=true clean app:assembleNightly --stacktrace
Matthew Finkel's avatar
Matthew Finkel committed
118 119 120 121 122 123

buildFennecBeta:
    stage: buildFennecBeta
    only:
        - schedules
    script:
124
        - ./gradlew -PdisableTor=true clean app:assembleBeta --stacktrace
Matthew Finkel's avatar
Matthew Finkel committed
125 126 127 128 129 130

buildFennecProduction:
    stage: buildFennecProduction
    only:
        - schedules
    script:
131
        - ./gradlew -PdisableTor=true clean app:assembleRelease --stacktrace
Matthew Finkel's avatar
Matthew Finkel committed
132 133 134 135 136 137

testAll:
    stage: test
    only:
        - schedules
    script:
138
        - ./gradlew -PdisableTor=true clean test