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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
|
---
variables:
pip: pip3 --timeout 100 --retries 10
# speed up git checkout phase
GIT_DEPTH: 1
.apt-template: &apt-template
- export LC_ALL=C.UTF-8
- export DEBIAN_FRONTEND=noninteractive
- echo Etc/UTC > /etc/timezone
- echo 'quiet "1";'
'APT::Get::Assume-Yes "true";'
'APT::Install-Recommends "0";'
'APT::Install-Suggests "0";'
'Acquire::Retries "20";'
'Dpkg::Use-Pty "0";'
> /etc/apt/apt.conf.d/99gitlab
- apt-get update
- apt-get dist-upgrade
# `timeout` is used in case one of those runs fails, and waits forever
# for user input.
.test-template: &test-template
- ./test_sdkmanager.py
- export ANDROID_SDK_ROOT=/tmp/android-sdk
- ./sdkmanager.py --list
- ./sdkmanager.py 'build-tools;29.0.3' 'cmake;3.18.1'
- echo y | ./sdkmanager.py --licenses # accept the licenses
- timeout 120 ./sdkmanager.py --licenses # now there should be unaccepted licenses
- apt-get update
- apt-get install default-jdk-headless
- export ver=9.0
- ./sdkmanager.py "cmdline-tools;${ver}"
- export sdkmanager="$ANDROID_SDK_ROOT/cmdline-tools/${ver}/bin/sdkmanager"
# ensure that Android's sdkmanager understands fdroid's installs
- $sdkmanager 'build-tools;29.0.3' 'cmake;3.18.1'
# ensure that Android's sdkmanager understands fdroid's licenses
- timeout 120 $sdkmanager --licenses
black:
image: python:slim
script:
- pip install black
- black --check --diff --color *.py
lint_format_bandit_checks:
image: debian:bookworm-slim
variables:
LANG: C.UTF-8
script:
- apt-get update
- apt-get -y install --no-install-recommends
bash
ca-certificates
dash
gcc
git
pycodestyle
pyflakes3
pylint
python3-dev
python3-nose
python3-pip
- $pip install --break-system-packages bandit
- export EXITVALUE=0
- function set_error() { export EXITVALUE=1; printf "\x1b[31mERROR `history|tail -2|head -1|cut -b 6-500`\x1b[0m\n"; }
- ./hooks/pre-commit || set_error
- bandit
-ii
-s B110,B311,B404,B408,B603,B607
-r $CI_PROJECT_DIR
|| set_error
- pylint --rcfile=.pylint-rcfile --output-format=colorized --reports=n *.py || set_error
- exit $EXITVALUE
test pip:
image: debian:bookworm-slim
script:
- *apt-template
- apt-get install
git
python3-pip
python3-setuptools
python3-wheel
- pip install --break-system-packages .[test]
- ./setup.py sdist
- *test-template
test bullseye:
image: debian:bullseye-backports
script:
- *apt-template
- apt-get install
git
python3-argcomplete
python3-defusedxml
python3-requests
python3-requests-cache
python3-setuptools
- *test-template
test bookworm:
image: debian:bookworm
script:
- *apt-template
- apt-get install
git
python3-argcomplete
python3-defusedxml
python3-requests
python3-requests-cache
python3-setuptools
- *test-template
build_app_offline:
image: debian:bookworm
rules:
- if: $CI_COMMIT_BRANCH == "build_app_offline" # TODO disabled until someone gets it working
variables:
ANDROID_HOME: /opt/android-sdk
script:
- printf 'Package\x3a *\nPin\x3a release a=bookworm\nPin-Priority\x3a 1\n'
>> /etc/apt/preferences.d/bookworm
- echo 'deb https://deb.debian.org/debian bookworm main'
>> /etc/apt/sources.list
- *apt-template
- apt-get install
default-jdk-headless
git
gradle
gradle-debian-helper
python3-argcomplete
python3-pip
python3-requests
python3-setuptools
python3-wheel
- $pip install --break-system-packages -e .
- sdkmanager "build-tools;24.0.0" "platforms;android-23" "platforms;android-25"
- mkdir -p $ANDROID_HOME/licenses/
- echo '24333f8a63b6825ea9c5514f83c2829b004d1fee' > $ANDROID_HOME/licenses/android-sdk-license
- mkdir ~/.android
- git clone --depth 1 --branch 0.2.13 https://gitlab.com/fdroid/privileged-extension.git
- cd privileged-extension
- sed -i
-e "s,jcenter(),maven { url 'file:///usr/share/maven-repo' },"
-e '/com\.android\.support/d'
build.gradle app/build.gradle
- |
tee --append gradle.properties <<EOF
# ensure that gradle can't reach the internet via HTTP
systemProp.http.proxyHost=localhost
systemProp.http.proxyPort=12345
systemProp.https.proxyHost=localhost
systemProp.https.proxyPort=12345
EOF
- gradle --offline assembleDebug
|