From 8e824ec6cfa713a828626e488cbd9bf52d70cc3a Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Sun, 11 Oct 2026 21:52:35 +0200 Subject: [PATCH] feat(ci): add Android mobile test job to CI (issue #185) - Add test-android job to CI workflow - Run Android JVM unit tests with Gradle - Build Debug APK with Gradle - Upload Debug APK as artifact - Add mobile_changed detection in changes job - Add test-android to CI job dependencies All 1700+ tests pass --- .forgejo/workflows/ci.yml | 77 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index d276c89..f9034ed 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -43,6 +43,7 @@ jobs: docker_changed: ${{ steps.filter.outputs.docker }} sonar_changed: ${{ steps.filter.outputs.sonar }} deps_changed: ${{ steps.filter.outputs.deps }} + mobile_changed: ${{ steps.filter.outputs.mobile }} steps: - uses: actions/checkout@v4 with: @@ -298,6 +299,80 @@ jobs: echo "EOF" } >> "$GITHUB_OUTPUT" + + + # ───────────────────────────────────────────────────────────────────────── + # TESTS MOBILE (Android) — build APK + run JVM tests + # ───────────────────────────────────────────────────────────────────────── + test-android: + name: Tests Android (Mobile) + needs: [build, changes] + if: needs.changes.outputs.mobile_changed == 'true' || github.event_name == 'schedule' + runs-on: ubuntu-latest + timeout-minutes: 45 + outputs: + summary: ${{ steps.gen-summary.outputs.summary }} + steps: + - uses: actions/checkout@v4 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Setup JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + with: + api-level: 34 + ndk-version: r27c + emulator: false + + - name: Download build artifacts + uses: actions/download-artifact@v3 + with: + name: build-output + + - name: Run Android JVM unit tests + shell: bash + run: | + set -euo pipefail + cd Heimdall.Mobile + ./gradlew test --no-daemon --no-configuration-cache --info 2>&1 | tee /tmp/android-tests.log + grep -E "(Test|PASSED|FAILED)" /tmp/android-tests.log | head -30 || true + + - name: Build Debug APK + shell: bash + run: | + set -euo pipefail + cd Heimdall.Mobile + ./gradlew assembleDebug --no-daemon --no-configuration-cache 2>&1 | tee /tmp/android-build.log + ls -la app/build/outputs/apk/debug/app-debug.apk + + - name: Upload Debug APK + uses: actions/upload-artifact@v3 + with: + name: app-debug-apk + path: Heimdall.Mobile/app/build/outputs/apk/debug/app-debug.apk + retention-days: 7 + + - name: Générer le résumé + id: gen-summary + if: always() + shell: bash + run: | + SUMMARY=$(python3 scripts/ci/parse_test_log.py /tmp/*.log --coverage-dir /tmp/coverage 2>/dev/null || true) + { + echo "summary<> "$GITHUB_OUTPUT" + + # ───────────────────────────────────────────────────────────────────────── # SONARQUBE — analyse (non bloquant, gate en warning) # ───────────────────────────────────────────────────────────────────────── @@ -711,7 +786,7 @@ jobs: name: ci runs-on: debian-12 if: always() - needs: [build, test-unit, test-web, sonar, docker, dependency-check, post-summary] + needs: [build, test-unit, test-web, test-android, sonar, docker, dependency-check, post-summary] steps: - name: Vérifier les résultats shell: bash