2022-07-11 11:07:41 +02:00
|
|
|
|
image: registry.gitlab.com/fdroid/ci-images-client
|
2020-11-08 20:24:38 +01:00
|
|
|
|
|
2022-07-26 21:52:38 +02:00
|
|
|
|
before_script:
|
|
|
|
|
- export GRADLE_USER_HOME=`pwd`/.gradle
|
|
|
|
|
|
2020-11-08 20:24:38 +01:00
|
|
|
|
# Basic android and gradle stuff
|
|
|
|
|
# Check linting
|
|
|
|
|
lintDebug:
|
|
|
|
|
interruptible: true
|
|
|
|
|
stage: build
|
|
|
|
|
script:
|
2022-07-11 11:07:41 +02:00
|
|
|
|
- apt-get update || apt-get update
|
|
|
|
|
- apt-get install -y openjdk-11-jdk-headless
|
|
|
|
|
- update-alternatives --auto java
|
2020-11-08 20:24:38 +01:00
|
|
|
|
- ./gradlew checkLicenses
|
2022-08-21 11:08:48 +02:00
|
|
|
|
- ./gradlew -Pci --console=plain :app:lintDebug -PbuildDir=lint --write-verification-metadata sha256
|
2022-08-21 12:05:50 +02:00
|
|
|
|
- git diff --quiet gradle/verification-metadata.xml || (echo 'Verification of dependencies failed!' && exit 1)
|
2022-08-21 11:08:48 +02:00
|
|
|
|
artifacts:
|
2022-08-21 12:05:50 +02:00
|
|
|
|
when: on_failure
|
2022-08-21 11:08:48 +02:00
|
|
|
|
paths:
|
|
|
|
|
- gradle/verification-metadata.xml
|
|
|
|
|
|
2020-11-08 20:24:38 +01:00
|
|
|
|
|
|
|
|
|
# Make Project
|
|
|
|
|
assembleDebug:
|
|
|
|
|
interruptible: true
|
|
|
|
|
stage: build
|
2022-07-11 11:07:41 +02:00
|
|
|
|
tags:
|
|
|
|
|
- server_artectrex
|
2020-11-08 20:24:38 +01:00
|
|
|
|
script:
|
2022-07-11 11:07:41 +02:00
|
|
|
|
- apt-get update || apt-get update
|
|
|
|
|
- apt-get install -y openjdk-11-jdk-headless
|
|
|
|
|
- update-alternatives --auto java
|
2020-11-08 20:24:38 +01:00
|
|
|
|
- ./gradlew assembleDebug
|
|
|
|
|
artifacts:
|
|
|
|
|
paths:
|
|
|
|
|
- app/build/outputs/
|
|
|
|
|
|
2022-07-11 11:07:41 +02:00
|
|
|
|
# Run all tests, if any fails, interrupt the pipeline (fail it)
|
2020-11-08 20:24:38 +01:00
|
|
|
|
debugTests:
|
|
|
|
|
interruptible: true
|
|
|
|
|
stage: test
|
|
|
|
|
script:
|
2022-07-11 11:07:41 +02:00
|
|
|
|
- apt-get update || apt-get update
|
|
|
|
|
- apt-get install -y openjdk-11-jdk-headless
|
|
|
|
|
- update-alternatives --auto java
|
2021-03-26 10:26:00 +01:00
|
|
|
|
- ./gradlew -Pci --console=plain :app:testDebug -x lint
|
2020-11-08 20:24:38 +01:00
|
|
|
|
|
2022-07-11 11:07:41 +02:00
|
|
|
|
.connected-template: &connected-template
|
2022-10-12 14:28:59 +02:00
|
|
|
|
allow_failure: true
|
2022-07-11 11:07:41 +02:00
|
|
|
|
stage: test
|
|
|
|
|
script:
|
2022-07-26 18:40:41 +02:00
|
|
|
|
- start-emulator
|
|
|
|
|
- wait-for-emulator
|
|
|
|
|
- adb devices
|
|
|
|
|
- adb shell input keyevent 82 &
|
2022-07-11 11:07:41 +02:00
|
|
|
|
# Switch to right java version for building the app
|
2022-07-26 18:40:41 +02:00
|
|
|
|
- apt-get update || apt-get update
|
|
|
|
|
- apt-get install -y openjdk-11-jdk-headless
|
|
|
|
|
- update-alternatives --auto java
|
2022-07-26 21:52:38 +02:00
|
|
|
|
- ./gradlew connectedStagingAndroidTest --info || (adb -e logcat -d > logcat.txt; exit 1)
|
2022-07-11 11:07:41 +02:00
|
|
|
|
artifacts:
|
|
|
|
|
paths:
|
|
|
|
|
- logcat.txt
|
2020-11-08 20:24:38 +01:00
|
|
|
|
|
2022-07-26 21:52:38 +02:00
|
|
|
|
connected 27 default x86_64:
|
2022-07-11 11:07:41 +02:00
|
|
|
|
<<: *connected-template
|
2021-05-15 12:58:13 +02:00
|
|
|
|
|
|
|
|
|
fdroid build:
|
2022-07-11 11:07:41 +02:00
|
|
|
|
stage: build
|
2021-05-15 12:58:13 +02:00
|
|
|
|
image: registry.gitlab.com/fdroid/ci-images-client:latest
|
2022-07-11 11:07:41 +02:00
|
|
|
|
tags:
|
|
|
|
|
- server_artectrex
|
2021-05-15 12:58:13 +02:00
|
|
|
|
artifacts:
|
|
|
|
|
paths:
|
2022-07-11 10:00:00 +02:00
|
|
|
|
- signed/
|
2021-05-15 12:58:13 +02:00
|
|
|
|
when: always
|
|
|
|
|
only:
|
|
|
|
|
- tags
|
|
|
|
|
cache:
|
|
|
|
|
key: "$CI_JOB_NAME"
|
|
|
|
|
paths:
|
|
|
|
|
- .gradle
|
2022-07-11 10:00:00 +02:00
|
|
|
|
- .android
|
2021-05-15 12:58:13 +02:00
|
|
|
|
script:
|
|
|
|
|
# Put the correct versionName and versionCode in the .fdroid.yml
|
2022-08-09 12:49:15 +02:00
|
|
|
|
- sed -e "s/\${versionName}/$(grep "versionName " app/build.gradle | awk '{print $2}' | tr -d \")$(grep "versionCode" app/build.gradle -m 1 | awk '{print $2}')/" -e "s/\${versionCode}/$(grep "versionCode" app/build.gradle -m 1 | awk '{print $2}')/" .fdroid.yml.template > .fdroid.yml
|
2021-05-15 12:58:13 +02:00
|
|
|
|
- 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
|
2022-07-11 10:00:00 +02:00
|
|
|
|
- wget -q https://services.gradle.org/distributions/gradle-5.6.2-bin.zip --output-document=/vagrant/cache/gradle-5.6.2-bin.zip
|
2022-07-29 10:32:15 +02:00
|
|
|
|
# Check sha256 of the gradle build
|
2022-07-11 10:00:00 +02:00
|
|
|
|
- echo '32fce6628848f799b0ad3205ae8db67d0d828c10ffe62b748a7c0d9f4a5d9ee0 /vagrant/cache/gradle-5.6.2-bin.zip' | sha256sum -c
|
2021-05-15 12:58:13 +02:00
|
|
|
|
- bash fdroidserver/buildserver/provision-gradle
|
2022-07-11 10:00:00 +02:00
|
|
|
|
- bash fdroidserver/buildserver/provision-apt-get-install https://deb.debian.org/debian
|
2021-05-15 12:58:13 +02:00
|
|
|
|
- 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
|
2022-07-11 10:00:00 +02:00
|
|
|
|
# each fdroid build --on-server run expects sudo, then uninstalls it
|
2021-05-15 12:58:13 +02:00
|
|
|
|
- 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
|
2022-07-11 10:00:00 +02:00
|
|
|
|
# create a keystore if we don’t have one
|
|
|
|
|
- ls .android || mkdir .android
|
|
|
|
|
- ls .android/debug.keystore || keytool -genkey -v -keystore .android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname 'C=US, O=Android, CN=Android Debug'
|
|
|
|
|
# sign the apk
|
|
|
|
|
- cp -R unsigned signed
|
|
|
|
|
- jarsigner -verbose -keystore .android/debug.keystore -storepass android -keypass android signed/*.apk androiddebugkey
|