ci(android): switch from cargo-apk 0.10.0 to cargo-apk2
cargo-apk 0.10.0 has been unable to discover an installed Android platform in this runner environment despite ANDROID_HOME, NDK, build-tools, and platforms;android-34 all being present and readable. cargo-apk2 is the maintained community fork on crates.io that reads the same `[package.metadata.android]` block, so the solitaire_app Cargo.toml needs no changes. Cache keys updated to apk2- so we don't restore the broken cargo-apk binary from prior runs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -84,12 +84,15 @@ jobs:
|
||||
key: cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: cargo-registry-
|
||||
|
||||
- name: Cache cargo-apk binary
|
||||
# cargo-apk2 is the maintained fork of cargo-apk; reads the same
|
||||
# `[package.metadata.android]` block. Cache key prefix `apk2-`
|
||||
# so we don't restore an old cargo-apk binary from the previous key.
|
||||
- name: Cache cargo-apk2 binary
|
||||
uses: actions/cache@v4
|
||||
id: apk-tool-cache
|
||||
with:
|
||||
path: ~/.cargo/bin/cargo-apk
|
||||
key: cargo-apk-${{ runner.os }}-stable
|
||||
path: ~/.cargo/bin/cargo-apk2
|
||||
key: apk2-${{ runner.os }}-stable
|
||||
|
||||
- name: Cache build artifacts
|
||||
uses: actions/cache@v4
|
||||
@@ -99,26 +102,15 @@ jobs:
|
||||
restore-keys: android-target-${{ hashFiles('**/Cargo.lock') }}-
|
||||
|
||||
# ── Build ──────────────────────────────────────────────────────────
|
||||
- name: Verify SDK structure
|
||||
run: |
|
||||
echo "=== /opt/android-sdk tree ==="
|
||||
find ${{ env.ANDROID_SDK }} -maxdepth 3 -type d 2>/dev/null || echo "SDK dir missing"
|
||||
echo "=== find android.jar ==="
|
||||
find /opt /root /usr/local/lib/android -name "android.jar" 2>/dev/null || echo "android.jar not found"
|
||||
|
||||
- name: Install cargo-apk
|
||||
- name: Install cargo-apk2
|
||||
if: steps.apk-tool-cache.outputs.cache-hit != 'true'
|
||||
run: cargo install cargo-apk --locked
|
||||
run: cargo install cargo-apk2 --locked
|
||||
|
||||
- name: Build debug APK
|
||||
run: |
|
||||
echo "user: $(whoami)"
|
||||
echo "ANDROID_HOME (env): $ANDROID_HOME"
|
||||
ls -la ${{ env.ANDROID_SDK }}/platforms/
|
||||
export ANDROID_HOME=${{ env.ANDROID_SDK }}
|
||||
export ANDROID_NDK_HOME=${{ env.ANDROID_SDK }}/ndk/${{ env.NDK_VERSION }}
|
||||
echo "ANDROID_HOME (exported): $ANDROID_HOME"
|
||||
cargo apk build --package solitaire_app --lib
|
||||
cargo apk2 build --package solitaire_app --lib
|
||||
|
||||
# ── Artifact ───────────────────────────────────────────────────────
|
||||
- name: Upload APK
|
||||
|
||||
@@ -82,12 +82,12 @@ jobs:
|
||||
key: cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: cargo-registry-
|
||||
|
||||
- name: Cache cargo-apk binary
|
||||
- name: Cache cargo-apk2 binary
|
||||
uses: actions/cache@v4
|
||||
id: apk-tool-cache
|
||||
with:
|
||||
path: ~/.cargo/bin/cargo-apk
|
||||
key: cargo-apk-${{ runner.os }}-stable
|
||||
path: ~/.cargo/bin/cargo-apk2
|
||||
key: apk2-${{ runner.os }}-stable
|
||||
|
||||
- name: Cache build artifacts
|
||||
uses: actions/cache@v4
|
||||
@@ -97,15 +97,15 @@ jobs:
|
||||
restore-keys: android-release-target-${{ hashFiles('**/Cargo.lock') }}-
|
||||
|
||||
# ── Build ──────────────────────────────────────────────────────────
|
||||
- name: Install cargo-apk
|
||||
- name: Install cargo-apk2
|
||||
if: steps.apk-tool-cache.outputs.cache-hit != 'true'
|
||||
run: cargo install cargo-apk --locked
|
||||
run: cargo install cargo-apk2 --locked
|
||||
|
||||
- name: Build release APK
|
||||
run: |
|
||||
export ANDROID_HOME=${{ env.ANDROID_SDK }}
|
||||
export ANDROID_NDK_HOME=${{ env.ANDROID_SDK }}/ndk/${{ env.NDK_VERSION }}
|
||||
cargo apk build --release --package solitaire_app --lib
|
||||
cargo apk2 build --release --package solitaire_app --lib
|
||||
|
||||
# ── Sign ───────────────────────────────────────────────────────────
|
||||
- name: Decode keystore
|
||||
|
||||
Reference in New Issue
Block a user