Files
SpaghettiKart/.github/workflows/android-compile.yml
2025-08-06 14:06:23 -04:00

76 lines
2.4 KiB
YAML

name: Android Build
on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
generate-port-o2r:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install dependencies
run: sudo apt-get install gcc g++ git cmake ninja-build lsb-release
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.13
with:
key: ${{ runner.os }}-o2r-ccache-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-o2r-ccache-${{ github.ref }}
${{ runner.os }}-o2r-ccache-
- name: Cache build folders
uses: actions/cache@v4
with:
key: ${{ runner.os }}-o2r-build-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-o2r-build-${{ github.ref }}
${{ runner.os }}-o2r-build-
path: |
torch/cmake-build-release
- name: Generate spaghetti.o2r
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -C torch type=release -j3
torch/cmake-build-release/torch pack assets spaghetti.o2r o2r
- uses: actions/upload-artifact@v4
with:
name: spaghetti.o2r
path: spaghetti.o2r
retention-days: 1
build-android:
needs: generate-port-o2r
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Patch Torch CMakeLists.txt to build as a library (not EXE)
run: |
sed -i 's/option(USE_STANDALONE "Build as a standalone executable" ON)/option(USE_STANDALONE "Build as a standalone executable" OFF)/' torch/CMakeLists.txt
- name: Install dependencies
run: sudo apt-get install -y ninja-build
- name: Download spaghetti.o2r
uses: actions/download-artifact@v4
with:
name: spaghetti.o2r
path: android/app/src/main/assets
- name: Configure Gradle permissions
run: chmod +x android/gradlew
- name: Build Spaghetti Kart
run: |
cd android/
./gradlew assembleDebug -P elfBuildType=RelWithDebInfo
mv app/build/outputs/apk/debug/app-debug.apk ../spaghettikart.apk
- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: spaghetti-kart-apk
path: spaghettikart.apk