diff --git a/.ci-docker/Dockerfile b/.ci-docker/Dockerfile new file mode 100644 index 000000000..99186e197 --- /dev/null +++ b/.ci-docker/Dockerfile @@ -0,0 +1,26 @@ +FROM openjdk:8-jdk +RUN apt-get -y update +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y apt-utils +RUN DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wget tar unzip lib32stdc++6 lib32z1 git + +ENV ANDROID_COMPILE_SDK "28" +ENV ANDROID_BUILD_TOOLS "28.0.3" +ENV ANDROID_SDK_TOOLS "4333796" + +WORKDIR /opt/ +RUN wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip +RUN unzip -q -d android-sdk-linux android-sdk.zip +RUN echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null +RUN echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null +RUN echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null +RUN yes | android-sdk-linux/tools/bin/sdkmanager --licenses + +WORKDIR /tmp/ +RUN git clone --depth=1 https://gitlab.com/tom79/mastalab +WORKDIR /tmp/mastalab +RUN chmod +x gradlew +RUN ANDROID_HOME=/opt/android-sdk-linux PATH=$PATH:/opt/android-sdk-linux/platform-tools/ ./gradlew tasks +RUN ANDROID_HOME=/opt/android-sdk-linux PATH=$PATH:/opt/android-sdk-linux/platform-tools/ ./gradlew assembleDebug +RUN ANDROID_HOME=/opt/android-sdk-linux PATH=$PATH:/opt/android-sdk-linux/platform-tools/ ./gradlew --stacktrace -Pci --console=plain :app:testFdroidDebugUnitTest +RUN ANDROID_HOME=/opt/android-sdk-linux PATH=$PATH:/opt/android-sdk-linux/platform-tools/ ./gradlew --stacktrace -Pci --console=plain :app:lintFdroidDebug -PbuildDir=lint diff --git a/.ci-docker/Makefile b/.ci-docker/Makefile new file mode 100644 index 000000000..fbaf6453b --- /dev/null +++ b/.ci-docker/Makefile @@ -0,0 +1,2 @@ +all: + docker build -t tom79/mastalab-ci:latest . && docker push tom79/mastalab-ci:latest diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 43643ef9b..942510385 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,53 +3,23 @@ image: hatsoftwares/mastalab-ci:latest before_script: - export ANDROID_HOME=/opt/android-sdk-linux - export PATH=$PATH:/opt/android-sdk-linux/platform-tools/ - - export GRADLE_USER_HOME=$(pwd)/.gradle/ - chmod +x gradlew stages: - - prepare - - build + - build-and-test - test -prepare: - stage: prepare - script: - - ./gradlew tasks - cache: - key: "$CI_COMMIT_SHA" - paths: - - app/build/outputs/ - - .gradle/ - policy: push - assembleDebug: - stage: build + stage: build-and-test script: - ./gradlew assembleDebug - cache: - key: "$CI_COMMIT_SHA" - paths: - - app/build/outputs/ - - .gradle/ lintDebug: - stage: test - cache: - key: "$CI_COMMIT_SHA" - paths: - - app/build/outputs/ - - .gradle/ - policy: pull + stage: build-and-test script: - - ./gradlew --stacktrace -Pci --console=plain :app:lintFdroidDebug -PbuildDir=lint + - ./gradlew -Pci --console=plain :app:lintFdroidDebug -PbuildDir=lint debugTests: - stage: test - cache: - key: "$CI_COMMIT_SHA" - paths: - - app/build/outputs/ - - .gradle/ - policy: pull + stage: build-and-test script: - - ./gradlew --stacktrace -Pci --console=plain :app:testFdroidDebugUnitTest + - ./gradlew -Pci --console=plain :app:testFdroidDebugUnitTest