Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mempool.space ios tests #622

Merged
merged 3 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
with:
java-version: 11
- name: Check
run: ./gradlew check
run: ./gradlew -PiosSimulatorMode=standalone check
- name: Publish Linux
if: matrix.os == 'ubuntu-latest'
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
with:
java-version: 11
- name: Check
run: ./gradlew check
run: ./gradlew -PiosSimulatorMode=standalone check
- name: Publish Linux to Maven Local
if: matrix.os == 'ubuntu-latest'
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
run: ./gradlew build -PintegrationTests=include
- name: Check without integration
if: matrix.os == 'macOS-latest'
run: ./gradlew build -x jvmTest
run: ./gradlew build -PiosSimulatorMode=standalone -x jvmTest

# Uncomment the lines below to store test results for debugging failed tests (useful for iOS)
# - name: Store test results
Expand Down
34 changes: 32 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest
import java.io.ByteArrayOutputStream

plugins {
kotlin("multiplatform") version "1.9.23"
Expand All @@ -10,7 +11,7 @@ plugins {

allprojects {
group = "fr.acinq.lightning"
version = "1.6.2-FEECREDIT-4"
version = "1.6.2-FEECREDIT-5"

repositories {
// using the local maven repository with Kotlin Multi Platform can lead to build errors that are hard to diagnose.
Expand Down Expand Up @@ -265,6 +266,35 @@ afterEvaluate {
}))
}
}

val deviceName = project.findProperty("iosDevice") as? String ?: "iPhone 14"

val startIosSimulator by tasks.creating(Exec::class) {
isIgnoreExitValue = true
errorOutput = ByteArrayOutputStream()
commandLine("xcrun", "simctl", "boot", deviceName)
doLast {
val result = executionResult.get()
if (result.exitValue != 148 && result.exitValue != 149) {
println(errorOutput.toString())
result.assertNormalExitValue()
}
}
}

val stopIosSimulator by tasks.creating(Exec::class) {
commandLine("xcrun", "simctl", "shutdown", "all")
}

if (project.findProperty("iosSimulatorMode") == "standalone") {
tasks.withType<org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeSimulatorTest>().configureEach {
dependsOn(startIosSimulator)
device = deviceName
standalone.set(false)
finalizedBy(stopIosSimulator)
}
}

tasks.withType<org.jetbrains.kotlin.gradle.targets.jvm.tasks.KotlinJvmTest> {
environment("TEST_RESOURCES_PATH", projectDir.resolve("src/commonTest/resources"))
}
Expand Down Expand Up @@ -303,7 +333,7 @@ tasks.withType<AbstractTestTask> {
// Those tests use TLS sockets which are not supported on Linux and MacOS
tasks
.filterIsInstance<KotlinNativeTest>()
.filter { it.name == "macosX64Test" || it.name == "linuxX64Test" }
.filter { it.name == "macosX64Test" || it.name == "macosArm64Test" || it.name == "linuxX64Test" }
.map {
it.filter.excludeTestsMatching("*IntegrationTest")
it.filter.excludeTestsMatching("*ElectrumClientTest")
Expand Down
Loading