Add super trivial smoke test #359
Workflow file for this run
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-native-libs: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- android-abi: arm64-v8a | |
rust-target: aarch64-linux-android | |
- android-abi: armeabi-v7a | |
rust-target: armv7-linux-androideabi | |
- android-abi: x86_64 | |
rust-target: x86_64-linux-android | |
- android-abi: x86 | |
rust-target: i686-linux-android | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
targets: ${{ matrix.rust-target }} | |
- name: Cache Cargo output | |
uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: ${{ matrix.rust-target }} | |
save-if: ${{ github.ref == 'refs/heads/main' }} | |
- name: Install cargo-ndk | |
run: cargo install cargo-ndk | |
- name: Build native libs | |
run: | | |
unset ANDROID_SDK_ROOT # Deprecated, will cause an error if left set. | |
cargo ndk --target ${{ matrix.android-abi }} --platform 26 -o jniLibs build --release | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: native-lib-${{ matrix.android-abi }} | |
path: jniLibs | |
build-apks: | |
needs: build-native-libs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: # no name set, so all artifacts are downloaded | |
path: native-libs | |
- name: Copy native libs | |
run: | | |
mkdir app/src/main/jniLibs | |
cp -r native-libs/*/* app/src/main/jniLibs/ | |
- name: Set up Java 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
# https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/ | |
- name: Enable KVM | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Test | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 29 | |
script: ./gradlew connectedCheck | |
- name: Upload Test Report | |
uses: actions/upload-artifact@v3 | |
if: ${{ !cancelled() }} # always run even if the previous step fails | |
with: | |
name: junit-test-results | |
path: '**/build/test-results/test/TEST-*.xml' | |
retention-days: 1 | |
- name: Decode keystore | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
env: | |
ENCODED_STRING: ${{ secrets.KEYSTORE }} | |
run: | | |
echo $ENCODED_STRING | base64 -di > app/androidkey.jks | |
- name: Build release APK | |
env: | |
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} | |
run: ./gradlew assembleRelease | |
- uses: actions/upload-artifact@v4 | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
with: | |
name: ruffle-release-apks | |
path: app/build/outputs/apk/release/*.apk | |