From 12d8026a6e5e020d6d64a6dd969e8984db3787c1 Mon Sep 17 00:00:00 2001 From: Matthieu <24-artectrex@users.noreply.shinice.net> Date: Sat, 15 May 2021 10:58:13 +0000 Subject: [PATCH] Integrate F-Droid builds into CI --- .fdroid.yml.template | 29 +++++++++++++++++++++++ .gitlab-ci.yml | 55 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 .fdroid.yml.template diff --git a/.fdroid.yml.template b/.fdroid.yml.template new file mode 100644 index 00000000..84478b87 --- /dev/null +++ b/.fdroid.yml.template @@ -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 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 48661f6a..3dd2a7e5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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