Modularize Android emulator instrumentation testing #205
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-24.04-arm | |
| 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 | |
| run: ./scripts/build-android-app.sh -q -DskipTests | |
| - name: Add Android instrumentation test | |
| run: ./scripts/add-android-instrumentation-test.sh | |
| - name: Run Android instrumentation tests on emulator | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: 35 | |
| target: google_apis | |
| arch: arm64-v8a | |
| force-avd-creation: true | |
| disable-animations: true | |
| emulator-options: >- | |
| -no-window -no-boot-anim -gpu swiftshader_indirect | |
| -no-snapshot -camera-back none -camera-front none | |
| -accel off | |
| script: ./scripts/run-android-instrumentation-tests.sh | |
| - name: Export Android emulator screenshot path | |
| if: always() | |
| run: | | |
| set -euo pipefail | |
| echo "ANDROID_SCREENSHOT=" >> "$GITHUB_ENV" | |
| if [ -f scripts/.android-build-info ]; then | |
| # shellcheck disable=SC1090 | |
| source scripts/.android-build-info | |
| if [ -n "${SCREENSHOT_PATH:-}" ] && [ -f "$SCREENSHOT_PATH" ]; then | |
| echo "ANDROID_SCREENSHOT=$SCREENSHOT_PATH" >> "$GITHUB_ENV" | |
| fi | |
| fi | |
| - name: Upload Android emulator screenshot | |
| if: ${{ always() && env.ANDROID_SCREENSHOT != '' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-emulator-screenshot | |
| path: ${{ env.ANDROID_SCREENSHOT }} |