2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-22 01:51:47 +00:00
kdeconnect-android/.gitlab-ci.yml
Simon Redman d2d43c55a7 Bump OpenJDK to v17 as required by latest Gradle version
## Summary

Gradle version bump in 921d0ee8846180d18b0c953dedfd87f58f77704f (probably) is incompatible with Java 11.

Fix Gitlab CI by increasing Java version, as required by latest Gradle version.

## Test Plan

### Before:
Gitlab CI does not work, complaining about Java version. See for example: https://invent.kde.org/network/kdeconnect-android/-/jobs/950701

### After:
Gitlab CI does work
2023-05-17 16:29:08 +00:00

67 lines
2.7 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`
image: eclipse-temurin:17-jdk-focal
variables:
ANDROID_COMPILE_SDK: "31"
ANDROID_BUILD_TOOLS: "30.0.3"
ANDROID_SDK_TOOLS: "6609375"
before_script:
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
- wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip
- unzip -d cmdline-tools android-sdk.zip
- echo y | cmdline-tools/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
- echo y | cmdline-tools/tools/bin/sdkmanager "platform-tools" >/dev/null
- echo y | cmdline-tools/tools/bin/sdkmanager "patcher;v4" >/dev/null
- echo y | cmdline-tools/tools/bin/sdkmanager "emulator" >/dev/null
- echo y | cmdline-tools/tools/bin/sdkmanager "platform-tools" >/dev/null
- echo y | cmdline-tools/tools/bin/sdkmanager "tools" >/dev/null
- echo y | cmdline-tools/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
- export ANDROID_HOME=$PWD/cmdline-tools
- export PATH=$PATH:$PWD/cmdline-tools/platform-tools/
- chmod +x ./gradlew
# temporarily disable checking for EPIPE error and use yes to accept all licenses
- set +o pipefail
- yes | cmdline-tools/tools/bin/sdkmanager --licenses
# Gradle will automatically download parts of the SDK if they are missing,
# assuming the licenses are accepted. Even if you don't need it to download
# anything, it will fail if it detects the liceses are not accepted.
# https://developer.android.com/studio/intro/update.html#download-with-gradle
# Unfortunately, it looks for the license acceptances in a different location than
# the sdkmanager creates them!
# Copy them to the location Gradle expects to find them to make everything run smoothly.
- cp -ap "${PWD}/licenses" "${PWD}/cmdline-tools/licenses"
- set -o pipefail
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