Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Docker image with Android emulator for running tests

License

Notifications You must be signed in to change notification settings

bitfireAT/docker-android-ci

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker image for testing Android apps with the Android emulator

Requirements

The used Android emulator uses hardware accelation and thus requires root access, i.e. a privileged Docker container. Unfortunately, it won't run with a shared runner (neither from Github nor from Gitlab).

It's recommended to install a self-hosted runner on a root server and run your project's CI based on this Docker image in a privileged container.

How to use with Github

When using with a self-hosted Github runner, specify the workflow like this:

  test_on_emulator:
    name: Tests with emulator
    runs-on: privileged
    container:
      image: ghcr.io/bitfireat/docker-android-ci:main
      options: --privileged
      env:
        ANDROID_HOME: /sdk
        ANDROID_AVD_HOME: /root/.android/avd
    steps:
	  # …

      - name: Start emulator
        run: start-emulator.sh
      - name: Run connected tests
        run: ./gradlew app:connectedStandardDebugAndroidTest

How to use with Gitlab

gitlab-ci-runner:

# /etc/gitlab-runner/config.toml

[[runners]]
  name = "runner1"
  [runners.docker]
    privileged = true

For DAVx⁵ and related components, the runner must have the privileged tag, because Android tests will require this tag.

Sample .gitlab-ci.yml:

image: ghcr.io/bitfireat/docker-android-ci:main

# …

test:
  tags:
    # require the privileged tag if the emulator is needed
    - privileged
  script:
    - start-emulator.sh
    - ./gradlew app:check app:connectedCheck
  artifacts:
    paths:
      - app/build/outputs/lint-results-debug.html
      - app/build/reports
      - build/reports

…

About

Docker image with Android emulator for running tests

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages