Rearranging utp_test
to make it easy to add other rule names with t…
#27
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: CI workflow | |
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: [ main ] | |
paths-ignore: | |
- '**.md' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
concurrency: | |
# Cancel previous actions from the same PR: https://stackoverflow.com/a/72408109 | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
bzlmod: [true, false] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: "Checkout the sources" | |
uses: actions/checkout@v4 | |
- name: "Setup Bazelisk" | |
uses: bazelbuild/setup-bazelisk@v2 | |
- name: "Install platform-tools" | |
run: | | |
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "platform-tools" &>/dev/null | |
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses &>/dev/null | |
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --list_installed | |
- name: "Building core" | |
run: | | |
bazel --bazelrc=${{ github.workspace }}/.github/workflows/ci.bazelrc build --enable_bzlmod=${{ matrix.bzlmod }} //launcher/... //tools/... //provider/... | |
tests: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
bzlmod: [true] | |
runs-on: ${{ matrix.os }} | |
needs: build | |
steps: | |
- name: "Checkout the sources" | |
uses: actions/checkout@v4 | |
- name: "Setup Bazelisk" | |
uses: bazelbuild/setup-bazelisk@v2 | |
- name: "Running unit tests" | |
run: | | |
bazel --bazelrc=${{ github.workspace }}/.github/workflows/ci.bazelrc test --enable_bzlmod=${{ matrix.bzlmod }} //test/... | |
instrumentation-tests: | |
strategy: | |
# Allow tests to continue on other devices if they fail on one device. | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
api-level: [29] | |
bzlmod: [false] | |
runs-on: ${{ matrix.os }} | |
needs: build | |
timeout-minutes: 60 | |
steps: | |
- name: "Checkout the sources" | |
uses: actions/checkout@v4 | |
- name: "Enable KVM" | |
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 | |
- name: "Init AVD cache" | |
uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }} | |
- name: "Create AVD and generate snapshot for caching" | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
script: echo "Generated AVD snapshot for caching." | |
- name: "Run instrumentation test" | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
avd-name: android_avd | |
disable-animations: true | |
working-directory: ./example/ait | |
script: | | |
$ANDROID_HOME/platform-tools/adb get-serialno | |
bazel --bazelrc=${{ github.workspace }}/.github/workflows/ci.bazelrc test --enable_bzlmod=${{ matrix.bzlmod }} //:sample_instrumentation |