Add sample for configurations #1
This file contains 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: AndroidCI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: build-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build and Test Android App | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
cache: gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
validate-wrappers: true | |
gradle-home-cache-cleanup: true | |
- name: Check build-logic | |
run: ./gradlew check -p build-logic | |
- name: Run local Tests with report | |
run: ./gradlew test | |
- name: Enable KVM group perms | |
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 | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 30 | |
arch: x86_64 | |
disable-animations: true | |
script: ./gradlew connectedAndroidTest | |
- name: Assemble the app | |
run: ./gradlew :app:assemble | |
- name: Upload build outputs (APKs) | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: APKs | |
path: '**/build/outputs/apk/**/*.apk' | |
- name: Upload Unit Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unit-test-results | |
path: '**/build/test-results/test*/**/*.xml' | |
- name: Upload Instrumentation Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: instrumentation-test-results | |
path: '**/build/outputs/androidTest-results/connected/**/*.xml' |