You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

265 lines
9.6 KiB

  1. variables:
  2. pip: pip3 --timeout 100 --retries 10
  3. # speed up git checkout phase
  4. GIT_DEPTH: 1
  5. test:
  6. image: registry.gitlab.com/fdroid/ci-images-server:latest
  7. script:
  8. - $pip install -e .[test]
  9. # the `fdroid build` test in tests/run-tests needs android-23
  10. - echo y | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-23"
  11. - cd tests
  12. - ./complete-ci-tests
  13. # Test that the parsing of the .yml metadata format didn't change from last
  14. # released version. This uses the commit ID of the release tags,
  15. # rather than the release tag itself so that contributor forks do not
  16. # need to include the tags in them for this test to work.
  17. #
  18. # The COMMIT_ID should be bumped after each release, so that the list
  19. # of sed hacks needed does not continuously grow.
  20. metadata_v0:
  21. image: registry.gitlab.com/fdroid/ci-images-server:latest
  22. variables:
  23. GIT_DEPTH: 1000
  24. RELEASE_COMMIT_ID: 37f37ebd88e79ebe93239b72ed5503d5bde13f4b # 2.0a~
  25. script:
  26. - git fetch https://gitlab.com/fdroid/fdroidserver.git $RELEASE_COMMIT_ID
  27. - cd tests
  28. - export GITCOMMIT=`git describe`
  29. - git checkout $RELEASE_COMMIT_ID
  30. - cd ..
  31. - git clone --depth 1 https://gitlab.com/fdroid/fdroiddata.git
  32. - cd fdroiddata
  33. - ../tests/dump_internal_metadata_format.py
  34. - cd ..
  35. - git reset --hard
  36. - git checkout $GITCOMMIT
  37. - cd fdroiddata
  38. - ../tests/dump_internal_metadata_format.py
  39. - sed -i
  40. -e '/Liberapay:/d'
  41. -e '/OpenCollective/d'
  42. metadata/dump_*/*.yaml
  43. - diff -uw metadata/dump_*
  44. .apt-template: &apt-template
  45. variables:
  46. DEBIAN_FRONTEND: noninteractive
  47. LANG: C.UTF-8
  48. before_script:
  49. - echo Etc/UTC > /etc/timezone
  50. - echo 'APT::Install-Recommends "0";'
  51. 'APT::Install-Suggests "0";'
  52. 'APT::Acquire::Retries "20";'
  53. 'APT::Get::Assume-Yes "true";'
  54. 'Dpkg::Use-Pty "0";'
  55. 'quiet "1";'
  56. >> /etc/apt/apt.conf.d/99gitlab
  57. - apt-get update
  58. - apt-get dist-upgrade
  59. debian_testing:
  60. image: debian:testing
  61. <<: *apt-template
  62. only:
  63. - master@fdroid/fdroidserver
  64. script:
  65. - apt-get install
  66. aapt
  67. androguard
  68. apksigner
  69. fdroidserver
  70. git
  71. gnupg
  72. python3-defusedxml
  73. python3-setuptools
  74. zipalign
  75. # Debian has apksigner depend on binfmt support which isn't very docker friendly
  76. # We create a shell wrapper instead
  77. - echo -e '#!/bin/sh\njava -jar /usr/lib/android-sdk/build-tools/debian/apksigner.jar "$@"' > /usr/local/bin/apksigner
  78. - chmod +x /usr/local/bin/apksigner
  79. - python3 -c 'import fdroidserver'
  80. - python3 -c 'import androguard'
  81. - cd tests
  82. - ./run-tests
  83. # test using LTS set up with the PPA, including Recommends
  84. ubuntu_lts_ppa:
  85. image: ubuntu:latest
  86. <<: *apt-template
  87. only:
  88. - master@fdroid/fdroidserver
  89. script:
  90. - export ANDROID_HOME=/usr/lib/android-sdk
  91. - apt-get install gnupg
  92. - while ! apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 9AAC253193B65D4DF1D0A13EEC4632C79C5E0151; do sleep 15; done
  93. - export RELEASE=`sed -n 's,^deb [^ ][^ ]* \([a-z]*\).*,\1,p' /etc/apt/sources.list | head -1`
  94. - echo "deb http://ppa.launchpad.net/fdroid/fdroidserver/ubuntu $RELEASE main" >> /etc/apt/sources.list
  95. - apt-get update
  96. - apt-get dist-upgrade
  97. - mount | grep binfmt_misc || mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc
  98. - apt-get install --install-recommends binfmt-support fdroidserver git python3-defusedxml python3-setuptools
  99. - ls -l /proc/sys/fs/binfmt_misc || true
  100. - test -e /proc/sys/fs/binfmt_misc/jarwrapper || apt -qy purge apksigner
  101. - cd tests
  102. - ./run-tests
  103. # test using Xenial LTS with all depends from pypi
  104. # apksigner is recommended, but requires binfmt support in the kernel
  105. ubuntu_xenial_pip:
  106. image: ubuntu:xenial
  107. <<: *apt-template
  108. only:
  109. - master@fdroid/fdroidserver
  110. script:
  111. - apt-get install git default-jdk-headless python3-pip python3-venv rsync zipalign libarchive13
  112. - rm -rf env
  113. - pyvenv env
  114. - . env/bin/activate
  115. - $pip install --upgrade babel pip setuptools
  116. - $pip install -e .
  117. - ./setup.py compile_catalog
  118. - ./tests/run-tests
  119. pip_install:
  120. image: archlinux/base
  121. only:
  122. - master@fdroid/fdroidserver
  123. script:
  124. - pacman --sync --sysupgrade --refresh --noconfirm git grep python-pip python-virtualenv tar
  125. # setup venv to act as release build machine
  126. - python -m venv sdist-env
  127. - . sdist-env/bin/activate
  128. - ./setup.py compile_catalog sdist
  129. - deactivate
  130. - tar tzf dist/fdroidserver-*.tar.gz | grep locale/de/LC_MESSAGES/fdroidserver.mo
  131. # back to bare machine to act as user's install machine
  132. - pip install dist/fdroidserver-*.tar.gz
  133. - test -e /usr/share/locale/de/LC_MESSAGES/fdroidserver.mo
  134. - fdroid
  135. - fdroid readmeta
  136. - fdroid update --help
  137. lint_format_safety_bandit_checks:
  138. image: alpine:3.10 # cannot upgrade until bandit supports Python 3.8
  139. variables:
  140. LANG: C.UTF-8
  141. script:
  142. - apk add --no-cache bash build-base dash ca-certificates gcc python3 python3-dev
  143. - python3 -m ensurepip
  144. - $pip install Babel 'bandit<1.6.0' pycodestyle pyflakes pylint safety
  145. - export EXITVALUE=0
  146. - function set_error() { export EXITVALUE=1; printf "\x1b[31mERROR `history|tail -2|head -1|cut -b 6-500`\x1b[0m\n"; }
  147. - ./hooks/pre-commit || set_error
  148. - ./tests/test-gradlew-fdroid || set_error
  149. - bandit
  150. -ii
  151. -s B110,B322,B404,B408,B410,B603,B607
  152. -r $CI_PROJECT_DIR fdroid
  153. || set_error
  154. - safety check --full-report || set_error
  155. - pylint --rcfile=.pylint-rcfile --output-format=colorized --reports=n
  156. fdroid
  157. makebuildserver
  158. setup.py
  159. fdroidserver/*.py
  160. tests/*.py
  161. tests/*.TestCase
  162. || set_error
  163. - apk add --no-cache gettext make
  164. - make -C locale compile || set_error
  165. - rm -f locale/*/*/*.mo
  166. - pybabel compile --domain=fdroidserver --directory locale 2>&1 | (grep -F "error:" && exit 1) || true
  167. - exit $EXITVALUE
  168. fedora_latest:
  169. image: fedora:latest
  170. only:
  171. - master@fdroid/fdroidserver
  172. script:
  173. # tricks to hopefully make runs more reliable
  174. - echo "timeout=600" >> /etc/dnf/dnf.conf
  175. - echo "retries=50" >> /etc/dnf/dnf.conf
  176. - echo "keepcache=True" >> /etc/dnf/dnf.conf
  177. - dnf -y update || dnf -y update
  178. - dnf -y install @development-tools
  179. diffutils
  180. findutils
  181. git
  182. gnupg
  183. java-1.8.0-openjdk-devel
  184. python3
  185. python3-babel
  186. python3-matplotlib
  187. python3-pip
  188. rsync
  189. unzip
  190. wget
  191. which
  192. - ./setup.py compile_catalog sdist
  193. - useradd -m -c "test account" --password "fakepassword" testuser
  194. - su testuser --login --command "cd `pwd`; $pip install --user dist/fdroidserver-*.tar.gz"
  195. - test -e ~testuser/.local/share/locale/de/LC_MESSAGES/fdroidserver.mo
  196. - wget --no-verbose -O tools.zip https://dl.google.com/android/repository/tools_r25.2.5-linux.zip
  197. - unzip -q tools.zip
  198. - rm tools.zip
  199. - export BUILD_TOOLS_VERSION=`sed -n "s,^MINIMUM_APKSIGNER_BUILD_TOOLS_VERSION\s*=\s*['\"]\(.*\)[['\"],\1,p" fdroidserver/common.py`
  200. - export JAVA_HOME=/etc/alternatives/jre
  201. - export ANDROID_HOME=`pwd`/android-sdk
  202. - mkdir $ANDROID_HOME
  203. - mv tools $ANDROID_HOME/
  204. - mkdir -p $ANDROID_HOME/licenses/
  205. - printf "\n8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > $ANDROID_HOME/licenses/android-sdk-license
  206. - printf "\n84831b9409646a918e30573bab4c9c91346d8abd" > $ANDROID_HOME/licenses/android-sdk-preview-license
  207. - printf "\n79120722343a6f314e0719f863036c702b0e6b2a\n84831b9409646a918e30573bab4c9c91346d8abd" > $ANDROID_HOME/licenses/android-sdk-preview-license-old
  208. - mkdir ~/.android
  209. - touch ~/.android/repositories.cfg
  210. - echo y | $ANDROID_HOME/tools/bin/sdkmanager "platform-tools"
  211. - echo y | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;$BUILD_TOOLS_VERSION"
  212. - chown -R testuser .
  213. - cd tests
  214. - su testuser --login --command
  215. "cd `pwd`; export ANDROID_HOME=$ANDROID_HOME; fdroid=~testuser/.local/bin/fdroid ./run-tests"
  216. gradle:
  217. image: alpine:3.7
  218. variables:
  219. LANG: C.UTF-8
  220. script:
  221. - apk add --no-cache ca-certificates git python3
  222. # if this is a merge request fork, then only check if makebuildserver changed
  223. - if [ "$CI_PROJECT_NAMESPACE" != "fdroid" ]; then
  224. git fetch https://gitlab.com/fdroid/fdroidserver.git;
  225. for f in `git diff --name-only --diff-filter=d FETCH_HEAD...HEAD`; do
  226. test "$f" == "makebuildserver" && export CHANGED="yes";
  227. done;
  228. test -z "$CHANGED" && exit;
  229. fi
  230. - python3 -m ensurepip
  231. - $pip install beautifulsoup4 requests
  232. - ./tests/gradle-release-checksums.py
  233. # this tests the basic setup of the 'fdroid build' CI job in fdroiddata
  234. fdroiddata fdroid build:
  235. image: registry.gitlab.com/fdroid/ci-images-client:latest
  236. rules:
  237. - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH
  238. changes:
  239. - buildserver/provision-apt-get-install
  240. - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
  241. changes:
  242. - buildserver/provision-apt-get-install
  243. script:
  244. - bash buildserver/provision-apt-get-install http://deb.debian.org/debian
  245. - apt-get dist-upgrade
  246. - apt-get install -t stretch-backports
  247. fdroidserver
  248. python3-asn1crypto
  249. python3-ruamel.yaml
  250. yamllint
  251. - apt-get purge fdroidserver