From 47b33cdb914ccce09274ad942a1d9cda62a77aac Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Sat, 3 Oct 2026 03:55:07 +0200 Subject: [PATCH] ci(android): keep the built libmpv when Gradle fails, OldTargetApi informational - libmpv is built in its own step and saved with actions/cache/save right after, so a failure later in the job no longer discards a 12 minute build the way a post-job save did - lint's OldTargetApi fails the gate whenever a new platform ships, like the dependency freshness checks already marked informational; raising targetSdk is a deliberate change with its own device pass --- .github/workflows/android.yml | 32 ++++++++++++++++++++++++++++---- android/app/build.gradle.kts | 3 +++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index b40ffc3..001d42d 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -122,12 +122,24 @@ jobs: # libmpv and its dependency tree are the slowest part of the build, and # depend only on the pinned revision and the build script, which stamps - # its output with both and skips the build when the stamp matches. - - uses: actions/cache@v6 + # its output with both and skips the build when the stamp matches. Built + # and saved in steps of its own, so a later failure in Gradle does not + # discard it the way a post-job cache save would. + - id: libmpv + uses: actions/cache/restore@v6 with: path: android/app/build/generated/mpv key: libmpv-${{ hashFiles('scripts/build-libmpv-android.sh') }} + - name: Build libmpv + run: bash scripts/build-libmpv-android.sh + + - if: steps.libmpv.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: android/app/build/generated/mpv + key: ${{ steps.libmpv.outputs.cache-primary-key }} + - uses: gradle/actions/setup-gradle@v4 with: gradle-version: '8.13' @@ -212,12 +224,24 @@ jobs: # libmpv and its dependency tree are the slowest part of the build, and # depend only on the pinned revision and the build script, which stamps - # its output with both and skips the build when the stamp matches. - - uses: actions/cache@v6 + # its output with both and skips the build when the stamp matches. Built + # and saved in steps of its own, so a later failure in Gradle does not + # discard it the way a post-job cache save would. + - id: libmpv + uses: actions/cache/restore@v6 with: path: android/app/build/generated/mpv key: libmpv-${{ hashFiles('scripts/build-libmpv-android.sh') }} + - name: Build libmpv + run: bash scripts/build-libmpv-android.sh + + - if: steps.libmpv.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: android/app/build/generated/mpv + key: ${{ steps.libmpv.outputs.cache-primary-key }} + - uses: gradle/actions/setup-gradle@v4 with: gradle-version: '8.13' diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 753ee81..6c12005 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -142,6 +142,9 @@ android { "GradleDependency", "NewerVersionAvailable", "AndroidGradlePluginVersion", + // The same for the platform: raising targetSdk opts into new + // behaviour and needs its own pass on a device. + "OldTargetApi", ) sarifReport = true }