mirror of
https://github.com/narrrl/proton-stream.git
synced 2026-11-03 16:41:26 +01:00
ci(android): keep the cached libmpv and Rust target trees
Gradle deletes the declared outputs of a task it has no history for, so on every fresh checkout buildLibmpvAndroid threw away the libmpv tree just restored from the cache and rebuilt it from source (~14 min per job). The task no longer declares outputs; the script's STAMP decides. rust-cache treats target/android/<triple> as a profile directory and deletes its release tree before saving, so both cargo-ndk ABIs were rebuilt from scratch on every run (~6 min per job). It now caches only the registry and helpers; the target directory goes through actions/cache, keyed on toolchain and lockfile and restoring from the last lockfile.
This commit is contained in:
1 parent
22425e0bad
commit
66eb1b49a1
2 files changed
+56
-18
No files matched your search
@@ -107,19 +107,34 @@ jobs:
|
||||
"build-tools;${ANDROID_BUILD_TOOLS}"
|
||||
"ndk;${ANDROID_NDK}"
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- id: toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: '1.96'
|
||||
targets: aarch64-linux-android,x86_64-linux-android
|
||||
|
||||
# One cache for both jobs: the signed build compiles the same crates for
|
||||
# the same targets. Saved on failure too, so a run that breaks late does
|
||||
# not throw away everything it compiled before the break.
|
||||
# The registry and the installed helpers only. rust-cache reads
|
||||
# `target/android/<triple>` as a profile directory and deletes the
|
||||
# `release` tree under it before saving, so with its target caching on
|
||||
# every run rebuilt both ABIs from scratch.
|
||||
- uses: Swatinem/rust-cache@v2.9.1
|
||||
with:
|
||||
shared-key: android
|
||||
shared-key: android-registry
|
||||
cache-targets: false
|
||||
cache-on-failure: true
|
||||
|
||||
# The target directory as is: the host build the UniFFI bindings come
|
||||
# from and both cargo-ndk ABIs. One entry for both jobs, since the signed
|
||||
# build compiles the same crates for the same targets. A new lockfile
|
||||
# starts from the last one's tree, so a version bump rebuilds only the
|
||||
# workspace crates.
|
||||
- id: target
|
||||
uses: actions/cache/restore@v6
|
||||
with:
|
||||
path: target
|
||||
key: rust-target-android-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('Cargo.lock') }}
|
||||
restore-keys: rust-target-android-${{ steps.toolchain.outputs.cachekey }}-
|
||||
|
||||
# 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. Built
|
||||
@@ -167,6 +182,12 @@ jobs:
|
||||
- name: Android checks and artifacts
|
||||
run: bash scripts/build-android.sh all
|
||||
|
||||
- if: steps.target.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v6
|
||||
with:
|
||||
path: target
|
||||
key: ${{ steps.target.outputs.cache-primary-key }}
|
||||
|
||||
signed-release:
|
||||
name: Signed release
|
||||
if: startsWith(github.ref, 'refs/tags/v') || inputs.signed_release
|
||||
@@ -209,19 +230,34 @@ jobs:
|
||||
"build-tools;${ANDROID_BUILD_TOOLS}"
|
||||
"ndk;${ANDROID_NDK}"
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- id: toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: '1.96'
|
||||
targets: aarch64-linux-android,x86_64-linux-android
|
||||
|
||||
# One cache for both jobs: the signed build compiles the same crates for
|
||||
# the same targets. Saved on failure too, so a run that breaks late does
|
||||
# not throw away everything it compiled before the break.
|
||||
# The registry and the installed helpers only. rust-cache reads
|
||||
# `target/android/<triple>` as a profile directory and deletes the
|
||||
# `release` tree under it before saving, so with its target caching on
|
||||
# every run rebuilt both ABIs from scratch.
|
||||
- uses: Swatinem/rust-cache@v2.9.1
|
||||
with:
|
||||
shared-key: android
|
||||
shared-key: android-registry
|
||||
cache-targets: false
|
||||
cache-on-failure: true
|
||||
|
||||
# The target directory as is: the host build the UniFFI bindings come
|
||||
# from and both cargo-ndk ABIs. One entry for both jobs, since the signed
|
||||
# build compiles the same crates for the same targets. A new lockfile
|
||||
# starts from the last one's tree, so a version bump rebuilds only the
|
||||
# workspace crates.
|
||||
- id: target
|
||||
uses: actions/cache/restore@v6
|
||||
with:
|
||||
path: target
|
||||
key: rust-target-android-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('Cargo.lock') }}
|
||||
restore-keys: rust-target-android-${{ steps.toolchain.outputs.cachekey }}-
|
||||
|
||||
# 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. Built
|
||||
@@ -266,6 +302,12 @@ jobs:
|
||||
- name: Build signed APK and AAB
|
||||
run: bash scripts/build-android.sh signed
|
||||
|
||||
- if: steps.target.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v6
|
||||
with:
|
||||
path: target
|
||||
key: ${{ steps.target.outputs.cache-primary-key }}
|
||||
|
||||
# The APK bundles a GPL libmpv, so its corresponding source ships next to
|
||||
# it. The AAB is for Play only and stays out of the GitHub release.
|
||||
- name: Stage release files
|
||||
|
||||
Reference in new issue
Block a user