# SPDX-FileCopyrightText: 2023 Nicolas Fella # SPDX-FileCopyrightText: 2023 Simon Redman # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL # # Test this pipeline locally by: # - Set up Docker on your machine, if not already set up # - Set up gitlab-runner, as described here: https://stackoverflow.com/a/52724374 # - Run `gitlab-runner exec docker --docker-privileged assembleDebug` variables: ANDROID_COMPILE_SDK: "33" ANDROID_BUILD_TOOLS: "34.0.0" ANDROID_SDK_TOOLS: "10406996" default: tags: - Linux image: ubuntu:22.04 before_script: # Prepare system for use of sdkmanager - apt-get --quiet update --yes - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 openjdk-17-jdk-headless - wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip # Create the directory structure around cmdline-tools that sdkmanager is expecting - mkdir -p sdk/cmdline-tools - unzip android-sdk.zip - mv cmdline-tools sdk/cmdline-tools/latest # Update the environment - export ANDROID_HOME=$PWD/sdk - export PATH=$PATH:$PWD/sdk/cmdline-tools/latest/bin # (this line should fail if sdkmanager is moved out of that directory in the future) - type sdkmanager # Install SDK packages - echo y | sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null - echo y | sdkmanager "platform-tools" >/dev/null - echo y | sdkmanager "emulator" >/dev/null - echo y | sdkmanager "platform-tools" >/dev/null - echo y | sdkmanager "tools" >/dev/null - echo y | sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null # temporarily disable checking for EPIPE error and use yes to accept all licenses - set +o pipefail - yes | sdkmanager --licenses # Re-enable checking for EPIPE and allow execution of Gradle wrapper script - set -o pipefail - chmod +x ./gradlew stages: - build - test lintDebug: stage: build script: - ./gradlew generateLicenseReport - ./gradlew -Pci --console=plain lintDebug -PbuildDir=lint assembleDebug: stage: build script: - ./gradlew assembleDebug artifacts: paths: - build/outputs/ debugTests: stage: test script: - ./gradlew -Pci --console=plain testDebug