Build #184
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Add Android target to Rust | |
run: rustup target add aarch64-linux-android armv7-linux-androideabi | |
- name: Update Rust | |
run: rustup update | |
- name: Set up Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
# This is needed only because C++ stuff only works with NDK >= r24. | |
# See: https://github.com/rust-windowing/android-ndk-rs/issues/255 | |
- uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r24 | |
add-to-path: false | |
- name: Install cargo-apk | |
run: cargo install cargo-apk | |
- name: Build native libs | |
env: | |
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }} | |
run: | | |
unset ANDROID_HOME # Otherwise this takes priority | |
cd native | |
cargo apk -- build --release | |
- name: Copy native libs | |
run: | | |
mkdir app/ruffle/src/main/jniLibs | |
mkdir app/ruffle/src/main/jniLibs/arm64-v8a | |
cp native/target/aarch64-linux-android/release/libruffle_android.so app/ruffle/src/main/jniLibs/arm64-v8a/ | |
mkdir app/ruffle/src/main/jniLibs/armeabi-v7a | |
cp native/target/armv7-linux-androideabi/release/libruffle_android.so app/ruffle/src/main/jniLibs/armeabi-v7a/ | |
- name: Build debug APK | |
run: | | |
cd app | |
./gradlew assembleDebug # The release version doesn't work without signing | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ruffle-debug-apk | |
path: app/ruffle/build/outputs/apk/debug/ruffle-debug.apk | |
- name: Decode keystore | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
env: | |
ENCODED_STRING: ${{ secrets.KEYSTORE }} | |
run: | | |
echo $ENCODED_STRING | base64 -di > app/ruffle/androidkey.jks | |
- name: Build release APK | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
run: | | |
cd app | |
./gradlew assembleRelease | |
env: | |
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} | |
- uses: actions/upload-artifact@v3 | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
with: | |
name: ruffle-release-apk | |
path: app/ruffle/build/outputs/apk/release/ruffle-release.apk | |