Created
July 29, 2018 08:45
-
-
Save Trumeet/ade128d0fc937e172415d5dba3af0067 to your computer and use it in GitHub Desktop.
GitLab CI Android project config example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 官方 https://about.gitlab.com/2016/11/30/setting-up-gitlab-ci-for-android-projects/ 早已过时,无法正常使用。这里分享一个自用的,不保证能行 | |
image: openjdk:8-jdk | |
variables: | |
ANDROID_COMPILE_SDK: "27" | |
ANDROID_BUILD_TOOLS: "27.0.3" | |
ANDROID_SDK_TOOLS: "4333796" # 在 https://developer.android.com/studio/ 下面的 Command line tools only 查 | |
before_script: | |
- apt-get --quiet update --yes>/dev/null | |
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1>/dev/null | |
- wget --quiet --output-document=android-sdk.tgz https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip | |
- unzip -q android-sdk.tgz | |
# 安装 SDK 包,按需使用。在自己电脑上使用 <SDK>/tools/bin/sdkmanager --list 查看 | |
- echo y | ./tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}">/dev/null | |
- echo y | ./tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}">/dev/null | |
- echo y | ./tools/bin/sdkmanager "extras;android;m2repository">/dev/null | |
- export ANDROID_HOME=$PWD | |
- export PATH=$PATH:$PWD/platform-tools/ | |
- chmod +x ./gradlew | |
# 编译 | |
build: | |
stage: build | |
script: | |
- "./gradlew :app:assembleRelease" | |
artifacts: | |
paths: | |
- app/build/outputs/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment