mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-22 01:51:47 +00:00
## Summary A recent (couple of weeks ago?) change to the Invent policies requires that we use a docker image from an allow list. The cleanest fix is to just use the Ubuntu base image and install the JDK, which is approximately what we had before. We considered the Sysadmin Android image (https://invent.kde.org/sysadmin/ci-images/-/blob/master/android-qt66/Dockerfile?ref_type=heads), but we use a newer version of the SDK tools and a newer version of the JDK, at which point we may as well just install those since those are the only dependencies. We could consider building another custom docker image in the future if we see value to doing so. ## Test Plan ### Before: CI fails with: ``` ERROR: The "eclipse-temurin:17-jdk-focal" image is not present on list of allowed images: - invent-registry.kde.org/sysadmin/ci-images/*:* - ubuntu:* - debian:* - fedora:* - centos:* - opensuse/*:* - python:* - ruby:* - fsfe/reuse:* - quay.io/podman/stable:* ``` ### After: Build passes and drops .apk
69 lines
2.3 KiB
YAML
69 lines
2.3 KiB
YAML
# SPDX-FileCopyrightText: 2023 Nicolas Fella <nicolas.fella@gmx.de>
|
|
# SPDX-FileCopyrightText: 2023 Simon Redman <simon@ergotech.com>
|
|
# 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
|