Update ci-cd.yml #5
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: Android CI with Firebase Emulator | |
on: | |
push: | |
branches: | |
- testing | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Set up Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Grant Gradlew Permissions | |
working-directory: Cod | |
run: chmod +x ./gradlew | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install Firebase Tools | |
run: npm install -g firebase-tools | |
- name: Start Firebase Emulator (Background) | |
run: | | |
firebase emulators:start --only auth,database --project demo-project & | |
sleep 20 # Ensure emulators are fully started | |
- name: Run Unit Tests (Located in `test/`) | |
working-directory: Cod | |
run: ./gradlew testDebugUnitTest | |
- name: Start Android Emulator for UI & Integration Tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 33 | |
arch: x86_64 | |
profile: Nexus 6 | |
script: | | |
# Ensure Emulator is Ready | |
adb wait-for-device | |
sleep 10 | |
# Run UI & Integration Tests (Located in `androidTest/`) | |
./gradlew connectedDebugAndroidTest |