GitLab.com CI共享Android项目的跑步者

JeB*_*JeB 17 android gitlab android-gradle-plugin gitlab-ci gitlab-ci-runner

我想在我的Android应用程序gradle项目中使用GitLab CI系统.项目存储库托管在GitLab.com上,所以我想使用Gitlab Inc. 提供的一个共享运行器.
虽然官方教程提供了NodeJS 项目运行器配置的示例,并且还有用于Ruby项目的共享运行器,I找不到任何支持Android应用程序的示例甚至是跑步者.

  • 是否有一个由GitLab.com提供的共享运行器,它支持开箱即用的Android项目(通过指定image: android:4.2.2或类似的东西)?
  • 有没有办法配置GitLab.com提供的现有共享运行器来支持Android项目(通过修改.gitlab-ci.yml文件)?

Suc*_*pto 14

我正在使用这个docker镜像来运行android build 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
Run Code Online (Sandbox Code Playgroud)

完整指南可以在这个Gitlab存储库中查看:https://gitlab.com/showcheap/android-ci

如果未列出您的Target SDK和Build Tools版本,请提出拉取请求或fork我的repo然后制作您的自定义目标和构建版本.


Kai*_*Kai 5

这是.gitlab-ci.yml我在我的android项目中使用的文件.因为我改变它一次安装一个组件它非常稳定.有时许可证无法接受,构建失败.但这是一个罕见的案例.重要的是您的构建工具与此脚本中的相同(build-tools-23.0.3)可能您必须在此处更改脚本.

您可以省略artifacts我用它来获取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
Run Code Online (Sandbox Code Playgroud)