Skip to content

Commit

Permalink
ci: run android tests in emulator on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbiscuit committed Nov 15, 2023
1 parent f2cd561 commit 59ca31f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/test-android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ on:
- "bdk-ffi/**"
- "bdk-android/**"

# The default Android NDK on the ubuntu-22.04 image is 25.2.9519653
# The default Android NDK on the macos-12 image is 25.2.9519653

jobs:
build:
runs-on: ubuntu-20.04
runs-on: macos-12
steps:
- name: "Show default version of NDK"
run: echo $ANDROID_NDK_ROOT
Expand Down Expand Up @@ -48,10 +48,10 @@ jobs:
cd bdk-android
./gradlew buildAndroidLib --console=plain
# There are currently no unit tests for bdk-android (see the tests in bdk-jvm instead) and the
# integration tests require the macOS image which is not working with the older NDK version we
# are using, so for now we just make sure that the library builds and omit the connectedTest
# - name: "Run Android connected tests"
# run: |
# cd bdk-android
# ./gradlew connectedAndroidTest --console=plain
- name: "Run connected tests"
uses: ReactiveCircus/android-emulator-runner@v2
with:
api-level: 31
target: google_apis
arch: x86_64
script: cd ./bdk-android/ && ./gradlew connectedAndroidTest --console=plain -P excludeConnectedTests
12 changes: 12 additions & 0 deletions bdk-android/lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ dependencies {
androidTestImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.6.10")
}

// This block ensures that the tests that require access to a blockchain are not
// run if the -P excludeConnectedTests flag is passed to Gradle.
// This ensures our CI runs are not fickle by not requiring access to testnet.
// This is a workaround until we have a proper regtest setup for the CI.
// Note that the command in the CI is ./gradlew connectedAndroidTest -P excludeConnectedTests
tasks.withType(com.android.build.gradle.tasks.factory.AndroidUnitTest).configureEach {
if (project.hasProperty("excludeConnectedTests")) {
exclude("**/LiveWalletTest.class")
exclude("**/LiveTxBuilderTest.class")
}
}

afterEvaluate {
publishing {
publications {
Expand Down

0 comments on commit 59ca31f

Please sign in to comment.