docker-android provides general purpose docker images to run CI steps of Android project. Docker allows you to provide a replicable environment, which does not change with the host machine or the CI service. It should work out of the box on any CI/CD service providing docker support. The image is providing standard tools to build and test Android application:
- Android SDK (optionally Android NDK)
- Default Ruby env through rbenv (for Fastlane for instance)
- Java JDK
- Google Cloud CLI, to support Firebase Test Lab
CI/CD service | Tested |
---|---|
GitHub Actions | ✅ |
GitLab CI | ✅ |
Circle CI | 🚧 |
Travis CI | 🚧 |
name: GitHub Action sample
on:
push:
branches:
- develop
jobs:
build_test_and_deploy:
runs-on: ubuntu-18.04 # Works also with self hosted runner supporting docker
container:
image: docker://fabernovel/android:api-29-v1.0.0
steps:
- name: Checkout
uses: actions/checkout@v2.1.0
- name: Ruby cache
uses: actions/cache@v1.1.2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Gradle cache
uses: actions/cache@v1.1.2
with:
path: /root/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle
- name: Bundle install
run: |
bundle config path vendor/bundle
bundle check || bundle install
- name: Fastlane
run: bundle exec fastlane my_lane
- name: Cache workaround # https://github.com/actions/cache/issues/133
run: chmod -R a+rwx .
docker-android images are hosted on DockerHub.
We provide stable and snapshot variants for latest Android API levels, including or not native SDK.
We use the following tagging policy:
API-NDK-VERSION
API
the Android API to use, likeapi-28
,api-29
NDK
is the presence or not of the Android NDK in the imageVERSION
is the image version. Check Versions
snapshot
versions are build on each push ondevelop
branch- Release versions
v*
on each GitHub Release
Image description (software and their versions) is provided as asset with each GitHub Release.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
You can change image settings via its Dockerfile. You can build, test, and deploy image using ci_cd.sh script. You need to install docker first. All scripts must be POSIX compliants.
usage: ./ci_cd.sh [--android-api 29] [--build] [--test]
--android-api <androidVersion> Use specific Android version from `sdkmanager --list`
--android-ndk Install Android NDK
--ndk-version <version> Install a specific Android NDK version from `sdkmanager --list`
--build Build image
--test Test image
--deploy Deploy image