Add Android instrumentation test execution to CI #265
This file contains hidden or 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: Test Android build scripts | |
| 'on': | |
| pull_request: | |
| paths: | |
| - 'scripts/**' | |
| - 'BUILDING.md' | |
| push: | |
| branches: | |
| - master | |
| paths-ignore: | |
| - '**/*.md' | |
| jobs: | |
| build-android: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup workspace | |
| run: ./scripts/setup-workspace.sh -q -DskipTests | |
| - name: Build Android port | |
| run: ./scripts/build-android-port.sh -q -DskipTests | |
| - name: Build Hello Codename One Android app | |
| id: build-android-app | |
| run: ./scripts/build-android-app.sh -q -DskipTests | |
| - name: Enable KVM for Android emulator | |
| 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: Run Android instrumentation tests | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: 31 | |
| arch: x86_64 | |
| target: google_apis | |
| script: | | |
| ./scripts/run-android-instrumentation-tests.sh "${{ steps.build-android-app.outputs.gradle_project_dir }}" | |
| - name: Upload emulator screenshot | |
| if: always() # still collect it if tests fail | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: emulator-screenshot | |
| path: artifacts/*.png | |
| if-no-files-found: warn | |
| retention-days: 14 | |
| compression-level: 6 |