PixelDroid-App-Android/.gitlab-ci.yml

122 lines
4.0 KiB
YAML
Raw Normal View History

2021-02-17 22:55:31 +01:00
image: reactivecircus/android-emulator-23:latest
variables:
2021-02-17 22:55:31 +01:00
API_LEVEL: "23"
ARCH: "x86"
TARGET: "default"
2021-05-08 22:11:04 +02:00
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
cache:
paths:
- .gradle/wrapper
- .gradle/caches
# Basic android and gradle stuff
# Check linting
lintDebug:
interruptible: true
stage: build
script:
- ./gradlew checkLicenses
- ./gradlew -Pci --console=plain :app:lintDebug -PbuildDir=lint
# Make Project
assembleDebug:
interruptible: true
stage: build
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
# Run all tests, if any fails, interrupt the pipeline(fail it)
debugTests:
interruptible: true
stage: test
script:
2021-03-26 10:26:00 +01:00
- ./gradlew -Pci --console=plain :app:testDebug -x lint
2021-02-17 22:55:31 +01:00
emulatorTest:
interruptible: true
stage: test
script:
- echo no | avdmanager create avd --force --name "api-${API_LEVEL}" --abi "${TARGET}/${ARCH}" --package "system-images;android-${API_LEVEL};${TARGET};${ARCH}"
- $ANDROID_SDK_ROOT/emulator/emulator -avd "api-${API_LEVEL}" -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none &
- chmod +x android-wait-for-emulator.sh
2021-03-26 10:26:00 +01:00
- ./gradlew build -x lint
2021-02-17 22:55:31 +01:00
- ./android-wait-for-emulator.sh
- adb shell settings put global window_animation_scale 0.0
- adb shell settings put global transition_animation_scale 0.0
- adb shell settings put global animator_duration_scale 0.0
2021-03-26 10:26:00 +01:00
- ./gradlew build connectedCheck connectedStagingAndroidTest jacocoTestReport -x lint
2021-02-17 22:55:31 +01:00
- cat app/build/reports/jacoco/jacocoTestReport/html/index.html | grep -o 'Total[^%]*%'
artifacts:
when: always
2021-02-17 22:55:31 +01:00
paths:
- ./app/build/reports/jacoco/jacocoTestReport/
expire_in: 1 week
2021-05-15 12:58:13 +02:00
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
2021-05-25 14:29:57 +02:00
- 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
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
- 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