-
-
Notifications
You must be signed in to change notification settings - Fork 162
/
Copy path.gitlab-ci.yml
68 lines (62 loc) · 2.34 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# SPDX-FileCopyrightText: 2023 Nicolas Fella <[email protected]>
# SPDX-FileCopyrightText: 2023 Simon Redman <[email protected]>
# 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