From 2c63179c88d141e155a54daa8f1e4b8c59d5ebba Mon Sep 17 00:00:00 2001 From: atsushieno Date: Wed, 2 Feb 2022 23:14:11 +0900 Subject: [PATCH] run instrumented tests after build. I still have no idea why it started working locally on my machine, but so far we should enable it on CI builds and see if it works. related issue: https://github.com/atsushieno/android-audio-plugin-framework/issues/85 --- .github/workflows/actions.yml | 9 +++++++++ java/androidaudioplugin/build.gradle.kts | 5 +++-- .../java/org/androidaudioplugin/NativeTest.kt | 14 ++++++++++++++ java/samples/aaphostsample/build.gradle.kts | 14 ++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 java/androidaudioplugin/src/androidTest/java/org/androidaudioplugin/NativeTest.kt diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 06ddf186..fe961925 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -27,6 +27,13 @@ jobs: with: path: /usr/local/lib/android/sdk/ndk/21.3.6528147 key: ndk_r21d_linux + - name: cache AVD + uses: actions/cache@v2 + env: + cache-name: cache-avd + with: + path: /home/runner/.android/gradle/avd + key: gradle-avd - name: apt install run: | echo y | sudo apt-get install doxygen libxml2-dev libgrpc++-dev libgrpc-dev libprotobuf-dev protobuf-compiler protobuf-compiler-grpc graphviz cmake ninja-build @@ -34,6 +41,8 @@ jobs: run: sudo mkdir -p /usr/local/lib/android/sdk/ndk && sudo chmod 777 /usr/local/lib/android/sdk/ndk - name: build run: make + - name: run instrumented tests + run: cd java && ./gradlew testDevice1DebugAndroidTest - name: upload artifact if: success() uses: actions/upload-artifact@v2 diff --git a/java/androidaudioplugin/build.gradle.kts b/java/androidaudioplugin/build.gradle.kts index 6f0f4684..e78fca98 100644 --- a/java/androidaudioplugin/build.gradle.kts +++ b/java/androidaudioplugin/build.gradle.kts @@ -73,8 +73,9 @@ android { } */ - // I leave these settings here for possible use in the future (because this existence is harmless, - // but note that it never worked for me: https://github.com/atsushieno/android-audio-plugin-framework/issues/85 + // FIXME: it is annoying to copy this everywhere, but build.gradle.kts is incapable of importing this fragment... + // It's been long time until I got this working, and I have no idea why it started working. + // If you don't get this working, you are not alone: https://github.com/atsushieno/android-audio-plugin-framework/issues/85 testOptions { devices { this.register("testDevice1") { diff --git a/java/androidaudioplugin/src/androidTest/java/org/androidaudioplugin/NativeTest.kt b/java/androidaudioplugin/src/androidTest/java/org/androidaudioplugin/NativeTest.kt new file mode 100644 index 00000000..c0f28802 --- /dev/null +++ b/java/androidaudioplugin/src/androidTest/java/org/androidaudioplugin/NativeTest.kt @@ -0,0 +1,14 @@ + +package org.androidaudioplugin + +import org.junit.Assert.assertTrue +import org.junit.Test + +class NativeTest { + @Test + fun test1() { + // FIXME: implement actual tests here. + assertTrue("test", true) + } +} + diff --git a/java/samples/aaphostsample/build.gradle.kts b/java/samples/aaphostsample/build.gradle.kts index 82f3136a..7f5b0d97 100644 --- a/java/samples/aaphostsample/build.gradle.kts +++ b/java/samples/aaphostsample/build.gradle.kts @@ -39,6 +39,20 @@ android { aaptOptions { noCompress ("sample.wav") } + + // FIXME: it is annoying to copy this everywhere, but build.gradle.kts is incapable of importing this fragment... + // It's been long time until I got this working, and I have no idea why it started working. + // If you don't get this working, you are not alone: https://github.com/atsushieno/android-audio-plugin-framework/issues/85 + testOptions { + devices { + this.register("testDevice1") { + device = "Pixel 5" + apiLevel = 30 + systemImageSource = "google" + abi = "x86" + } + } + } } dependencies {