Skip to content

Update touchHLE_release.yml #4

Update touchHLE_release.yml

Update touchHLE_release.yml #4

name: Build touchHLE
on:
push:
branches: [ "trunk" ]
pull_request:
branches: [ "trunk" ]
env:
CARGO_TERM_COLOR: always
jobs:
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # touchHLE's git-describe versioning needs tag history
- name: Test 1
run: echo $ANDROID_SDK_ROOT
- name: Test 2
run: ls -la /usr/local/lib/android/sdk/ndk/
- name: Check formatting
run: dev-scripts/format.sh --check
- name: Get Submodules
run: git submodule update --init
- name: Try to get cached copy of Boost
id: cache-boost
uses: actions/cache@v3
with:
path: vendor/boost
key: boost_1_81_0
- if: ${{ steps.cache-boost.outputs.cache-hit != 'true' }}
name: Download Boost
run: curl -L -o boost_1_81_0.7z "https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.7z"
- if: ${{ steps.cache-boost.outputs.cache-hit != 'true' }}
name: Extract Boost
run: 7z -ovendor x boost_1_81_0.7z && mv vendor/boost_1_81_0 vendor/boost
- name: Install AArch64 Android Rust toolchain
run: rustup target add aarch64-linux-android
- name: Install cargo-ndk
run: cargo install cargo-ndk
# Gradle version compatibility is a nightmare and we refuse to use gradlew.
- name: Try to get a cached copy of Gradle
id: cache-gradle
uses: actions/cache@v3
with:
path: gradle
key: gradle-7.3
- if: ${{ steps.cache-gradle.outputs.cache-hit != 'true' }}
name: Download Gradle
run: curl -L -o gradle-7.3-bin.zip "https://services.gradle.org/distributions/gradle-7.3-bin.zip"
- if: ${{ steps.cache-gradle.outputs.cache-hit != 'true' }}
name: Extract Gradle
run: 7z -ogradle x gradle-7.3-bin.zip
# We need to instal correct version of Android NDK manually
- name: Try to get a cached copy of Android NDK
id: cache-android-ndk
uses: actions/cache@v3
with:
path: android-ndk
key: android-ndk-r25c
- if: ${{ steps.cache-android-ndk.outputs.cache-hit != 'true' }}
name: Download Android NDK
run: curl -L -o android-ndk-r25c-linux.zip "https://dl.google.com/android/repository/android-ndk-r25c-linux.zip"
- if: ${{ steps.cache-android-ndk.outputs.cache-hit != 'true' }}
name: Extract Android NDK
run: 7z -oandroid-ndk x android-ndk-r25c-linux.zip && mv android-ndk/android-ndk-r25c /usr/local/lib/android/sdk/ndk/25.2.9519653
- name: Test 3
run: ls -la /usr/local/lib/android/sdk/ndk/25.2.9519653
# Why isn't there a command for this?
- name: Generate local.properties file
run: echo 'sdk.dir='$ANDROID_SDK_ROOT > android/local.properties
# Let's not even bother with linting (would need to build for host, not just
# Android, which makes things more complicated) or trying to run tests
# (would have to run on Android 😰).
- name: Build for Android
run: cd android && ../gradle/gradle-7.3/bin/gradle assembleRelease && mv app/build/outputs/apk/release/app-release.apk ../touchHLE.apk
env:
# The version should match the ndkVersion defined in `android\app\build.gradle`
ANDROID_NDK_ROOT: '/usr/local/lib/android/sdk/ndk/25.2.9519653'
- uses: actions/upload-artifact@v3
with:
name: touchHLE_Android_AArch64
path: touchHLE.apk