GitLab.com用于Android项目的CI共享运行程序
我想在我的Android应用程序gradle项目中使用GitLab CI系统。项目存储库位于,因此我想使用Gitlab Inc.提供的一个共享运行程序。GitLab.com用于Android项目的CI共享运行程序,android,android-gradle-plugin,gitlab,gitlab-ci,gitlab-ci-runner,Android,Android Gradle Plugin,Gitlab,Gitlab Ci,Gitlab Ci Runner,我想在我的Android应用程序gradle项目中使用GitLab CI系统。项目存储库位于,因此我想使用Gitlab Inc.提供的一个共享运行程序。 虽然官方教程为NodeJS项目运行程序配置提供了一个示例,也有Ruby项目的共享运行程序,但我找不到任何示例,甚至找不到支持Android应用程序的运行程序 是否有GitLab.com提供的共享运行程序,它支持Android项目开箱即用(通过指定image:Android:4.2.2或类似的内容) 有没有办法配置GitLab.com提供的现有
虽然官方教程为NodeJS项目运行程序配置提供了一个示例,也有Ruby项目的共享运行程序,但我找不到任何示例,甚至找不到支持Android应用程序的运行程序
- 是否有GitLab.com提供的共享运行程序,它支持Android项目开箱即用(通过指定
或类似的内容)image:Android:4.2.2
- 有没有办法配置GitLab.com提供的现有共享运行程序来支持Android项目(通过修改.GitLab ci.yml文件)
你可以在同一篇文章中找到关于构建Android应用程序的更多信息。这是我在Android项目中使用的
.gitlab ci.yml
文件。因为我把它改为一次安装一个组件,所以它非常稳定。有时许可证不能被接受,构建失败。但这种情况很少见。
重要的是,您的生成工具与此脚本中的相同(build-tools-23.0.3
),可能您必须在此处更改脚本
您可以省略工件
声明,我使用它来获取lint报告
before_script:
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip openjdk-7-jdk lib32stdc++6 lib32z1
- wget --quiet --output-document=android-sdk.tgz https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
- tar --extract --gzip --file=android-sdk.tgz
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter android-23
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter platform-tools
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter build-tools-23.0.3
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-android-m2repository
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-google_play_services
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-m2repository
- wget --quiet --output-document=gradle.zip https://services.gradle.org/distributions/gradle-2.12-bin.zip
- unzip -q gradle.zip
- export ANDROID_HOME=$PWD/android-sdk-linux
build:
script:
- gradle-2.12/bin/gradle assembleDebug check --stacktrace
artifacts:
paths:
- library/build/outputs/lint-results.html
- app/build/outputs/lint-results.html
我正在使用这个docker映像运行android build on
gitlab ci
更新:
移动到Gitlab注册表
image: registry.gitlab.com/showcheap/android-ci:latest
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
- chmod +x ./gradlew
cache:
paths:
- .gradle/wrapper
- .gradle/caches
build:
stage: build
script:
- ./gradlew assemble
test:
stage: test
script:
- ./gradlew check
完整指南可签入此Gitlab存储库:
如果您的目标SDK和构建工具版本未列出,请发出请求或fork my repo,然后生成您的自定义目标和构建版本。首先感谢您的回答。不过,恐怕它不适合我的情况。你在这里谈论的是建立我自己的跑步者,我想使用Gitlab.com提供的一个共享跑步者。谢谢@Chip,你节省了我研究的时间。我们可以一起使用Docker image和Gitlab Runner吗。@david是的,我已经在我的项目中测试过了。如果您有错误,请告诉我。@Sucipto我明白了,好吧,那么哪一个是最好的?前者还是后者?@david如果您使用的是target sdk=24,您应该使用最新的图像或使用
image:showcheap/gitlab ci android:24
@hardysim嗨,我刚刚移动到gitlab注册表。但当我们触发android构建时,gitlab仍然一次又一次地下载图像,因为gitlab ci runner和registry在不同的机器上。但我还是选择了gitlab,因为gitlab上的自动生成映像比docker hub快。如果您的问题得到解决,您可以选择答案,而且它可以在将来帮助彼此解决相同的问题。