From d0dc117c51292d839d99e455594b78b98cc485a0 Mon Sep 17 00:00:00 2001 From: Tony Giorgio Date: Tue, 20 Jan 2026 14:23:06 -0600 Subject: [PATCH 1/2] ci: use actions/cache for Android NDK instead of broken local-cache The nttld/setup-ndk local-cache option has a known bug where symlinks break after cache restore (see nttld/setup-ndk#547). This causes NDK to be re-downloaded on every run despite caching. Switch to manual caching with actions/cache which properly handles the NDK directory. The cache key is simple (OS + NDK version) since the NDK content is static. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> --- .github/workflows/android-build.yml | 13 +++++++++---- .github/workflows/release.yml | 13 +++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index 80f6a628..740b7b3c 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -127,13 +127,18 @@ jobs: ${{ runner.os }}-cargo-${{ matrix.rust_target }}- ${{ runner.os }}-cargo- + - name: Cache Android NDK + uses: actions/cache@v4 + id: ndk-cache + with: + path: /home/runner/.setup-ndk/r27c + key: ${{ runner.os }}-ndk-r27c + - name: Setup Android NDK + if: steps.ndk-cache.outputs.cache-hit != 'true' uses: nttld/setup-ndk@v1 - id: setup-ndk with: ndk-version: r27c - add-to-path: true - local-cache: true - name: Install sccache run: | @@ -181,7 +186,7 @@ jobs: - name: Build Rust library (${{ matrix.rust_target }}) run: | - export NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }} + export NDK_HOME=/home/runner/.setup-ndk/r27c export PATH=$NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH # C toolchain env for build scripts (e.g. openssl-sys) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2db30330..a0d28e3d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -252,13 +252,18 @@ jobs: ${{ runner.os }}-cargo-release-${{ matrix.rust_target }}- ${{ runner.os }}-cargo- + - name: Cache Android NDK + uses: actions/cache@v4 + id: ndk-cache + with: + path: /home/runner/.setup-ndk/r27c + key: ${{ runner.os }}-ndk-r27c + - name: Setup Android NDK + if: steps.ndk-cache.outputs.cache-hit != 'true' uses: nttld/setup-ndk@v1 - id: setup-ndk with: ndk-version: r27c - add-to-path: true - local-cache: true - name: Install sccache run: | @@ -306,7 +311,7 @@ jobs: - name: Build Rust library (${{ matrix.rust_target }}) run: | - export NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }} + export NDK_HOME=/home/runner/.setup-ndk/r27c export PATH=$NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH # C toolchain env for build scripts (e.g. openssl-sys) From aa851dac2f61341d36b95321be95cc0b2132f34f Mon Sep 17 00:00:00 2001 From: Tony Giorgio Date: Tue, 20 Jan 2026 14:29:00 -0600 Subject: [PATCH 2/2] fix: add local-cache: true so NDK installs to ~/.setup-ndk/ Without local-cache: true, setup-ndk puts NDK in /opt/hostedtoolcache/ instead of ~/.setup-ndk/r27c where the build expects it. --- .github/workflows/android-build.yml | 1 + .github/workflows/release.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index 740b7b3c..fce2ba2e 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -139,6 +139,7 @@ jobs: uses: nttld/setup-ndk@v1 with: ndk-version: r27c + local-cache: true - name: Install sccache run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a0d28e3d..5c5459b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -264,6 +264,7 @@ jobs: uses: nttld/setup-ndk@v1 with: ndk-version: r27c + local-cache: true - name: Install sccache run: |