Skip to content

Misc repo infra updates #553

Misc repo infra updates

Misc repo infra updates #553

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:
concurrency:
group: 'ci-${{ github.event.merge_group.head_ref || github.head_ref }}-${{ github.workflow }}'
cancel-in-progress: true
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 }} / OS ${{ matrix.os }}
# Use macOS for emulator hardware acceleration
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false # We want to see all results
matrix:
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest']
agp: ['8.5.0', '8.6.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
- name: Enable KVM group perms
if: matrix.job == 'instrumentation' && matrix.os == 'ubuntu-latest'
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: Run instrumentation tests
if: matrix.job == 'instrumentation' && matrix.os == 'ubuntu-latest'
id: gradle-instrumentation-fork
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.API_LEVEL }}
arch: x86_64
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
disk-size: 6000M
heap-size: 600M
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) Upload the build reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: error-report-${{ matrix.job }}-${{ matrix.agp }}-${{ matrix.os }}
path: |
keeper-gradle-plugin/build/reports
sample/build/reports
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