github.com/drone/go-convert@v0.0.0-20240307072510-6bd371c65e61/convert/gitlab/testdata/templates/android.yaml (about) 1 # To contribute improvements to CI/CD templates, please follow the Development guide at: 2 # https://docs.gitlab.com/ee/development/cicd/templates.html 3 # This specific template is located at: 4 # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Android.gitlab-ci.yml 5 6 # Read more about this script on this blog post https://about.gitlab.com/2018/10/24/setting-up-gitlab-ci-for-android-projects/, by Jason Lenny 7 # If you are interested in using Android with FastLane for publishing take a look at the Android-Fastlane template. 8 9 image: eclipse-temurin:17-jdk-jammy 10 11 variables: 12 13 # ANDROID_COMPILE_SDK is the version of Android you're compiling with. 14 # It should match compileSdkVersion. 15 ANDROID_COMPILE_SDK: "33" 16 17 # ANDROID_BUILD_TOOLS is the version of the Android build tools you are using. 18 # It should match buildToolsVersion. 19 ANDROID_BUILD_TOOLS: "33.0.2" 20 21 # It's what version of the command line tools we're going to download from the official site. 22 # Official Site-> https://developer.android.com/studio/index.html 23 # There, look down below at the cli tools only, sdk tools package is of format: 24 # commandlinetools-os_type-ANDROID_SDK_TOOLS_latest.zip 25 # when the script was last modified for latest compileSdkVersion, it was which is written down below 26 ANDROID_SDK_TOOLS: "9477386" 27 28 # Packages installation before running script 29 before_script: 30 - apt-get --quiet update --yes 31 - apt-get --quiet install --yes wget unzip 32 33 # Setup path as android_home for moving/exporting the downloaded sdk into it 34 - export ANDROID_HOME="${PWD}/android-sdk-root" 35 # Create a new directory at specified location 36 - install -d $ANDROID_HOME 37 # Here we are installing androidSDK tools from official source, 38 # (the key thing here is the url from where you are downloading these sdk tool for command line, so please do note this url pattern there and here as well) 39 # after that unzipping those tools and 40 # then running a series of SDK manager commands to install necessary android SDK packages that'll allow the app to build 41 - wget --no-verbose --output-document=$ANDROID_HOME/cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}_latest.zip 42 - unzip -q -d "$ANDROID_HOME/cmdline-tools" "$ANDROID_HOME/cmdline-tools.zip" 43 - mv -T "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/tools" 44 - export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/cmdline-tools/tools/bin 45 46 # Nothing fancy here, just checking sdkManager version 47 - sdkmanager --version 48 49 # use yes to accept all licenses 50 - yes | sdkmanager --licenses > /dev/null || true 51 - sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" 52 - sdkmanager "platform-tools" 53 - sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" 54 55 # Not necessary, but just for surity 56 - chmod +x ./gradlew 57 58 # Basic android and gradle stuff 59 # Check linting 60 lintDebug: 61 interruptible: true 62 stage: build 63 script: 64 - ./gradlew -Pci --console=plain :app:lintDebug -PbuildDir=lint 65 artifacts: 66 paths: 67 - app/lint/reports/lint-results-debug.html 68 expose_as: "lint-report" 69 when: always 70 71 # Make Project 72 assembleDebug: 73 interruptible: true 74 stage: build 75 script: 76 - ./gradlew assembleDebug 77 artifacts: 78 paths: 79 - app/build/outputs/ 80 81 # Run all tests, if any fails, interrupt the pipeline(fail it) 82 debugTests: 83 needs: [lintDebug, assembleDebug] 84 interruptible: true 85 stage: test 86 script: 87 - ./gradlew -Pci --console=plain :app:testDebug 88