Skip to content

Fix main and update things #541

Fix main and update things

Fix main and update things #541

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: 'ubuntu-latest'
timeout-minutes: 30
strategy:
fail-fast: false # We want to see all results
matrix:
agp: ['8.4.0', '8.5.0-alpha08']
job: ['instrumentation', 'plugin']
env:
DEP_OVERRIDE_agp: ${{ matrix.agp }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v3
- name: Install JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '21'
- name: Spot check
run: ./gradlew spotlessCheck
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Test plugin
id: gradle
if: matrix.job == 'plugin'
run: ./gradlew -p keeper-gradle-plugin check
- name: Assemble instrumentation tests
id: gradle-assemble-instrumentation
if: matrix.job == 'instrumentation'
run: ./gradlew :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: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Upload snapshot (main only)
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SonatypeUsername }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SonatypePassword }}
run: ./publish.sh