Marcelo Hernandez
04/10/2023, 9:01 PM./gradlew iosSimulatorArm64Test
in GitHub Actions without any tests getting skipped? I have tests in commonTest
and even if I intentionally make a test fail, it will appear to "pass" in CI but it's as if the tests are skipped. The reverse is true for ./gradlew iosX64Test
where it runs successfully in GitHub Actions (the test fails as expected) but gets skipped on my local dev machine (M1 Mac).jw
04/10/2023, 9:06 PMhfhbd
04/10/2023, 9:06 PMjw
04/10/2023, 9:07 PMjw
04/10/2023, 9:07 PMjw
04/10/2023, 9:07 PMMarcelo Hernandez
04/10/2023, 9:10 PMhfhbd
04/10/2023, 9:11 PMMarcelo Hernandez
04/10/2023, 9:15 PMMarcelo Hernandez
04/10/2023, 9:15 PMjw
04/10/2023, 9:35 PMMarcelo Hernandez
04/10/2023, 9:48 PMI was hoping to have some form of consistency where if a test fails in CI, developers can easily reproduce on their local machines and troubleshoot accordingly.One solution my teammate suggested was to have a custom
iosTest
task that acts as an alias for either iosX64Test
if running in CI or iosSimulatorArm64Test
if not.jw
04/10/2023, 9:49 PMMarcelo Hernandez
04/10/2023, 9:53 PMMarcelo Hernandez
04/11/2023, 5:07 PMiosTest
task, I get the error indicating that that task does not exist
* What went wrong:
Task 'iosTest' not found in root project '*****' and its subprojects. Some candidates are: 'iosX64Test', 'jvmTest', 'test'.
When I run the tasks
task on one of my KMM modules, the only tasks that show up under Verification tasks
are
Verification tasks
------------------
allTests - Runs the tests for all targets and create aggregated report
check - Runs all checks.
iosSimulatorArm64Test - Executes Kotlin/Native unit tests for target iosSimulatorArm64.
iosX64Test - Executes Kotlin/Native unit tests for target iosX64.
jvmTest - Runs the tests of the test test run.
hfhbd
04/11/2023, 5:08 PMMarcelo Hernandez
04/11/2023, 5:08 PMiosSimulatorArm64()
below ios()
. Which is what I'm also doing.hfhbd
04/11/2023, 5:09 PMjw
04/11/2023, 5:09 PMjw
04/11/2023, 5:10 PMjw
04/11/2023, 5:10 PMMarcelo Hernandez
04/11/2023, 5:10 PMhfhbd
04/11/2023, 5:10 PMjw
04/11/2023, 5:11 PMMarcelo Hernandez
04/11/2023, 5:11 PMkotlin {
applyKotlinMultiplatformConfiguration() // This just setting explicit API mode
ios()
// Add the ARM64 simulator target
iosSimulatorArm64()
val iosMain by sourceSets.getting
val iosTest by sourceSets.getting
val iosSimulatorArm64Main by sourceSets.getting
val iosSimulatorArm64Test by sourceSets.getting
// Set up dependencies between the source sets
iosSimulatorArm64Main.dependsOn(iosMain)
iosSimulatorArm64Test.dependsOn(iosTest)
}
hfhbd
04/11/2023, 5:13 PMMarcelo Hernandez
04/11/2023, 5:14 PMiosTest
Gradle task should exist yes?Marcelo Hernandez
04/11/2023, 5:15 PMiosSimulatorArm64Test
and iosX64Test
as the specific test tasks that pertain to iOS.Marcelo Hernandez
04/11/2023, 5:16 PMiosTest
task like so
tasks.register("iosTest") {
group = "Verification"
description = "An alias for iosX64Test if running in CI; otherwise iosSimulatorArm64Test."
dependsOn(
// GitHub Actions uses Intel CPU in their Mac images. Trying to run iosSimulatorArm64Test
// (arm64 tests) in CI results in the tests silently getting skippped rather than the build
// failing. The reverse is true for our dev machines (assuming M1 chip) where tests from
// iosX64Test get silently skipped.
if (System.getenv("CI") != null) {
"iosX64Test"
} else {
"iosSimulatorArm64Test"
})
}
This appears to be working for me and there is no task name clash.hfhbd
04/11/2023, 5:20 PMMarcelo Hernandez
04/11/2023, 5:23 PM