Integrate F-Droid builds into CI

This commit is contained in:
Matthieu 2021-05-15 10:58:13 +00:00
parent bf2e272b89
commit 12d8026a6e
2 changed files with 84 additions and 0 deletions

29
.fdroid.yml.template Normal file
View File

@ -0,0 +1,29 @@
Categories:
- Internet
License: GPL-3.0-or-later
AuthorName: PixelDroid team
AuthorEmail: contact@pixeldroid.org
WebSite: https://pixeldroid.org/
SourceCode: https://gitlab.shinice.net/pixeldroid/PixelDroid
IssueTracker: https://gitlab.shinice.net/pixeldroid/PixelDroid/issues
Translation: https://weblate.pixeldroid.org/projects/pixeldroid/
Changelog: https://gitlab.shinice.net/pixeldroid/PixelDroid/-/releases
Liberapay: PixelDroid
AutoName: PixelDroid
RepoType: git
Repo: https://gitlab.shinice.net/pixeldroid/PixelDroid.git
Builds:
- versionName: ${versionName}
versionCode: ${versionCode}
commit: HEAD
subdir: app
gradle:
- yes
AutoUpdateMode: Version %v
UpdateCheckMode: Tags
CurrentVersion: 1.0.beta1
CurrentVersionCode: 1

View File

@ -64,3 +64,58 @@ emulatorTest:
paths:
- ./app/build/reports/jacoco/jacocoTestReport/
expire_in: 1 week
fdroid build:
image: registry.gitlab.com/fdroid/ci-images-client:latest
allow_failure: true
artifacts:
paths:
- unsigned/
when: always
only:
- tags
cache:
key: "$CI_JOB_NAME"
paths:
- .gradle
script:
# Put the correct versionName and versionCode in the .fdroid.yml
- sed -e "s/\${versionName}/$(grep "versionName" app/build.gradle | awk '{print $2}')/" -e "s/\${versionCode}/$(grep "versionCode" app/build.gradle | awk '{print $2}')/" .fdroid.yml.template > .fdroid.yml
- rm .fdroid.yml.template
- test -d build || mkdir build
- test -d fdroidserver || mkdir fdroidserver
- git ls-remote https://gitlab.com/fdroid/fdroidserver.git master
- curl --silent https://gitlab.com/fdroid/fdroidserver/-/archive/master/fdroidserver-master.tar.gz
| tar -xz --directory=fdroidserver --strip-components=1
- export PATH="`pwd`/fdroidserver:$PATH"
- export PYTHONPATH="$CI_PROJECT_DIR/fdroidserver:$CI_PROJECT_DIR/fdroidserver/examples"
- export PYTHONUNBUFFERED=true
- bash fdroidserver/buildserver/setup-env-vars $ANDROID_HOME
- adduser --disabled-password --gecos "" vagrant
- ln -s $CI_PROJECT_DIR/fdroidserver /home/vagrant/fdroidserver
- mkdir -p /vagrant/cache
- wget -q https://services.gradle.org/distributions/gradle-5.6.2-bin.zip
--output-document=/vagrant/cache/gradle-5.6.2-bin.zip
- bash fdroidserver/buildserver/provision-gradle
- bash fdroidserver/buildserver/provision-apt-get-install http://deb.debian.org/debian
- source /etc/profile.d/bsenv.sh
- apt-get dist-upgrade
# install fdroidserver from git, with deps from Debian, until fdroidserver
# is stable enough to include all the things needed here
- apt-get install -t stretch-backports
fdroidserver
python3-asn1crypto
python3-ruamel.yaml
yamllint
- apt-get purge fdroidserver
- export GRADLE_USER_HOME=$PWD/.gradle
# each `fdroid build --on-server` run expects sudo, then uninstalls it
- set -x
- apt-get install sudo
- fdroid fetchsrclibs --verbose
# this builds the latest version of the app from its source dir, using the build recipe in .fdroid.yml
- fdroid build --verbose --on-server --no-tarball