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
This commit is contained in:
1 parent
58b6a1de9b
commit
8e824ec6cf
1 file changed
+76
-1
@@ -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<<EOF"
|
||||
printf '%s
|
||||
' "$SUMMARY"
|
||||
echo "EOF"
|
||||
} >> "$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
|
||||
|
||||
Reference in new issue
Block a user