Fix lint errors surfaced by the new nightly lint job (#1937) #1518
This file contains hidden or 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 CI Build | |
| on: | |
| # Triggers the workflow on push or pull request events but only for the main branch | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| api-level: [33] | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v7 | |
| - 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: Setup Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 21 | |
| distribution: 'temurin' | |
| - name: Gradle cache | |
| uses: gradle/actions/setup-gradle@v6 | |
| # NOTE: Android Lint intentionally does NOT run on the PR/push path. lintObaGoogleDebug is | |
| # heavyweight (~7-15 min) and dominates this job's wall-clock; it runs instead in the `lint` job | |
| # in android-nightly.yml (no emulator needed there). The "run tests" step below keeps `-x lint` | |
| # so `check` doesn't pull lint back in. (Kotlin `-PwarningsAsErrors` compile gating still runs | |
| # here via `check`.) | |
| - name: AVD cache | |
| uses: actions/cache@v6 | |
| 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 | |
| arch: x86_64 | |
| target: google_apis | |
| 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 tests | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ matrix.api-level }} | |
| force-avd-creation: false | |
| arch: x86_64 | |
| target: google_apis | |
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
| disable-animations: true | |
| script: ./gradlew test check connectedObaGoogleDebugAndroidTest --build-cache -x lint -PwarningsAsErrors=true --stacktrace |