From 3a3d8deb7791d3c135f02760c6ea4b61f2799cf9 Mon Sep 17 00:00:00 2001 From: sstone Date: Tue, 26 Mar 2024 15:13:07 +0100 Subject: [PATCH 1/3] Fix mempool.space ios tests These tests include https calls which won't work if the ios simulator is started in standalone mode, which is the default mode. --- build.gradle.kts | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 619f1b781..0923a0923 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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" @@ -265,6 +266,33 @@ 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") + } + + tasks.withType().configureEach { + dependsOn(startIosSimulator) + device = deviceName + standalone.set(false) + finalizedBy(stopIosSimulator) + } + tasks.withType { environment("TEST_RESOURCES_PATH", projectDir.resolve("src/commonTest/resources")) } @@ -303,7 +331,7 @@ tasks.withType { // Those tests use TLS sockets which are not supported on Linux and MacOS tasks .filterIsInstance() - .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") From 81a265dfafd768869f5de95d62dac9fbfbb0a3b7 Mon Sep 17 00:00:00 2001 From: sstone Date: Tue, 26 Mar 2024 18:28:59 +0100 Subject: [PATCH 2/3] Set version to 1.6.2-FEECREDIT-5 --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 0923a0923..783b9e1a2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,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. From 5cf2eaf4b87d10dc5cdc479fe918019ddf2dc322 Mon Sep 17 00:00:00 2001 From: sstone Date: Tue, 26 Mar 2024 19:14:12 +0100 Subject: [PATCH 3/3] Use ios simulator in standalone mode on github CI It is needed to run mempool.space tests but the fix may breaks things on developer's machine, here it's limited to github CI. --- .github/workflows/release.yml | 2 +- .github/workflows/snapshot.yml | 2 +- .github/workflows/test.yml | 2 +- build.gradle.kts | 12 +++++++----- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2ba25098f..575615886 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 1187abd71..4b50447bc 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index df3c6ba08..d9462a75c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/build.gradle.kts b/build.gradle.kts index 783b9e1a2..6f4b9e8bc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -286,11 +286,13 @@ afterEvaluate { commandLine("xcrun", "simctl", "shutdown", "all") } - tasks.withType().configureEach { - dependsOn(startIosSimulator) - device = deviceName - standalone.set(false) - finalizedBy(stopIosSimulator) + if (project.findProperty("iosSimulatorMode") == "standalone") { + tasks.withType().configureEach { + dependsOn(startIosSimulator) + device = deviceName + standalone.set(false) + finalizedBy(stopIosSimulator) + } } tasks.withType {