Auto approve users on review apps #57
Workflow file for this run
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
# This workflow needs to be kept at par with | |
# https://github.com/simpledotorg/simple-android/blob/master/.github/workflows/ci_checks.yml | |
name: Android QA tests | |
on: | |
push: | |
branches: | |
- "user-enumeration-attack-monitoring" | |
inputs: | |
pr_number: | |
description: 'PR number' | |
required: true | |
jobs: | |
android_qa_tests: | |
runs-on: [ macos-11 ] | |
env: | |
AVD_API_LEVEL: 30 | |
AVD_ARCH: x86_64 | |
PR_NUMBER: ${{ github.event.inputs.pr_number }} | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout Android source | |
uses: actions/checkout@v3 | |
with: | |
repository: simpledotorg/simple-android | |
path: android-app | |
- name: Cache AVD | |
uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: ${{ runner.os }}-avd-${{ env.AVD_API_LEVEL }}-${{ env.AVD_ARCH }} | |
- 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: ${{ env.AVD_API_LEVEL }} | |
arch: ${{ env.AVD_ARCH }} | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
disk-size: 8G | |
script: echo "Generated AVD snapshot for caching." | |
- name: set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: QA Android Tests | |
id: run-instrumented-tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ env.AVD_API_LEVEL }} | |
arch: ${{ env.AVD_ARCH }} | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
disk-size: 8G | |
script: | | |
adb root | |
mkdir -p android-app/app/build/outputs/test-artifacts | |
android-app/gradlew -p android-app --build-cache --no-daemon -PmanifestEndpoint=https://simple-review-pr-4872.herokuapp.com/api/ installQaDebug installQaDebugAndroidTest | |
adb shell am instrument -w -e filter org.simple.clinic.benchmark.SelectBenchmarkTests -e benchmark_app_performance false org.simple.clinic.qa.debug.test/org.simple.clinic.AndroidTestJUnitRunner >android-app/app/build/outputs/test-artifacts/logs.txt 2>android-app/app/build/outputs/test-artifacts/logs.txt | |
cat android-app/app/build/outputs/test-artifacts/logs.txt | |
adb pull /storage/emulated/0/Android/data/org.simple.clinic.qa.debug/ android-app/app/build/outputs/test-artifacts/ || true | |
adb uninstall org.simple.clinic.qa.debug | |
adb uninstall org.simple.clinic.qa.debug.test | |
! grep -q "FAILURES\!\!\!" android-app/app/build/outputs/test-artifacts/logs.txt | |
- name: Upload failed test artifacts | |
if: always() && steps.run-instrumented-tests.outcome != 'success' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-artifacts | |
path: android-app/app/build/outputs/test-artifacts |