|
| 1 | +name: android-compat |
| 2 | + |
| 3 | +# Checks the app still starts on the Android versions it supports |
| 4 | +# (humhub/app#189): the app launch smoke test on one emulator per API level, |
| 5 | +# from minSdk (24) up to targetSdk (36). Called by version-release.yml to gate |
| 6 | +# the Google Play upload; can also be run manually. |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_call: |
| 10 | + workflow_dispatch: |
| 11 | + # TEMP: run on every push while developing the suite; remove before merging. |
| 12 | + push: |
| 13 | + branches: [f-internal-172-v2] |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +concurrency: |
| 19 | + group: android-compat-${{ github.ref }} |
| 20 | + cancel-in-progress: ${{ github.event_name == 'push' }} |
| 21 | + |
| 22 | +jobs: |
| 23 | + android: |
| 24 | + name: Android API ${{ matrix.api-level }} |
| 25 | + runs-on: ubuntu-latest |
| 26 | + timeout-minutes: 30 |
| 27 | + strategy: |
| 28 | + # Every level's result is wanted, not only the first failure. |
| 29 | + fail-fast: false |
| 30 | + matrix: |
| 31 | + api-level: [24, 26, 28, 30, 33, 36] |
| 32 | + env: |
| 33 | + HUMHUB_IMAGE_TAG: '1.18' |
| 34 | + EMULATOR_OPTIONS: -no-window -gpu swiftshader_indirect -no-audio -no-boot-anim -camera-back none |
| 35 | + steps: |
| 36 | + - name: Checkout |
| 37 | + uses: actions/checkout@v4 |
| 38 | + |
| 39 | + # The test harness needs the backend's fixture values. Runs in the |
| 40 | + # background while the toolchain and emulator are set up. |
| 41 | + - name: Start HumHub backend (background) |
| 42 | + run: | |
| 43 | + mkdir -p scripts/e2e/logs |
| 44 | + nohup scripts/e2e/up.sh > scripts/e2e/logs/up.txt 2>&1 & |
| 45 | +
|
| 46 | + - name: Enable KVM |
| 47 | + run: | |
| 48 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 49 | + sudo udevadm control --reload-rules |
| 50 | + sudo udevadm trigger --name-match=kvm |
| 51 | +
|
| 52 | + - uses: actions/setup-java@v5 |
| 53 | + with: |
| 54 | + distribution: 'zulu' |
| 55 | + java-version: '17' |
| 56 | + cache: gradle |
| 57 | + |
| 58 | + - uses: subosito/flutter-action@v2 |
| 59 | + with: |
| 60 | + flutter-version: '3.47.0' |
| 61 | + channel: 'stable' |
| 62 | + cache: true |
| 63 | + |
| 64 | + - name: Install dependencies |
| 65 | + run: flutter pub get |
| 66 | + |
| 67 | + # Same AVD caching as the android job in e2e-tests.yml. |
| 68 | + - name: Restore AVD |
| 69 | + uses: actions/cache/restore@v4 |
| 70 | + id: avd-cache |
| 71 | + with: |
| 72 | + path: | |
| 73 | + ~/.android/avd/* |
| 74 | + ~/.android/adb* |
| 75 | + key: avd-${{ matrix.api-level }}-google_apis-x86_64-v1 |
| 76 | + |
| 77 | + - name: Create AVD snapshot |
| 78 | + if: steps.avd-cache.outputs.cache-hit != 'true' |
| 79 | + uses: reactivecircus/android-emulator-runner@v2 |
| 80 | + with: |
| 81 | + api-level: ${{ matrix.api-level }} |
| 82 | + target: google_apis |
| 83 | + arch: x86_64 |
| 84 | + force-avd-creation: false |
| 85 | + emulator-options: ${{ env.EMULATOR_OPTIONS }} |
| 86 | + disable-animations: false |
| 87 | + script: echo "Generated AVD snapshot for caching." |
| 88 | + |
| 89 | + - name: Save AVD |
| 90 | + if: steps.avd-cache.outputs.cache-hit != 'true' |
| 91 | + uses: actions/cache/save@v4 |
| 92 | + with: |
| 93 | + path: | |
| 94 | + ~/.android/avd/* |
| 95 | + ~/.android/adb* |
| 96 | + key: ${{ steps.avd-cache.outputs.cache-primary-key }} |
| 97 | + |
| 98 | + - name: Wait for HumHub backend |
| 99 | + timeout-minutes: 10 |
| 100 | + run: | |
| 101 | + while pgrep -f scripts/e2e/up.sh > /dev/null; do sleep 2; done |
| 102 | + cat scripts/e2e/logs/up.txt |
| 103 | + test -f scripts/e2e/.e2e_fixtures.env |
| 104 | +
|
| 105 | + - name: Run app launch test on emulator |
| 106 | + uses: reactivecircus/android-emulator-runner@v2 |
| 107 | + with: |
| 108 | + api-level: ${{ matrix.api-level }} |
| 109 | + target: google_apis |
| 110 | + arch: x86_64 |
| 111 | + force-avd-creation: false |
| 112 | + emulator-options: -no-snapshot-save ${{ env.EMULATOR_OPTIONS }} |
| 113 | + disable-animations: true |
| 114 | + script: scripts/e2e/run_android.sh integration_test/app_launch_test.dart |
| 115 | + |
| 116 | + - name: Upload logs |
| 117 | + if: always() |
| 118 | + uses: actions/upload-artifact@v4 |
| 119 | + with: |
| 120 | + name: e2e-android-api${{ matrix.api-level }}-logs |
| 121 | + path: scripts/e2e/logs |
| 122 | + if-no-files-found: ignore |
| 123 | + retention-days: 7 |
0 commit comments