diff --git a/.gitea/workflows/android-build.yml b/.gitea/workflows/android-build.yml deleted file mode 100644 index fa83ab0..0000000 --- a/.gitea/workflows/android-build.yml +++ /dev/null @@ -1,131 +0,0 @@ -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 diff --git a/.gitea/workflows/android-release.yml b/.gitea/workflows/android-release.yml deleted file mode 100644 index aa03aaf..0000000 --- a/.gitea/workflows/android-release.yml +++ /dev/null @@ -1,163 +0,0 @@ -name: Android Release - -on: - push: - tags: - - 'v*.*.*' - -env: - ANDROID_SDK: /opt/android-sdk - NDK_VERSION: "25.2.9519653" - BUILD_TOOLS_VERSION: "34.0.0" - PLATFORM: "android-34" - GITEA_API: https://git.aleshym.co/api/v1 - REPO: funman300/Rusty_Solitare - -jobs: - build-release-apk: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Extract version from tag - id: meta - run: echo "tag=${GITHUB_REF_NAME}" >> "$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 jq - - # ── Android SDK (shared cache key with debug 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-release-target-${{ hashFiles('**/Cargo.lock') }}-${{ github.sha }} - restore-keys: android-release-target-${{ hashFiles('**/Cargo.lock') }}- - - - name: Install cargo-ndk - if: steps.ndk-tool-cache.outputs.cache-hit != 'true' - run: cargo install cargo-ndk --locked - - # ── Build & sign with release keystore ───────────────────────────── - - name: Decode keystore - run: | - secret_len=$(echo -n "${{ secrets.KEYSTORE_BASE64 }}" | wc -c) - echo "KEYSTORE_BASE64 secret length: ${secret_len} chars" - set +e - echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > /tmp/solitaire-release.jks 2>/tmp/b64_err.txt - b64_exit=$? - set -e - size=$(wc -c < /tmp/solitaire-release.jks) - echo "base64 exit code: ${b64_exit}, keystore size: ${size} bytes" - [ -s /tmp/b64_err.txt ] && echo "base64 error: $(cat /tmp/b64_err.txt)" || true - [ "$size" -gt 0 ] || { echo "ERROR: KEYSTORE_BASE64 is empty or invalid base64"; exit 1; } - - - name: Disk space before build - run: df -h / && du -sh /opt/android-sdk target/ ~/.cargo 2>/dev/null || true - - - name: Build signed release 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: release - KEYSTORE: /tmp/solitaire-release.jks - KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }} - KEY_ALIAS: ${{ secrets.KEY_ALIAS }} - KEY_PASS: ${{ secrets.KEY_PASS }} - APK_OUT: ferrous-solitaire-${{ steps.meta.outputs.tag }}.apk - run: ./scripts/build_android_apk.sh - - # ── Publish to Gitea release ─────────────────────────────────────── - - name: Create Gitea release - id: release - run: | - TAG="${{ steps.meta.outputs.tag }}" - RESPONSE=$(curl -s -o /tmp/release.json -w "%{http_code}" \ - -X POST "$GITEA_API/repos/$REPO/releases" \ - -H "Authorization: token ${{ secrets.CI_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"draft\":false,\"prerelease\":false}") - if [ "$RESPONSE" = "409" ]; then - curl -sf "$GITEA_API/repos/$REPO/releases/tags/$TAG" \ - -H "Authorization: token ${{ secrets.CI_TOKEN }}" \ - > /tmp/release.json - elif [ "$RESPONSE" != "201" ]; then - echo "Release creation failed with HTTP $RESPONSE" - cat /tmp/release.json - exit 1 - fi - RELEASE_ID=$(jq -r '.id' /tmp/release.json) - echo "release_id=$RELEASE_ID" >> "$GITHUB_OUTPUT" - - - name: Upload signed APK - run: | - TAG="${{ steps.meta.outputs.tag }}" - APK="ferrous-solitaire-${TAG}.apk" - curl -sf -X POST \ - "$GITEA_API/repos/$REPO/releases/${{ steps.release.outputs.release_id }}/assets?name=$APK" \ - -H "Authorization: token ${{ secrets.CI_TOKEN }}" \ - -H "Content-Type: application/octet-stream" \ - --data-binary @"$APK"