Android – Continuous Integration with Gitlab CI
In this article, I am going to explain basic setup for Gitlab CI integration for your Android projects.
It is a built-in continuous integration solution by Gitlab. To do the Gitlab CI integration first of all we need to add
.gitlab-ci.yml within the project and then you have to setup this configuration file to execute your project whenever your team will push the code to master or development or any other branch to ensure your Android app compiles and passes unit and functional tests.
Read also –
There is so much we can do with any continuous integration solutions available, but here I am going to show you the basic setup which just verifies whether the code is in condition to compile with no lint warnings.
image: openjdk:8-jdk variables: ANDROID_COMPILE_SDK: "25" ANDROID_BUILD_TOOLS: "24.0.0" ANDROID_SDK_TOOLS: "24.4.1" before_script: - echo Start CI - setx ANDROID_HOME "%cd%/android-sdk" - setx PATH "%PATH%:%cd%/android-sdk/platform-tools/" stages: - build - test build: stage: build script: - ./gradlew assembleDebug artifacts: paths: - app/build/outputs/ # Use the generated build output to run the tests. unitTests: stage: test script: - ./gradlew test after_script: - echo End CI
Note: The path mentioned are based on Windows O.S, so if your Gitlab CI is running on Linux/Unix based system you need to change the path.
I hope this basic script will be helpful for you if you already using Gitlab and want to do continuous integration with Gitlab CI.
Do not forget to share this with your friends and colleagues working on Android or DevOps.