| | @@ -66,6 +66,7 @@ |
| 66 | 66 | | Architecture | `linux/amd64` (`runner.arch` is `X64`) | |
| 67 | 67 | | Operating system | Ubuntu 24.04 (`runner.os` is `Linux`) | |
| 68 | 68 | | User | `root`. `sudo` is installed and needs no password, so `sudo apt-get install ...` works as on GitHub | |
| 69 | +| Virtualization | `/dev/kvm` is available, for the Android emulator, QEMU and other KVM tools. See [Hardware virtualization (KVM)](#hardware-virtualization-kvm) | |
| 69 | 70 | | Network | Outbound internet access (only HTTP and HTTPS on instances that set [`EGRESS=web`](/docs/reference/limits#egress)); no inbound connections | |
| 70 | 71 | | Workspace | `/workspace/<repository name>` (`GITHUB_WORKSPACE`) | |
| 71 | 72 | | Temp directory | `/workspace/_temp` (`RUNNER_TEMP`) | |
| | @@ -153,6 +154,43 @@ |
| 153 | 154 | |
| 154 | 155 | > **Note:** Jobs run as `root`, and `sudo` runs commands without asking for a password, as on GitHub's runners. The image ships without apt package lists, so run `sudo apt-get update` before `sudo apt-get install ...`. |
| 155 | 156 | |
| 157 | +### Hardware virtualization (KVM) |
| 158 | + |
| 159 | +Hosted runners have `/dev/kvm`, so jobs can start virtual machines with hardware acceleration: the Android emulator, QEMU with `-enable-kvm`, Firecracker and other KVM tools. Jobs run as `root`, so `/dev/kvm` is usable without changing its permissions. |
| 160 | + |
| 161 | +For Android emulator tests with `reactivecircus/android-emulator-runner`, two things differ from GitHub's image: |
| 162 | + |
| 163 | +- **Leave out the "Enable KVM" step** that writes `/etc/udev/rules.d/99-kvm4all.rules` and runs `udevadm`. The image has no udev, so that step fails with `tee: /etc/udev/rules.d/99-kvm4all.rules: No such file or directory`, and it isn't needed when the job runs as root. |
| 164 | +- **Install the emulator's libraries** before it starts. GitHub's image has them; this one doesn't, and without them the emulator exits with `error while loading shared libraries: libX11.so.6`. |
| 165 | + |
| 166 | +```yaml |
| 167 | +jobs: |
| 168 | + android: |
| 169 | + runs-on: ubuntu-latest |
| 170 | + steps: |
| 171 | + - uses: actions/checkout@v4 |
| 172 | + - uses: actions/setup-java@v4 |
| 173 | + with: |
| 174 | + distribution: temurin |
| 175 | + java-version: 17 |
| 176 | + - uses: android-actions/setup-android@v3 |
| 177 | + with: |
| 178 | + packages: platform-tools |
| 179 | + - name: Emulator libraries |
| 180 | + run: | |
| 181 | + sudo apt-get update -qq |
| 182 | + sudo apt-get install -y -qq --no-install-recommends libx11-6 libx11-xcb1 libxcb1 libpulse0 libgl1 libegl1 libnss3 \ |
| 183 | + libxcomposite1 libxcursor1 libxdamage1 libxi6 libxtst6 libxrandr2 libxkbfile1 libasound2t64 libdbus-1-3 \ |
| 184 | + libxkbcommon0 libxkbcommon-x11-0 libxcb-cursor0 libfontconfig1 libfreetype6 |
| 185 | + - uses: reactivecircus/android-emulator-runner@v2 |
| 186 | + with: |
| 187 | + api-level: 30 |
| 188 | + arch: x86_64 |
| 189 | + script: ./gradlew connectedCheck |
| 190 | +``` |
| 191 | + |
| 192 | +Measured on 2026-10-26 on a large hosted runner: an Android 11 (API 30, x86_64) emulator booted in 37 seconds, and `emulator -accel-check` reported `KVM (version 12) is installed and usable.` Installing the libraries took about 17 seconds. `packages: platform-tools` keeps `setup-android` from asking for the old `tools` package, which its default list includes and which the current SDK no longer has (`Warning: Failed to find package 'tools'`). |
| 193 | + |
| 156 | 194 | ### Docker on hosted runners |
| 157 | 195 | |
| 158 | 196 | Docker works on hosted runners the same way as on GitHub's: job containers, service containers, Docker container actions, and `docker build`, `docker run` and `docker compose` in `run:` steps. Details: |