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') }}
|
key: cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||||
restore-keys: cargo-registry-
|
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
|
uses: actions/cache@v4
|
||||||
id: apk-tool-cache
|
id: apk-tool-cache
|
||||||
with:
|
with:
|
||||||
path: ~/.cargo/bin/cargo-apk
|
path: ~/.cargo/bin/cargo-apk2
|
||||||
key: cargo-apk-${{ runner.os }}-stable
|
key: apk2-${{ runner.os }}-stable
|
||||||
|
|
||||||
- name: Cache build artifacts
|
- name: Cache build artifacts
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
@@ -99,26 +102,15 @@ jobs:
|
|||||||
restore-keys: android-target-${{ hashFiles('**/Cargo.lock') }}-
|
restore-keys: android-target-${{ hashFiles('**/Cargo.lock') }}-
|
||||||
|
|
||||||
# ── Build ──────────────────────────────────────────────────────────
|
# ── Build ──────────────────────────────────────────────────────────
|
||||||
- name: Verify SDK structure
|
- name: Install cargo-apk2
|
||||||
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
|
|
||||||
if: steps.apk-tool-cache.outputs.cache-hit != 'true'
|
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
|
- name: Build debug APK
|
||||||
run: |
|
run: |
|
||||||
echo "user: $(whoami)"
|
|
||||||
echo "ANDROID_HOME (env): $ANDROID_HOME"
|
|
||||||
ls -la ${{ env.ANDROID_SDK }}/platforms/
|
|
||||||
export ANDROID_HOME=${{ env.ANDROID_SDK }}
|
export ANDROID_HOME=${{ env.ANDROID_SDK }}
|
||||||
export ANDROID_NDK_HOME=${{ env.ANDROID_SDK }}/ndk/${{ env.NDK_VERSION }}
|
export ANDROID_NDK_HOME=${{ env.ANDROID_SDK }}/ndk/${{ env.NDK_VERSION }}
|
||||||
echo "ANDROID_HOME (exported): $ANDROID_HOME"
|
cargo apk2 build --package solitaire_app --lib
|
||||||
cargo apk build --package solitaire_app --lib
|
|
||||||
|
|
||||||
# ── Artifact ───────────────────────────────────────────────────────
|
# ── Artifact ───────────────────────────────────────────────────────
|
||||||
- name: Upload APK
|
- name: Upload APK
|
||||||
|
|||||||
@@ -82,12 +82,12 @@ jobs:
|
|||||||
key: cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
key: cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||||
restore-keys: cargo-registry-
|
restore-keys: cargo-registry-
|
||||||
|
|
||||||
- name: Cache cargo-apk binary
|
- name: Cache cargo-apk2 binary
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
id: apk-tool-cache
|
id: apk-tool-cache
|
||||||
with:
|
with:
|
||||||
path: ~/.cargo/bin/cargo-apk
|
path: ~/.cargo/bin/cargo-apk2
|
||||||
key: cargo-apk-${{ runner.os }}-stable
|
key: apk2-${{ runner.os }}-stable
|
||||||
|
|
||||||
- name: Cache build artifacts
|
- name: Cache build artifacts
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
@@ -97,15 +97,15 @@ jobs:
|
|||||||
restore-keys: android-release-target-${{ hashFiles('**/Cargo.lock') }}-
|
restore-keys: android-release-target-${{ hashFiles('**/Cargo.lock') }}-
|
||||||
|
|
||||||
# ── Build ──────────────────────────────────────────────────────────
|
# ── Build ──────────────────────────────────────────────────────────
|
||||||
- name: Install cargo-apk
|
- name: Install cargo-apk2
|
||||||
if: steps.apk-tool-cache.outputs.cache-hit != 'true'
|
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
|
- name: Build release APK
|
||||||
run: |
|
run: |
|
||||||
export ANDROID_HOME=${{ env.ANDROID_SDK }}
|
export ANDROID_HOME=${{ env.ANDROID_SDK }}
|
||||||
export ANDROID_NDK_HOME=${{ env.ANDROID_SDK }}/ndk/${{ env.NDK_VERSION }}
|
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 ───────────────────────────────────────────────────────────
|
# ── Sign ───────────────────────────────────────────────────────────
|
||||||
- name: Decode keystore
|
- name: Decode keystore
|
||||||
|
|||||||
Reference in New Issue
Block a user