Skip to content

Update to some new gradle 8.4 APIs #530

Update to some new gradle 8.4 APIs

Update to some new gradle 8.4 APIs #530

Workflow file for this run

name: CI
on:
# Only run push on main
push:
branches:
- main
paths-ignore:
- 'docs/**'
- '*.md'
# Always run on PRs
pull_request:
env:
# Test on API 30 because that's the first version with ATDs
API_LEVEL: '30'
AVD_TARGET: 'aosp_atd'
jobs:
build:
name: ${{ matrix.job }} / AGP ${{ matrix.agp }}
# Use macOS for emulator hardware acceleration
runs-on: 'macOS-latest'
timeout-minutes: 30
strategy:
fail-fast: false # We want to see all results
matrix:
agp: ['8.1.2', '8.2.0-beta06', '8.3.0-alpha07']
job: ['instrumentation', 'plugin']
env:
DEP_OVERRIDE_agp: ${{ matrix.agp }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1
- name: Install JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '20'
- name: Spot check
run: ./gradlew spotlessCheck
- name: Test plugin
id: gradle
if: matrix.job == 'plugin'
uses: gradle/gradle-build-action@v2
with:
arguments: -p keeper-gradle-plugin check
- name: Assemble instrumentation tests
id: gradle-assemble-instrumentation
if: matrix.job == 'instrumentation'
uses: gradle/gradle-build-action@v2
with:
arguments: :sample:minifyExternalStagingWithR8 validateL8 --stacktrace
# TODO AVD caching disabled due to https://github.com/ReactiveCircus/android-emulator-runner/issues/278
# - name: AVD cache
# uses: actions/cache@v3
# id: avd-cache
# if: matrix.job == 'instrumentation'
# with:
# path: |
# ~/.android/avd/*
# ~/.android/adbkey
# ~/.android/adbkey.pub
# key: avd-${{ env.API_LEVEL }}-${{ env.AVD_TARGET }}
#
# - name: Create AVD and generate snapshot for caching
# if: matrix.job == 'instrumentation' && steps.avd-cache.outputs.cache-hit != 'true'
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: ${{ env.API_LEVEL }}
# force-avd-creation: false
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# disable-animations: true
# disable-spellchecker: true
# target: ${{ env.AVD_TARGET }}
# channel: canary # Necessary for ATDs
# script: echo "Generated AVD snapshot for caching."
- name: Run instrumentation tests
if: matrix.job == 'instrumentation'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.API_LEVEL }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
disable-spellchecker: true
target: 'aosp_atd'
channel: canary # Necessary for ATDs
script: |
adb uninstall com.slack.keeper.sample || true
adb uninstall com.slack.keeper.sample.androidTest || true
# Now proceed, with much of the build being cached up to this point
echo "Running instrumentation tests"
./gradlew connectedExternalStagingAndroidTest --stacktrace
adb uninstall com.slack.keeper.sample || true
adb uninstall com.slack.keeper.sample.androidTest || true
- name: (Fail-only) Bundle the build report
if: failure()
run: find . -type d -name 'reports' | zip -@ -r build-reports.zip
- name: (Fail-only) Upload the build report
if: failure()
uses: actions/upload-artifact@v3
with:
name: error-report-${{ matrix.job }}-${{ matrix.agp }}
path: build-reports.zip
publish-snapshots:
name: Publish Snapshots
runs-on: 'ubuntu-latest'
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
needs: 'build'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '20'
# Just here to restore cache
- name: Gradle prep
id: gradle
uses: gradle/gradle-build-action@v2
with:
arguments: help
- name: Upload snapshot (main only)
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SonatypeUsername }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SonatypePassword }}
run: ./publish.sh