Browse Source

Merge branch 'housekeeping/custom-build-image' into 'develop'

Custom Build Image

See merge request funkwhale/funkwhale-android!121
technical/update-jvmTarget-version
Ryan Harg 3 years ago
parent
commit
1fc0f6e8ac
  1. 32
      .gitlab-ci.yml
  2. 17
      docker/Dockerfile

32
.gitlab-ci.yml

@ -1,4 +1,4 @@
image: jangrewe/gitlab-ci-android image: dev.funkwhale.audio:5050/funkwhale/funkwhale-android:latest
variables: variables:
COBERTURA_REPORT: '$CI_PROJECT_DIR/app/build/reports/cobertura.xml' COBERTURA_REPORT: '$CI_PROJECT_DIR/app/build/reports/cobertura.xml'
@ -6,11 +6,33 @@ variables:
JACOCO_XML_LOCATION: '$CI_PROJECT_DIR/app/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml' JACOCO_XML_LOCATION: '$CI_PROJECT_DIR/app/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml'
stages: stages:
- build_ci_env
- test - test
- visualize - visualize
- build - build
- deploy - deploy
build_ci_image:
stage: build_ci_env
image: egon0/docker-with-buildx-and-git:bash
tags:
- dind
services:
- docker:20-dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker build -t $CI_REGISTRY_IMAGE docker
after_script:
- docker push $CI_REGISTRY_IMAGE
rules:
- if: '$BUILD_CI_IMAGE'
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
.gradle-default: .gradle-default:
before_script: before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle - export GRADLE_USER_HOME=$(pwd)/.gradle
@ -50,7 +72,7 @@ test:
except: except:
- tags - tags
script: script:
- ./gradlew test jacocoTestReport - ./gradlew --no-daemon --stacktrace test jacocoTestReport
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, " instructions covered"; print 100*covered/instructions, "% covered" }' $JACOCO_CSV_LOCATION - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, " instructions covered"; print 100*covered/instructions, "% covered" }' $JACOCO_CSV_LOCATION
artifacts: artifacts:
reports: reports:
@ -77,7 +99,7 @@ build-develop:
extends: .build extends: .build
script: script:
- echo -n $PREVIEW_SIGNING_KEY_STORE | base64 -d > app/android.keystore - echo -n $PREVIEW_SIGNING_KEY_STORE | base64 -d > app/android.keystore
- ./gradlew assembleDebug -Psigning.store=android.keystore -Psigning.store_passphrase=$PREVIEW_SIGNING_KEY_PASS -Psigning.key_passphrase=$PREVIEW_SIGNING_KEY_PASS - ./gradlew --stacktrace --no-daemon assembleDebug -Psigning.store=android.keystore -Psigning.store_passphrase=$PREVIEW_SIGNING_KEY_PASS -Psigning.key_passphrase=$PREVIEW_SIGNING_KEY_PASS
only: only:
- develop - develop
@ -90,14 +112,14 @@ build-release:
extends: .build extends: .build
script: script:
- echo -n $SIGNING_KEY_STORE | base64 -d > app/android.keystore - echo -n $SIGNING_KEY_STORE | base64 -d > app/android.keystore
- ./gradlew assembleRelease -Psigning.store=android.keystore -Psigning.store_passphrase=$SIGNING_KEY_PASS -Psigning.key_passphrase=$SIGNING_KEY_PASS - ./gradlew --stacktrace --no-daemon assembleRelease -Psigning.store=android.keystore -Psigning.store_passphrase=$SIGNING_KEY_PASS -Psigning.key_passphrase=$SIGNING_KEY_PASS
only: only:
- tags - tags
build-bleeding-edge: build-bleeding-edge:
extends: .build extends: .build
script: script:
- ./gradlew assembleDebug - ./gradlew --stacktrace --no-daemon assembleDebug
except: except:
- develop - develop
- tags - tags

17
docker/Dockerfile

@ -0,0 +1,17 @@
FROM debian:stable-slim
ENV ANDROID_COMPILE_SDK=30
ENV SDK_TOOLS_VERSION=30.0.2
ENV ANDROID_CMD_TOOLS=7583922
ENV ANDROID_HOME=/opt/android-sdk-linux
ENV PATH "/opt/android-sdk-linux/cmdline-tools/bin:${PATH}"
RUN apt-get update && apt-get install --yes openjdk-11-jdk wget tar unzip lib32stdc++6 lib32z1 git
RUN mkdir -p /opt/android-sdk-linux && cd /opt \
&& wget -q https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_CMD_TOOLS}_latest.zip -O android-sdk-tools.zip \
&& unzip -q android-sdk-tools.zip -d ${ANDROID_HOME} \
&& rm -f android-sdk-tools.zip \
&& echo y | sdkmanager --sdk_root=${ANDROID_HOME} "platforms;android-${ANDROID_COMPILE_SDK}" \
&& echo y | sdkmanager --sdk_root=${ANDROID_HOME} "platform-tools" \
&& echo y | sdkmanager --sdk_root=${ANDROID_HOME} "build-tools;${SDK_TOOLS_VERSION}"
Loading…
Cancel
Save