From bdce2347a03d9dd6601c6c31318db1b3fd07e038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Lo=CC=81pez=20Man=CC=83as?= Date: Sat, 24 Oct 2026 14:51:22 +0200 Subject: [PATCH] ci: run instrumentation tests on Ubuntu with KVM and skip redundant runs --- .github/workflows/coverage-history.yml | 2 +- .github/workflows/instrumentation-test.yml | 33 ++++++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coverage-history.yml b/.github/workflows/coverage-history.yml index 63cdefbfe..2cefdbe7a 100644 --- a/.github/workflows/coverage-history.yml +++ b/.github/workflows/coverage-history.yml @@ -119,7 +119,7 @@ jobs: .github/scripts/push_coverage_history.sh 'chore: record unit coverage' # The emulator already ran on the pull request, so its artifact is reused - # instead of booting another macOS runner. It is usually still running at + # instead of booting another emulator. It is usually still running at # merge time, so wait for it rather than recording the commit as having # no instrumentation data at all. - name: Wait for the pull request's emulator run diff --git a/.github/workflows/instrumentation-test.yml b/.github/workflows/instrumentation-test.yml index 3aefa7bef..b3f9613ac 100644 --- a/.github/workflows/instrumentation-test.yml +++ b/.github/workflows/instrumentation-test.yml @@ -20,11 +20,34 @@ on: types: [test] pull_request: branches-ignore: ['gh-pages'] + types: [opened, synchronize, reopened, ready_for_review] + # Changes that cannot affect the emulator tests. Workflow changes still run, so a bumped + # action is exercised before it merges. + paths-ignore: + - '**.md' + - 'docs/**' + - '.gemini/**' + - 'LICENSE' + - '.github/ISSUE_TEMPLATE/**' + - '.github/CODEOWNERS' + - '.github/dependabot.yml' workflow_dispatch: +# A new push to a pull request supersedes the run for the previous commit. +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + jobs: run-instrumentation-test: - runs-on: macOS-latest-large # enables hardware acceleration in the virtual machine + # Skip drafts (the run starts when the pull request is marked ready for review) and + # release-please pull requests, which only change versions and the changelog. + if: >- + github.event.pull_request.draft != true && + !startsWith(github.head_ref, 'release-please--') + # Ubuntu runners support KVM, so the emulator runs with hardware acceleration on a standard + # runner instead of a billed macOS larger runner. + runs-on: ubuntu-latest permissions: pull-requests: write timeout-minutes: 45 @@ -32,6 +55,12 @@ jobs: - name: Checkout Repo uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - 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: Set up JDK 21 uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 with: @@ -55,7 +84,7 @@ jobs: with: api-level: 29 target: google_apis - arch: x86 + arch: x86_64 disable-animations: true # The demo smoke tests run in their own workflow, see demo-smoke-test.yml. script: ./gradlew createDebugCoverageReport :maps-app:createLibraryCoverageReports --stacktrace -Pandroid.testInstrumentationRunnerArguments.notPackage=com.google.maps.android.compose.smoke