name: MobileGL APK on: push: branches: - dev - Feat/Backend-Direct-GLES - Feat/Backend-Direct-Vulkan workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v4 with: submodules: recursive - name: Set artifact metadata run: | echo "date_today=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV" echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_ENV" - name: Set up JDK uses: actions/setup-java@v4 with: distribution: zulu java-version: '17' - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 with: gradle-version: 8.10.2 - name: Setup Android SDK uses: android-actions/setup-android@v3 - name: Install Android NDK run: | sdkmanager "ndk;27.3.13750724" echo "ndk.dir=$ANDROID_HOME/ndk/27.3.13750724" >> android-plugin/local.properties - name: Update glslang external sources working-directory: 3rdparty/glslang run: python update_glslang_sources.py - name: Build plugin APKs run: gradle --no-daemon -p android-plugin :app:assembleEsprytPluginRelease :app:assembleMagmaPluginRelease --parallel --max-workers "$(nproc)" env: SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} - name: Build retrace APKs run: gradle --no-daemon -p android-plugin :app:assembleEsprytTraceRelease :app:assembleMagmaTraceRelease -Pmobilegl.abis=all -Pmobilegl.debuggableRelease=true --parallel --max-workers "$(nproc)" env: SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} - name: Verify signed APKs run: | APKSIGNER="$(find "$ANDROID_HOME/build-tools" -name apksigner -type f | sort -V | tail -n 1)" mapfile -t APKS < <(find android-plugin/app/build/outputs/apk -type f -path '*/release/*.apk' | sort) if [ "${#APKS[@]}" -eq 0 ]; then echo "::error::No release APKs found under android-plugin/app/build/outputs/apk" find android-plugin/app/build/outputs/apk -type f -print || true exit 1 fi for APK in "${APKS[@]}"; do if [[ "$APK" == *-unsigned.apk ]]; then echo "::error::Unsigned release APK produced: $APK" exit 1 fi "$APKSIGNER" verify --verbose "$APK" done - name: Upload plugin APK uses: actions/upload-artifact@v4 with: name: MobileGL-plugin-${{ env.date_today }}-${{ env.short_sha }} path: android-plugin/app/build/outputs/apk/*Plugin/release/*.apk if-no-files-found: error - name: Upload retrace APK uses: actions/upload-artifact@v4 with: name: MobileGL-retrace-apk-${{ env.date_today }}-${{ env.short_sha }} path: android-plugin/app/build/outputs/apk/*Trace/release/*.apk if-no-files-found: error retrace: runs-on: ubuntu-latest needs: build steps: - name: Checkout repo uses: actions/checkout@v4 with: submodules: recursive - name: Set artifact metadata run: | echo "date_today=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV" echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_ENV" - name: Setup Android SDK uses: android-actions/setup-android@v3 - name: Download retrace APKs uses: actions/download-artifact@v4 with: pattern: MobileGL-retrace-apk-* path: android-retrace-apks merge-multiple: true - name: Enable KVM 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: Retrace and validate Espryt (DirectGLES) uses: reactivecircus/android-emulator-runner@v2 with: api-level: 35 target: google_apis arch: x86_64 profile: pixel_6 disable-animations: true emulator-options: -no-window -gpu swiftshader -no-snapshot -noaudio -no-boot-anim -camera-back none -camera-front none script: >- set +e; status=0; apk_file="$(find android-retrace-apks -name 'MobileGL-EsprytTrace-release.apk' -print -quit)"; sh android-plugin/trace-replay-ci.sh --apk-file "${apk_file}" --package top.mobilegl.plugin.espryt.trace --backend DirectGLES --result-root android-retrace-result --fixture-root android-retrace-fixture --case OpenRA --trace-archive tools/trace_replay/fixtures/openra.tgz --trace-file openra.trace --golden tools/trace_replay/fixtures/openra.0000031249.png --target-call 31249 --width 640 --height 480 --tolerance 20 --crop-x 1 --crop-y 1 --crop-width 638 --crop-height 478 --fuzz-percent 20 --timeout-seconds 180 || status=1; sh android-plugin/trace-replay-ci.sh --apk-file "${apk_file}" --package top.mobilegl.plugin.espryt.trace --backend DirectGLES --result-root android-retrace-result --fixture-root android-retrace-fixture --case minecraft-1.21.4-startup --trace-archive tools/trace_replay/fixtures/minecraft-1.21.4-startup.tgz --trace-file trace.trace --golden tools/trace_replay/fixtures/minecraft-1.21.4-startup.0000092195.png --target-call 92195 --width 854 --height 480 --tolerance 20 --crop-x 0 --crop-y 0 --crop-width 0 --crop-height 0 --fuzz-percent 20 --timeout-seconds 180 || status=1; sh android-plugin/trace-replay-ci.sh --apk-file "${apk_file}" --package top.mobilegl.plugin.espryt.trace --backend DirectGLES --result-root android-retrace-result --fixture-root android-retrace-fixture --case minecraft-1.21.4-main-menu --trace-archive tools/trace_replay/fixtures/minecraft-1.21.4-main-menu.tgz --trace-file trace.trace --golden tools/trace_replay/fixtures/minecraft-1.21.4-main-menu.0000481787.png --target-call 481787 --width 854 --height 480 --tolerance 500 --crop-x 0 --crop-y 0 --crop-width 0 --crop-height 0 --fuzz-percent 20 --timeout-seconds 180 || status=1; sh android-plugin/trace-replay-ci.sh --apk-file "${apk_file}" --package top.mobilegl.plugin.espryt.trace --backend DirectGLES --result-root android-retrace-result --fixture-root android-retrace-fixture --case minecraft-1.21.4-in-world --trace-archive tools/trace_replay/fixtures/minecraft-1.21.4-in-world.tgz --trace-file trace.trace --golden tools/trace_replay/fixtures/minecraft-1.21.4-in-world.0004000686.png --target-call 4000686 --width 854 --height 480 --tolerance 500 --crop-x 0 --crop-y 0 --crop-width 0 --crop-height 0 --fuzz-percent 20 --timeout-seconds 900 || status=1; mkdir -p android-retrace-result/status; echo "${status}" > android-retrace-result/status/DirectGLES.status; exit 0 - name: Retrace and validate Magma (DirectVulkan) if: always() uses: reactivecircus/android-emulator-runner@v2 with: api-level: 35 target: google_apis arch: x86_64 profile: pixel_6 disable-animations: true emulator-options: -no-window -gpu host -no-snapshot -noaudio -no-boot-anim -camera-back none -camera-front none script: >- set +e; status=0; apk_file="$(find android-retrace-apks -name 'MobileGL-MagmaTrace-release.apk' -print -quit)"; sh android-plugin/trace-replay-ci.sh --apk-file "${apk_file}" --package top.mobilegl.plugin.magma.trace --backend DirectVulkan --result-root android-retrace-result --fixture-root android-retrace-fixture --case OpenRA --trace-archive tools/trace_replay/fixtures/openra.tgz --trace-file openra.trace --golden tools/trace_replay/fixtures/openra.0000031249.png --target-call 31249 --width 640 --height 480 --tolerance 20 --crop-x 1 --crop-y 1 --crop-width 638 --crop-height 478 --fuzz-percent 20 --timeout-seconds 180 || status=1; sh android-plugin/trace-replay-ci.sh --apk-file "${apk_file}" --package top.mobilegl.plugin.magma.trace --backend DirectVulkan --result-root android-retrace-result --fixture-root android-retrace-fixture --case minecraft-1.21.4-startup --trace-archive tools/trace_replay/fixtures/minecraft-1.21.4-startup.tgz --trace-file trace.trace --golden tools/trace_replay/fixtures/minecraft-1.21.4-startup.0000092195.png --target-call 92195 --width 854 --height 480 --tolerance 20 --crop-x 0 --crop-y 0 --crop-width 0 --crop-height 0 --fuzz-percent 20 --timeout-seconds 180 || status=1; sh android-plugin/trace-replay-ci.sh --apk-file "${apk_file}" --package top.mobilegl.plugin.magma.trace --backend DirectVulkan --result-root android-retrace-result --fixture-root android-retrace-fixture --case minecraft-1.21.4-main-menu --trace-archive tools/trace_replay/fixtures/minecraft-1.21.4-main-menu.tgz --trace-file trace.trace --golden tools/trace_replay/fixtures/minecraft-1.21.4-main-menu.0000481787.png --target-call 481787 --width 854 --height 480 --tolerance 500 --crop-x 0 --crop-y 0 --crop-width 0 --crop-height 0 --fuzz-percent 20 --timeout-seconds 180 || status=1; sh android-plugin/trace-replay-ci.sh --apk-file "${apk_file}" --package top.mobilegl.plugin.magma.trace --backend DirectVulkan --result-root android-retrace-result --fixture-root android-retrace-fixture --case minecraft-1.21.4-in-world --trace-archive tools/trace_replay/fixtures/minecraft-1.21.4-in-world.tgz --trace-file trace.trace --golden tools/trace_replay/fixtures/minecraft-1.21.4-in-world.0004000686.png --target-call 4000686 --width 854 --height 480 --tolerance 500 --crop-x 0 --crop-y 0 --crop-width 0 --crop-height 0 --fuzz-percent 20 --timeout-seconds 900 || status=1; mkdir -p android-retrace-result/status; echo "${status}" > android-retrace-result/status/DirectVulkan.status; exit 0 - name: Upload Android retrace result if: always() uses: actions/upload-artifact@v4 with: name: MobileGL-android-retrace-result-${{ env.date_today }}-${{ env.short_sha }} path: android-retrace-result/** if-no-files-found: warn - name: Check Android retrace results if: always() run: | direct_gles_status="$(cat android-retrace-result/status/DirectGLES.status 2>/dev/null || echo 1)" direct_vulkan_status="$(cat android-retrace-result/status/DirectVulkan.status 2>/dev/null || echo 1)" echo "DirectGLES status: ${direct_gles_status}" echo "DirectVulkan status: ${direct_vulkan_status}" if [ "${direct_gles_status}" -ne 0 ] || [ "${direct_vulkan_status}" -ne 0 ]; then exit 1 fi