Initial support for Android CI on shared runners

This commit is contained in:
Gioacchino Mazzurco 2022-04-05 10:31:42 +02:00
parent bcc4f087e2
commit f0a88b3d4d
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051
2 changed files with 27 additions and 8 deletions

View File

@ -1,7 +1,7 @@
android-AAR-minapi16:
rules:
- if: $PROJECT_HAVE_STORAGE50_RUNNERS == "true"
image: registry.gitlab.com/retroshare/retroshare:android_aar_base_16
image: registry.gitlab.com/retroshare/retroshare:android_aar_base_16_build
script:
- >
./gradlew build publish
@ -39,3 +39,15 @@ android-AAR-minapi24:
-PNATIVE_TOOLCHAINS_DIR="/libretroshare-native-toolchains/"
tags:
- storage50
android-minapi16_armeabi-v7a_bundleDebugAar:
rules:
- if: $PROJECT_HAVE_STORAGE50_RUNNERS != "true"
image: registry.gitlab.com/retroshare/retroshare:android_aar_base_16_armeabi-v7a_bundleDebugAar
script:
- >
./gradlew bundleDebugAar
-Dorg.gradle.project.buildDir=/libretroshare-build/
-PANDROID_MIN_API_LEVEL=16
-PLIBRETROSHARE_SOURCE_VERSION="$CI_COMMIT_SHORT_SHA"
-PNATIVE_TOOLCHAINS_DIR="/libretroshare-native-toolchains/"

View File

@ -2,11 +2,14 @@
## image name must match gitlab repository name, you can play just with the tag
## the part after :
# export ANDROID_MIN_API_LEVEL=16
# export CI_IMAGE_NAME="registry.gitlab.com/retroshare/retroshare:android_aar_base_$ANDROID_MIN_API_LEVEL"
# docker build --squash --tag "${CI_IMAGE_NAME}" --build-arg ANDROID_MIN_API_LEVEL=$ANDROID_MIN_API_LEVEL --build-arg LIBRETROSHARE_SOURCE_VERSION="$(git describe --always)" --file misc/Android/Dockerfile .
# export CI_IMAGE_NAME="registry.gitlab.com/retroshare/retroshare:android_aar_base_${ANDROID_MIN_API_LEVEL}"
# docker build --squash --tag "${CI_IMAGE_NAME}" --build-arg ANDROID_MIN_API_LEVEL=${ANDROID_MIN_API_LEVEL} --build-arg LIBRETROSHARE_SOURCE_VERSION="$(git describe --always)" --file misc/Android/Dockerfile .
## --squash is very important in case of GitlabCI shared runners as they are
## limited to 25GB disk size
## To fit GitlabCI shared runners as they are limited to 25GB disk size
## use --squash
## and set
## GRADLE_BUILD_TASK to bundleDebugAar or bundleReleaseAar
## JNI_NATIVE_LIBS_ARCHS to arm64-v8a or armeabi-v7a
## To push it to gitlab CI registry you need first to login and the to push
# docker login registry.gitlab.com
@ -46,10 +49,14 @@ RUN /libretroshare/misc/Android/prepare-toolchain-clang.sh install_android_sdk
WORKDIR /libretroshare/
ARG ANDROID_MIN_API_LEVEL=16
ARG LIBRETROSHARE_SOURCE_VERSION="Dockerfile_unset"
ENV NATIVE_TOOLCHAINS_DIR="/libretroshare-native-toolchains/"
RUN ./gradlew build -Dorg.gradle.project.buildDir=/libretroshare-build/ \
ARG GRADLE_BUILD_TASK="build"
ARG JNI_NATIVE_LIBS_ARCHS="arm64-v8a armeabi-v7a"
ARG NATIVE_TOOLCHAINS_DIR="/libretroshare-native-toolchains/"
RUN ./gradlew $GRADLE_BUILD_TASK \
-Dorg.gradle.project.buildDir=/libretroshare-build/ \
-PANDROID_MIN_API_LEVEL=$ANDROID_MIN_API_LEVEL \
-PNATIVE_TOOLCHAINS_DIR=$NATIVE_TOOLCHAINS_DIR \
-PNATIVE_TOOLCHAINS_DIR="$NATIVE_TOOLCHAINS_DIR" \
-PJNI_NATIVE_LIBS_ARCHS="$JNI_NATIVE_LIBS_ARCHS" \
-PLIBRETROSHARE_SOURCE_VERSION="$LIBRETROSHARE_SOURCE_VERSION"
WORKDIR /