dev - added android test orchestrator #89
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: Dev - Push | |
on: | |
push: | |
paths-ignore: | |
- '.github/**' | |
- 'README.md' | |
- 'extras/**' | |
branches: [ "dev" ] | |
workflow_dispatch: | |
jobs: | |
unit-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup JDK And Gradle | |
uses: ./.github/actions/setup-jdk-gradle | |
with: | |
cache-read-only: false | |
- name: Get Google Services Json | |
env: | |
CERTIFICATE_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
run: | | |
echo $CERTIFICATE_BASE64 | base64 --decode > app/google-services.json | |
- name: Run Unit Test | |
run: ./gradlew test | |
- name: Assemble Debug | |
run: ./gradlew assembleDebug | |
- name: Upload Debug Apk | |
uses: actions/upload-artifact@v4 | |
with: | |
name: debug-apk | |
path: app/build/outputs/apk/debug/*.apk | |
- name: Upload Unit Test Report | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: unit-test-report | |
path: build/reports/unitTests | |
integration-test: | |
needs: [unit-test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Enable KVM | |
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: Setup JDK And Gradle | |
uses: ./.github/actions/setup-jdk-gradle | |
with: | |
cache-read-only: true | |
- name: Get Google Services Json | |
env: | |
CERTIFICATE_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
run: | | |
echo $CERTIFICATE_BASE64 | base64 --decode > app/google-services.json | |
- name: Run Integration Test | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 30 | |
target: google_apis | |
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 | |
script: ./gradlew connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.cucumberUseAndroidJUnitRunner=true mergeAndroidReports --continue | |
- name: Upload Integration Test Report | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: integration-test-report | |
path: build/androidTest-results | |
acceptance-test: | |
needs: [unit-test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Enable KVM | |
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: Setup JDK And Gradle | |
uses: ./.github/actions/setup-jdk-gradle | |
with: | |
cache-read-only: true | |
- name: Get Google Services Json | |
env: | |
CERTIFICATE_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
run: | | |
echo $CERTIFICATE_BASE64 | base64 --decode > app/google-services.json | |
- name: Run Acceptance Test | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 30 | |
target: google_apis | |
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 | |
script: ./gradlew connectedAndroidTest mergeAndroidReports --continue | |
- name: Upload Acceptance Test Report | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: acceptance-test-report | |
path: build/androidTest-results | |
appium-tests: | |
needs: [unit-test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: appium-tests | |
- name: Remove all apk in apps folder | |
run: rm -rf apps/* | |
- name: Display structure of downloaded files | |
run: ls -la apps | |
- name: Get Debug App That Was Uploaded In Unit-Test Stage | |
uses: actions/download-artifact@v4 | |
with: | |
name: debug-apk | |
path: apps | |
- name: Copy And Rename APK | |
run: cp ./apps/[PusherNotif]* ./apps/PusherNotif.apk | |
- name: Display structure of downloaded files | |
run: ls -la apps | |
- name: Enable KVM | |
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: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
cache-read-only: true | |
- name: Grant Execute Permission For Gradlew | |
run: chmod +x gradlew | |
shell: bash | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Setup And Run Appium | |
run: | | |
npm install -g appium@v2.4.1 | |
appium -v | |
appium driver install uiautomator2 | |
appium & | |
- name: Grant Execute Permission For Fcm | |
run: chmod +x fcm | |
shell: bash | |
- name: check | |
run: | | |
echo ~ | |
pwd | |
ls -la | |
shell: bash | |
- name: Run Test | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 30 | |
target: google_apis | |
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 | |
script: | | |
adb root | |
./gradlew test | |
- name: Upload Report | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: appium-test-report | |
path: build/reports | |
upload-debug-firebase-app-distribution: | |
needs: [unit-test, integration-test, acceptance-test, appium-tests] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup JDK And Gradle | |
uses: ./.github/actions/setup-jdk-gradle | |
with: | |
cache-read-only: false | |
- name: Get Google Services Json | |
env: | |
CERTIFICATE_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
run: | | |
echo $CERTIFICATE_BASE64 | base64 --decode > app/google-services.json | |
- name: Get Firebase App Distribution Key | |
env: | |
CERTIFICATE_BASE64: ${{ secrets.FIREBASE_APP_DISTRIBUTION_KEY }} | |
run: | | |
echo $CERTIFICATE_BASE64 | base64 --decode > app/main-firebase-app-distribution-admin-key.json | |
- name: Assemble Debug | |
run: ./gradlew assembleDebug -PversionCode=${{ github.run_number }} | |
- name: Upload To Firebase App Distribution | |
run: ./gradlew appDistributionUploadDebug |