CI: Trigger workflow on push and pull request to main branch, update … #327
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
JAVA_VERSION: 21 | |
jobs: | |
BuildAndTest: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ macos-latest, ubuntu-latest, windows-latest ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ env.JAVA_VERSION }} | |
if: ${{ matrix.os != 'self-hosted' }} | |
- uses: gradle/actions/setup-gradle@v4 | |
- run: ./gradlew ciBuildAndTest --stacktrace | |
- name: Update Gradle Wrapper | |
uses: gradle-update/update-gradle-wrapper-action@v2 | |
Device: | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: false | |
matrix: | |
managed-virtual-device: [ 27, 28, 29, 30, 31, 32, 33, 34 ] | |
experimental: [ false ] | |
os: [ ubuntu-latest ] | |
include: | |
- managed-virtual-device: 35 | |
experimental: true | |
os: ubuntu-latest | |
- managed-virtual-device: 35 | |
experimental: true | |
os: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Enable KVM group perms | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ env.JAVA_VERSION }} | |
if: ${{ matrix.os != 'self-hosted' }} | |
- uses: gradle/actions/setup-gradle@v4 | |
- run: ./gradlew ciSdkManagerLicenses --stacktrace | |
- run: ./gradlew managedVirtualDevice${{ matrix.managed-virtual-device }}DebugAndroidTest | |
-Pandroid.testInstrumentationRunnerArguments.class=siarhei.luskanau.managed.virtual.device.ExampleInstrumentedTest | |
-Pandroid.testoptions.manageddevices.emulator.gpu=swiftshader_indirect | |
--stacktrace |