From a01fd93502a9fd09b7c47c1f22e29b6b525e32b4 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Wed, 30 Dec 2020 12:28:07 -0600 Subject: [PATCH] Build Android example as part of CI. --- .github/workflows/test.yml | 21 +++++++++++++++++++++ Makefile.toml | 8 +++++++- examples/android/src/lib.rs | 3 +++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3d5cd7d..0fbeda6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -60,3 +60,24 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} args: --all-features --target wasm32-unknown-unknown + + check_android: + name: Check Android + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: Swatinem/rust-cache@v1 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + components: rustfmt, clippy + override: true + - uses: actions-rs/install@v0.1 + with: + crate: cargo-make + use-tool-cache: true + - uses: actions-rs/cargo@v1 + with: + command: make + args: build-android-example diff --git a/Makefile.toml b/Makefile.toml index db3c4d3..6697f15 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -1,4 +1,10 @@ -[tasks.run-android] +[tasks.build-android-example] +script = [ + "cd examples/android", + "./gradlew assembleDebug", +] + +[tasks.run-android-example] script = [ "cd examples/android", "./gradlew runDebug", diff --git a/examples/android/src/lib.rs b/examples/android/src/lib.rs index 7db2211..6bf79d6 100644 --- a/examples/android/src/lib.rs +++ b/examples/android/src/lib.rs @@ -1,5 +1,8 @@ use tts::*; +// The `loop {}` below only simulates an app loop. +// Without it, the `TTS` instance gets dropped before callbacks can run. +#[allow(unreachable_code)] fn run() -> Result<(), Error> { let mut tts = TTS::default()?; let Features {