From ae796fe3abee039840084f8007934005a342ee9f Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Mon, 11 May 2020 23:26:01 +0200 Subject: [PATCH] Add android build to merge request --- .gitlab-ci.yml | 7 +++++-- android/Dockerfile | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 android/Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1bcdeae..d68ebd7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,9 +21,12 @@ build-backend: - if: $CI_MERGE_REQUEST_ID build-android: - image: debian + image: docker:latest stage: build + services: + - docker:dind script: - - echo "To be done" + - cd android + - docker build --pull -t android . rules: - if: $CI_MERGE_REQUEST_ID diff --git a/android/Dockerfile b/android/Dockerfile new file mode 100644 index 0000000..8ba7b4b --- /dev/null +++ b/android/Dockerfile @@ -0,0 +1,29 @@ +FROM gradle:jdk8 +USER root + +ENV SDK_URL="https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip" \ + ANDROID_HOME="/usr/local/android-sdk" \ + ANDROID_VERSION=29 \ + ANDROID_BUILD_TOOLS_VERSION=29.0.3 + +# Download Android SDK +RUN mkdir "$ANDROID_HOME" .android && cd "$ANDROID_HOME" \ + && curl -o sdk.zip $SDK_URL && unzip sdk.zip && rm sdk.zip \ + && mkdir "$ANDROID_HOME/licenses" || true \ + && echo "24333f8a63b6825ea9c5514f83c2829b004d1fee" > "$ANDROID_HOME/licenses/android-sdk-license" +# && yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses + +# Install Android Build Tool and Libraries +RUN $ANDROID_HOME/tools/bin/sdkmanager --sdk_root=$ANDROID_HOME "tools" > /dev/null +RUN $ANDROID_HOME/tools/bin/sdkmanager --update > /dev/null +RUN $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" "platforms;android-${ANDROID_VERSION}" "platform-tools" > /dev/null + +# Install Build Essentials +RUN apt-get update \ + && apt-get install build-essential -y \ + && apt-get install file -y \ + && apt-get install apt-utils -y + +COPY . . + +RUN gradle assembleDebug \ No newline at end of file