From 056574eebed17df7902425cfafbae9c51deda0c5 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Wed, 15 Jul 2026 00:22:12 -0400 Subject: [PATCH] [Fix] (CI): name APK artifacts by commit --- .github/workflows/apk.yml | 39 ++++++++++++++++------------- android-plugin/app/build.gradle.kts | 14 +++++++++++ 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/.github/workflows/apk.yml b/.github/workflows/apk.yml index 45d0a418..eb538745 100644 --- a/.github/workflows/apk.yml +++ b/.github/workflows/apk.yml @@ -74,7 +74,7 @@ jobs: run: python update_glslang_sources.py - name: Build plugin APK - run: gradle --no-daemon -p android-plugin :app:assemblePluginRelease -Pmobilegl.logLevel=MOBILEGL_LOG_LEVEL_INFO --parallel --max-workers "$(nproc)" + run: gradle --no-daemon -p android-plugin :app:assemblePluginRelease -Pmobilegl.apkSuffix="${short_sha}" -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 }} @@ -116,7 +116,7 @@ jobs: 66fdc867e552192d553d59095ea2e3cef4829de65c356f1fd826027b1905972e - name: Build retrace APK - run: gradle --no-daemon -p android-plugin :app:assembleTraceRelease -Pmobilegl.abis=all -Pmobilegl.debuggableRelease=true -Pmobilegl.logLevel=MOBILEGL_LOG_LEVEL_INFO --parallel --max-workers "$(nproc)" + run: gradle --no-daemon -p android-plugin :app:assembleTraceRelease -Pmobilegl.apkSuffix="${short_sha}" -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 }} @@ -129,21 +129,24 @@ jobs: - name: Verify APK metadata and packaging run: | AAPT2="$(find "$ANDROID_HOME/build-tools" -name aapt2 -type f | sort -V | tail -n 1)" - plugin_apk="$(find android-plugin/app/build/outputs/apk/plugin/release -name '*.apk' ! -name '*-debug-signed.apk' -print -quit)" - trace_apk="$(find android-plugin/app/build/outputs/apk/trace/release -name '*.apk' ! -name '*-debug-signed.apk' -print -quit)" - test -n "${plugin_apk}" - test -n "${trace_apk}" + plugin_apk="android-plugin/app/build/outputs/apk/plugin/release/MobileGL-plugin-release-${short_sha}.apk" + trace_apk="android-plugin/app/build/outputs/apk/trace/release/MobileGL-plugin-trace-release-${short_sha}.apk" + test -f "${plugin_apk}" + test -f "${trace_apk}" bash .github/scripts/validate-plugin-apks.sh "$AAPT2" "$plugin_apk" "$trace_apk" - 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 + mapfile -t APKS < <(printf '%s\n' \ + "android-plugin/app/build/outputs/apk/plugin/release/MobileGL-plugin-release-${short_sha}.apk" \ + "android-plugin/app/build/outputs/apk/trace/release/MobileGL-plugin-trace-release-${short_sha}.apk") + for APK in "${APKS[@]}"; do + if [[ ! -f "$APK" ]]; then + echo "::error::Expected release APK was not produced: $APK" + exit 1 + fi + done for APK in "${APKS[@]}"; do if [[ "$APK" == *-unsigned.apk ]]; then @@ -157,15 +160,15 @@ jobs: 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 + path: android-plugin/app/build/outputs/apk/plugin/release/MobileGL-plugin-release-${{ env.short_sha }}.apk + compression-level: 0 - 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 + path: android-plugin/app/build/outputs/apk/trace/release/MobileGL-plugin-trace-release-${{ env.short_sha }}.apk + compression-level: 0 trace-cases: name: trace case matrix @@ -365,8 +368,8 @@ jobs: MOBILEGL_TRACE_ANGLE_VARIANT: ${{ matrix.case.name == 'minecraft-1.21.4-fabric-iris-bliss-in-world' && '90a62123d794' || 'ec889e6ea831' }} MOBILEGL_MAGMA_R11G11B10F_FALLBACK: ${{ matrix.backend.name == 'DirectVulkan' && '1' || '0' }} run: | - apk_file="$(find android-retrace-apks -name '*.apk' ! -name '*-debug-signed.apk' -print -quit)" - test -n "${apk_file}" + apk_file="android-retrace-apks/MobileGL-plugin-trace-release-${short_sha}.apk" + test -f "${apk_file}" extra_retrace_args=() # Bliss needs the newer signed ANGLE variant plus sampler mipmap # min-filter downgrading on ANGLE llvmpipe. diff --git a/android-plugin/app/build.gradle.kts b/android-plugin/app/build.gradle.kts index e4f5aada..0beac5ab 100644 --- a/android-plugin/app/build.gradle.kts +++ b/android-plugin/app/build.gradle.kts @@ -1,3 +1,4 @@ +import com.android.build.gradle.internal.api.ApkVariantOutputImpl import com.launchers_plugin.renderer.buildscript.RendererConfig import com.launchers_plugin.renderer.buildscript.buildEnvs import com.launchers_plugin.renderer.buildscript.buildJsonValue @@ -62,6 +63,9 @@ val mobileGlMonthlyRevision = runGit( "--since=${String.format("%d-%02d-01T00:00:00", 2000 + mobileGlVersionMajor, mobileGlVersionMinor)}", "HEAD", )?.toIntOrNull() ?: 0 +val mobileGlApkSuffix = (findProperty("mobilegl.apkSuffix") ?: System.getenv("MOBILEGL_APK_SUFFIX") ?: mobileGlGitShortHash) + .toString() + .ifBlank { "nogit" } val pluginRendererConfig = buildJsonValue { renderer( @@ -189,6 +193,16 @@ android { } } +android.applicationVariants.configureEach { + outputs.configureEach { + (this as ApkVariantOutputImpl).outputFileName = when (flavorName) { + "plugin" -> "MobileGL-plugin-release-$mobileGlApkSuffix.apk" + "trace" -> "MobileGL-plugin-trace-release-$mobileGlApkSuffix.apk" + else -> outputFileName + } + } +} + androidComponents { onVariants(selector().withFlavor("profile" to "plugin")) { variant -> variant.packaging.jniLibs.excludes.add("**/libtrace_replay_runner.so")