f6907671be
The disk-budget fix worked — debug APK now builds, signs, and verifies in ~6 minutes on a single ABI. But the upload step failed with: GHESNotSupportedError: @actions/artifact v2.0.0+, upload-artifact@v4+ and download-artifact@v4+ are not currently supported on GHES. upload-artifact@v4 rewrote the upload path to use a new artifact service hosted on github.com; Gitea's GHES-compatibility layer doesn't implement that endpoint. v3 still uses the older chunked HTTP upload API that Gitea supports. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
132 lines
5.3 KiB
YAML
132 lines
5.3 KiB
YAML
name: Android Build
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
# Rebuild whenever app/engine/asset code changes.
|
|
# Skip server-only, deploy, and doc changes.
|
|
paths-ignore:
|
|
- 'deploy/**'
|
|
- 'argocd/**'
|
|
- 'solitaire_server/**'
|
|
- '**.md'
|
|
|
|
env:
|
|
ANDROID_SDK: /opt/android-sdk
|
|
NDK_VERSION: "25.2.9519653"
|
|
BUILD_TOOLS_VERSION: "34.0.0"
|
|
PLATFORM: "android-34"
|
|
|
|
jobs:
|
|
build-apk:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set short SHA
|
|
id: meta
|
|
run: echo "sha=${GITHUB_SHA::8}" >> "$GITHUB_OUTPUT"
|
|
|
|
# ── System dependencies ────────────────────────────────────────────
|
|
- name: Install system dependencies
|
|
run: |
|
|
sudo apt-get update -y
|
|
sudo apt-get install -y openjdk-17-jdk-headless unzip zip
|
|
|
|
# ── Android SDK (shared cache key with release workflow) ──────────
|
|
- name: Cache Android SDK
|
|
uses: actions/cache@v4
|
|
id: sdk-cache
|
|
with:
|
|
path: ${{ env.ANDROID_SDK }}
|
|
key: v2-android-sdk-ndk${{ env.NDK_VERSION }}-bt${{ env.BUILD_TOOLS_VERSION }}
|
|
|
|
- name: Install Android SDK + NDK
|
|
if: steps.sdk-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
sudo mkdir -p ${{ env.ANDROID_SDK }}/cmdline-tools
|
|
curl -sL \
|
|
"https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip" \
|
|
-o /tmp/cmdtools.zip
|
|
unzip -q /tmp/cmdtools.zip -d /tmp/cmdtools
|
|
sudo mv /tmp/cmdtools/cmdline-tools ${{ env.ANDROID_SDK }}/cmdline-tools/latest
|
|
yes | sudo ${{ env.ANDROID_SDK }}/cmdline-tools/latest/bin/sdkmanager \
|
|
--sdk_root=${{ env.ANDROID_SDK }} --licenses > /dev/null 2>&1 || true
|
|
sudo ${{ env.ANDROID_SDK }}/cmdline-tools/latest/bin/sdkmanager \
|
|
--sdk_root=${{ env.ANDROID_SDK }} \
|
|
"build-tools;${{ env.BUILD_TOOLS_VERSION }}" \
|
|
"platforms;${{ env.PLATFORM }}" \
|
|
"ndk;${{ env.NDK_VERSION }}"
|
|
|
|
# ── Rust toolchain ─────────────────────────────────────────────────
|
|
- name: Install Rust stable
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
|
|
| sh -s -- -y --default-toolchain stable --no-modify-path
|
|
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
|
|
|
- name: Add Android cross-compilation targets
|
|
run: |
|
|
rustup target add \
|
|
aarch64-linux-android \
|
|
armv7-linux-androideabi \
|
|
x86_64-linux-android
|
|
|
|
# ── Cargo caches ───────────────────────────────────────────────────
|
|
- name: Cache Cargo registry
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry/index
|
|
~/.cargo/registry/cache
|
|
~/.cargo/git/db
|
|
key: cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: cargo-registry-
|
|
|
|
- name: Cache cargo-ndk binary
|
|
uses: actions/cache@v4
|
|
id: ndk-tool-cache
|
|
with:
|
|
path: ~/.cargo/bin/cargo-ndk
|
|
key: cargo-ndk-${{ runner.os }}-stable
|
|
|
|
- name: Cache build artifacts
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: target
|
|
key: android-target-${{ hashFiles('**/Cargo.lock') }}-${{ github.sha }}
|
|
restore-keys: android-target-${{ hashFiles('**/Cargo.lock') }}-
|
|
|
|
- name: Install cargo-ndk
|
|
if: steps.ndk-tool-cache.outputs.cache-hit != 'true'
|
|
run: cargo install cargo-ndk --locked
|
|
|
|
# ── Build APK ──────────────────────────────────────────────────────
|
|
# Debug CI only builds arm64-v8a — full three-ABI debug builds blow
|
|
# past the runner's disk budget (~25 GB of target/ + intermediate
|
|
# APKs caused apksigner to OOM-on-disk in the previous run). Release
|
|
# CI still ships all three ABIs from android-release.yml.
|
|
- name: Build debug APK
|
|
env:
|
|
ANDROID_HOME: ${{ env.ANDROID_SDK }}
|
|
ANDROID_NDK_HOME: ${{ env.ANDROID_SDK }}/ndk/${{ env.NDK_VERSION }}
|
|
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOLS_VERSION }}
|
|
PLATFORM: ${{ env.PLATFORM }}
|
|
PROFILE: debug
|
|
ABIS: arm64-v8a
|
|
run: ./scripts/build_android_apk.sh
|
|
|
|
# ── Artifact ───────────────────────────────────────────────────────
|
|
# Pinned to v3 because Gitea Actions doesn't implement the github.com
|
|
# artifact service that upload-artifact@v4+ requires; v3 uses the
|
|
# older chunked HTTP API that Gitea's GHES-compatibility layer
|
|
# supports.
|
|
- name: Upload APK
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: solitaire-quest-debug-${{ steps.meta.outputs.sha }}
|
|
path: target/debug/apk/solitaire-quest.apk
|
|
retention-days: 30
|