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 -Pmobilegl.logLevel=MOBILEGL_LOG_LEVEL_INFO --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 -Pmobilegl.logLevel=MOBILEGL_LOG_LEVEL_INFO --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 env: TRACE_REPLAY_CASES: | OpenRA|tools/trace_replay/fixtures/openra.tgz|openra.trace|tools/trace_replay/fixtures/openra.0000031249.png|31249|640|480|20|1|1|638|478|20|180 minecraft-1.21.4-startup|tools/trace_replay/fixtures/minecraft-1.21.4-startup.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-startup.0000092195.png|92195|854|480|20|0|0|0|0|20|180 minecraft-1.21.4-main-menu|tools/trace_replay/fixtures/minecraft-1.21.4-main-menu.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-main-menu.0000481787.png|481787|854|480|500|0|0|0|0|20|180 minecraft-1.21.4-in-world|tools/trace_replay/fixtures/minecraft-1.21.4-in-world.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-in-world.0000280000.png|280000|854|480|500|0|0|0|0|20|900 minecraft-1.21.4-fabric-sodium-in-world|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-sodium-in-world.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-sodium-in-world.0000923340.png|923340|854|480|20|0|0|0|0|20|1800 minecraft-1.21.4-fabric-iris-bsl-in-world|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-bsl-in-world.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-bsl-in-world.0000110725.png|110725|854|480|200|0|0|0|0|20|900 minecraft-1.21.4-fabric-iris-makeup-ultrafast-in-world|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-makeup-ultrafast-in-world.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-makeup-ultrafast-in-world.0000095322.png|95322|854|480|20|0|0|0|0|20|900 minecraft-1.21.4-fabric-iris-super-duper-vanilla-in-world|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-super-duper-vanilla-in-world.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-super-duper-vanilla-in-world.0000141559.png|141559|854|480|20|0|0|0|0|20|900 minecraft-1.21.4-fabric-iris-sundial-lite-in-world|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-sundial-lite-in-world.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-sundial-lite-in-world.0000150023.png|150023|854|480|20|0|0|0|0|20|900 minecraft-1.21.4-fabric-iris-complementary-reimagined-in-world|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-complementary-reimagined-in-world.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-complementary-reimagined-in-world.0000151297.png|151297|854|480|20|0|0|0|0|20|900 minecraft-1.21.4-fabric-iris-complementary-unbound-in-world|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-complementary-unbound-in-world.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-complementary-unbound-in-world.0000146559.png|146559|854|480|150|0|0|0|0|20|900 minecraft-1.21.4-fabric-iris-mellow-in-world|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-mellow-in-world.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-mellow-in-world.0000096143.png|96143|854|480|20|0|0|0|0|20|900 minecraft-1.21.4-fabric-iris-nostalgia-in-world|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-nostalgia-in-world.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-nostalgia-in-world.0000153808-linux-mesa.png|153808|854|480|60|0|0|0|0|20|900 minecraft-1.21.4-fabric-iris-bliss-in-world|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-bliss-in-world.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-bliss-in-world.0000113511.png|113511|854|480|40|0|0|0|0|20|900 minecraft-1.21.4-fabric-iris-chocapic-v6-lite-in-world|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-chocapic-v6-lite-in-world.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-chocapic-v6-lite-in-world.0000125124-linux-mesa.png|125124|854|480|200|0|0|0|0|20|900 minecraft-1.21.4-fabric-iris-iterationt-in-world|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-iterationt-in-world.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-iterationt-in-world.0001173280.png|1173280|854|480|150|0|0|0|0|20|2400 minecraft-1.21.4-fabric-iris-iterationt-nodsa-in-world|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-iterationt-nodsa-in-world.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-iterationt-nodsa-in-world.0001606997.png|1606997|854|480|150|0|0|0|0|20|2400 minecraft-1.21.4-fabric-iris-photon-v1.1-in-world|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-photon-v1.1-in-world.tgz|trace.trace|tools/trace_replay/fixtures/minecraft-1.21.4-fabric-iris-photon-v1.1-in-world.0000159866.png|159866|854|480|20|0|0|0|0|20|900 steps: - name: Checkout repo uses: actions/checkout@v4 with: lfs: true 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)" printf '%s\n' "${TRACE_REPLAY_CASES}" > android-retrace-cases.txt while IFS='|' read -r case_name trace_archive trace_file golden target_call width height tolerance crop_x crop_y crop_width crop_height fuzz_percent timeout_seconds; do [ -n "${case_name}" ] || continue 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 "${case_name}" \ --trace-archive "${trace_archive}" \ --trace-file "${trace_file}" \ --golden "${golden}" \ --target-call "${target_call}" \ --width "${width}" \ --height "${height}" \ --tolerance "${tolerance}" \ --crop-x "${crop_x}" \ --crop-y "${crop_y}" \ --crop-width "${crop_width}" \ --crop-height "${crop_height}" \ --fuzz-percent "${fuzz_percent}" \ --timeout-seconds "${timeout_seconds}" \ || status=1 done < android-retrace-cases.txt 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 angle -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)" printf '%s\n' "${TRACE_REPLAY_CASES}" > android-retrace-cases.txt while IFS='|' read -r case_name trace_archive trace_file golden target_call width height tolerance crop_x crop_y crop_width crop_height fuzz_percent timeout_seconds; do [ -n "${case_name}" ] || continue 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 "${case_name}" \ --trace-archive "${trace_archive}" \ --trace-file "${trace_file}" \ --golden "${golden}" \ --target-call "${target_call}" \ --width "${width}" \ --height "${height}" \ --tolerance "${tolerance}" \ --crop-x "${crop_x}" \ --crop-y "${crop_y}" \ --crop-width "${crop_width}" \ --crop-height "${crop_height}" \ --fuzz-percent "${fuzz_percent}" \ --timeout-seconds "${timeout_seconds}" \ || status=1 done < android-retrace-cases.txt 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