Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
W
wiki
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • F-Droid
  • wiki
  • Wiki
  • Running emulators in GitLab CI

Last edited by Hans-Christoph Steiner Feb 24, 2021
Page history

Running emulators in GitLab CI

Running Android emulators in GitLab CI is very handy for running test suites on merge requests. Also, it lets you test on old Android versions even if you have no device with that Android version. This was announced as a release in a blog post

We use our own Docker images to support this:

  • https://gitlab.com/fdroid/ci-images-client
  • https://gitlab.com/fdroid/ci-images-base

Unfortunately, the quality control on the system-image packages is spotty, so a number of them are not really usable. It is important to use the default rather than google_apis system-images they do not contain the Google Play and apps binary blobs, and because the Google apps seem to slow down the boot process a lot. Also, it seems the android-22 through android-27 system images seem to require less resources than the newer ones, so much so that they are unlikely to work at all for some projects.

Here are some example runs to see what works:

  • all available system-images without KVM ("no accel") in regular shared runners:
    • https://gitlab.com/eighthave/fdroidclient/-/pipelines/258788881
    • https://gitlab.com/eighthave/fdroidclient/-/pipelines/260697855
  • all available system-images with KVM in fdroid runners:
    • https://gitlab.com/eighthave/fdroidclient/-/pipelines/260698010
    • https://gitlab.com/eighthave/fdroidclient/-/pipelines/258791968

Usage

The fdroiclient setup uses YAML templates to make it easy to choose specific emulator setups, specifically, the test-template, the connected-template, and the kvm-template.

We use the default image in fdroidclient like this:

no-accel 22 default x86:
  <<: *test-template
  <<: *connected-template

kvm 29 default x86_64:
  <<: *kvm-template

This script can help you generate multiple entries:


for system_image in `sdkmanager --list|awk '{print $1}'|sort|grep ';android-[23][02-9]'|grep -F ';x86'|grep -E ';(default|google|microg)'|sort -u`; do
    echo kvm `echo $system_image | cut -d - -f 3 | sed 's,;, ,g'`:
    printf '  <<: *kvm-template\n\n'
done

Test image based on Google's

Google has their own scripts for creating Docker images for the Android emulator. This is an experimental project to do something like fdroid/ci-images-client with their images as a base:

  • https://gitlab.com/eighthave/ci-images-emulator-kvm

microg system-images

The microg system-image repository is also included in the F-Droid setup. There are currently two images:

  • system-images;android-29;microg;x86_64
  • system-images;android-23;microg;x86 - requires emulator v28 or older because it lacks a "ranchu" kernel.
Clone repository
  • FAQ
  • Integrating F Droid builds into your own CI workflow
  • Internal
    • Becoming a Core Contributor
    • Buildbot
    • Deploying fdroid bot
    • Issue Cleanup Policy
    • Known Core Contributors
    • OpenCollective
    • Release Process
    • Servers
    • Workflow Policy
  • Metadata
    • XML and JSON v1 Index
    • YAML Metadata
  • Public buildserver instances
  • Running emulators in GitLab CI
View All Pages