Debian Codegraph @

.gitlab-ci.yml

raw symbols SCIP
1 ---
2
3 # Use merge request pipelines when a merge request is open for the branch.
4 # Use branch pipelines when a merge request is not open for the branch.
5 # https://docs.gitlab.com/ci/yaml/workflow/#switch-between-branch-pipelines-and-merge-request-pipelines
6 workflow:
7 rules:
8 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
9 - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
10 when: never
11 - if: $CI_COMMIT_BRANCH
12
13
14 stages:
15 - lint
16 - main # the main platforms sdkmanager is used and developed on
17 - test # default for jobs that do not specify stage:
18
19
20 variables:
21 pip: pip3 --timeout 100 --retries 10
22 # speed up git checkout phase
23 GIT_DEPTH: 1
24
25
26 .apt-template: &apt-template
27 variables:
28 DEBIAN_FRONTEND: noninteractive
29 LANG: C.UTF-8
30 before_script:
31 - echo Etc/UTC > /etc/timezone
32 - echo 'APT::Install-Recommends "0";'
33 'APT::Install-Suggests "0";'
34 'APT::Get::Assume-Yes "true";'
35 'Acquire::Retries "20";'
36 'Dpkg::Use-Pty "0";'
37 'quiet "1";'
38 >> /etc/apt/apt.conf.d/99gitlab
39 # Ubuntu and other distros often lack https:// support
40 - grep Debian /etc/issue.net
41 && { find /etc/apt/sources.list* -type f | xargs sed -i s,http:,https:, ; }
42 - echo 'Acquire::https::Verify-Peer "false";' > /etc/apt/apt.conf.d/99nocacertificates
43 - apt-get update
44 - apt-get install ca-certificates
45 - rm /etc/apt/apt.conf.d/99nocacertificates
46 - apt-get dist-upgrade
47
48 # For jobs that only need to run when there are changes to Python files.
49 .python-rules-changes: &python-rules-changes
50 rules:
51 - changes:
52 - .gitlab-ci.yml
53 - "*.py"
54
55
56 .apt-test-template: &apt-test-template
57 - apt-get install
58 git
59 gpgv
60 python3-argcomplete
61 python3-defusedxml
62 python3-packaging
63 python3-requests
64 python3-requests-cache
65 python3-setuptools
66
67
68 .pip-test-template: &pip-test-template
69 - apt-get install
70 git
71 gpgv
72 python3-pip
73 - pip install --break-system-packages .[test]
74 - pip wheel .
75
76
77 # `timeout` is used in case one of those runs fails, and waits forever
78 # for user input.
79 .test-template: &test-template
80 - python3 -m unittest --verbose
81
82 - export ANDROID_SDK_ROOT=/tmp/android-sdk
83 - ./sdkmanager.py --list
84 - echo y | ./sdkmanager.py --licenses # accept the licenses
85 - timeout 120 ./sdkmanager.py --licenses # now there should be unaccepted licenses
86
87 - apt-get update
88 # cmdline-tools;20.0 requires Java 17+
89 - grep bullseye /etc/os-release
90 && apt-get install openjdk-17-jdk-headless
91 || apt-get install default-jdk-headless
92
93 - export ver=20.0
94 - ./sdkmanager.py "cmdline-tools;${ver}"
95 - export sdkmanager="$ANDROID_SDK_ROOT/cmdline-tools/${ver}/bin/sdkmanager"
96 # ensure that Android's sdkmanager understands fdroid's installs
97 - for package in
98 "build-tools;37.0.0"
99 "cmake;4.1.2"
100 "cmdline-tools;${ver}"
101 "ndk;29.0.14206865"
102 "platform-tools"
103 "platforms;android-37.0"
104 "skiaparser;3"
105 "system-images;android-35;default;x86_64"
106 "tools"
107 ; do
108 ./sdkmanager.py $package;
109 echo "Does $sdkmanager detect that $package was installed:";
110 $sdkmanager --list
111 | grep --fixed-strings $package
112 | grep --fixed-strings ${package//;/\/};
113 done
114
115 # ensure that Android's sdkmanager understands fdroid's licenses
116 - timeout 120 $sdkmanager --licenses
117
118
119 black:
120 stage: lint
121 image: debian:trixie-slim
122 <<: *python-rules-changes
123 <<: *apt-template
124 script:
125 - apt-get install black
126 - black --check --diff --color $CI_PROJECT_DIR
127
128
129 # Run all the various linters and static analysis tools.
130 hooks/pre-commit:
131 stage: lint
132 image: debian:trixie-slim
133 variables:
134 LANG: C.UTF-8
135 <<: *python-rules-changes
136 <<: *apt-template
137 script:
138 - apt-get install
139 bash
140 ca-certificates
141 dash
142 gcc
143 git
144 pycodestyle
145 pyflakes3
146 - ./hooks/pre-commit
147
148
149 bandit:
150 stage: lint
151 image: debian:trixie-slim
152 <<: *python-rules-changes
153 <<: *apt-template
154 script:
155 - apt-get install bandit
156 - bandit -c pyproject.toml -r .
157
158
159 pylint:
160 stage: lint
161 image: debian:trixie-slim
162 <<: *python-rules-changes
163 <<: *apt-template
164 script:
165 - apt-get install pylint python3-pylint-gitlab
166 - pylint --output-format=pylint_gitlab.GitlabCodeClimateReporter
167 *.py
168 > pylint-report.json
169 || { pylint --output-format=colorized --reports=n *.py; exit 1; }
170 artifacts:
171 reports:
172 codequality: pylint-report.json
173 when: always
174
175
176 shellcheck:
177 stage: lint
178 image: debian:trixie-slim
179 rules:
180 - changes:
181 - .gitlab-ci.yml
182 - completion/bash-completion
183 - hooks/install-hooks.sh
184 - hooks/pre-commit
185 <<: *apt-template
186 script:
187 - apt-get install shellcheck
188 # TODO GitLab Code Quality report https://github.com/koalaman/shellcheck/issues/3155
189 - shellcheck --exclude SC2207,SC2086 --severity=warning --color=always
190 hooks/install-hooks.sh
191 hooks/pre-commit
192 completion/bash-completion
193
194
195 test pip bookworm:
196 image: debian:bookworm-slim
197 <<: *apt-template
198 script:
199 - *pip-test-template
200 - *test-template
201
202 test pip trixie:
203 image: debian:trixie-slim
204 <<: *apt-template
205 script:
206 - *pip-test-template
207 - *test-template
208
209 test pip forky:
210 image: debian:forky-slim
211 <<: *apt-template
212 script:
213 - *pip-test-template
214 - *test-template
215
216 test pip Python 3.14:
217 stage: main
218 image: python:3.14-slim-trixie
219 <<: *apt-template
220 script:
221 - *pip-test-template
222 - *test-template
223
224 test pip Python 3.15:
225 image: python:3.15-rc-slim
226 <<: *apt-template
227 script:
228 - *pip-test-template
229 - *test-template
230
231 test bullseye:
232 image: debian:bullseye-slim
233 <<: *apt-template
234 script:
235 - *apt-test-template
236 - *test-template
237
238 test bookworm:
239 image: debian:bookworm-slim
240 <<: *apt-template
241 script:
242 - *apt-test-template
243 - *test-template
244
245 test trixie:
246 stage: main
247 image: debian:trixie-slim
248 <<: *apt-template
249 script:
250 - *apt-test-template
251 - *test-template
252
253 test forky:
254 image: debian:forky-slim
255 <<: *apt-template
256 script:
257 - *apt-test-template
258 - *test-template
259
260
261 build_app_offline:
262 image: debian:bookworm
263 rules:
264 - if: $CI_COMMIT_BRANCH == "build_app_offline" # TODO disabled until someone gets it working
265 <<: *apt-template
266 script:
267 - printf 'Package\x3a *\nPin\x3a release a=bookworm\nPin-Priority\x3a 1\n'
268 >> /etc/apt/preferences.d/bookworm
269 - echo 'deb https://deb.debian.org/debian bookworm main'
270 >> /etc/apt/sources.list
271 - apt-get install
272 default-jdk-headless
273 git
274 gradle
275 gradle-debian-helper
276 python3-argcomplete
277 python3-pip
278 python3-requests
279 python3-setuptools
280 python3-wheel
281 - $pip install --break-system-packages -e .
282 - export ANDROID_HOME=/opt/android-sdk
283 - sdkmanager "build-tools;24.0.0" "platforms;android-23" "platforms;android-25"
284 - mkdir -p $ANDROID_HOME/licenses/
285 - echo '24333f8a63b6825ea9c5514f83c2829b004d1fee' > $ANDROID_HOME/licenses/android-sdk-license
286 - mkdir ~/.android
287
288 - git clone --depth 1 --branch 0.2.13 https://gitlab.com/fdroid/privileged-extension.git
289 - cd privileged-extension
290 - sed -i
291 -e "s,jcenter(),maven { url 'file:///usr/share/maven-repo' },"
292 -e '/com\.android\.support/d'
293 build.gradle app/build.gradle
294 - |
295 tee --append gradle.properties <<EOF
296 # ensure that gradle can't reach the internet via HTTP
297 systemProp.http.proxyHost=localhost
298 systemProp.http.proxyPort=12345
299 systemProp.https.proxyHost=localhost
300 systemProp.https.proxyPort=12345
301 EOF
302
303 - gradle --offline assembleDebug