Skip to content

Commit fffc783

Browse files
committed
Skip testWasm in CI if toolchain cannot compile for wasm
Not all CI jobs are capable of building for wasm, so we should be able to skip this job in Swift CI.
1 parent f5245bf commit fffc783

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Sources/SKTestSupport/SkipUnless.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ package actor SkipUnless {
8484
}
8585

8686
private func skipUnlessSupported(
87+
allowSkippingInCI: Bool = false,
8788
featureName: String = #function,
8889
file: StaticString,
8990
line: UInt,
@@ -92,8 +93,8 @@ package actor SkipUnless {
9293
let checkResult: FeatureCheckResult
9394
if let cachedResult = checkCache[featureName] {
9495
checkResult = cachedResult
95-
} else if ProcessEnv.block["SWIFTCI_USE_LOCAL_DEPS"] != nil {
96-
// Never skip tests in CI. Toolchain should be up-to-date
96+
} else if ProcessEnv.block["SWIFTCI_USE_LOCAL_DEPS"] != nil && !allowSkippingInCI {
97+
// In general, don't skip tests in CI. Toolchain should be up-to-date
9798
checkResult = .featureSupported
9899
} else {
99100
checkResult = try await featureCheck()
@@ -466,7 +467,7 @@ package actor SkipUnless {
466467
file: StaticString = #filePath,
467468
line: UInt = #line
468469
) async throws {
469-
return try await shared.skipUnlessSupportedByToolchain(swiftVersion: SwiftVersion(6, 0), file: file, line: line) {
470+
return try await shared.skipUnlessSupported(allowSkippingInCI: true, file: file, line: line) {
470471
let swiftFrontend = try await unwrap(ToolchainRegistry.forTesting.default?.swift).parentDirectory
471472
.appending(component: "swift-frontend")
472473
return try await withTestScratchDir { scratchDirectory in
@@ -489,7 +490,10 @@ package actor SkipUnless {
489490
)
490491
try process.launch()
491492
let result = try await process.waitUntilExit()
492-
return result.exitStatus == .terminated(code: 0)
493+
if result.exitStatus == .terminated(code: 0) {
494+
return .featureSupported
495+
}
496+
return .featureUnsupported(skipMessage: "Skipping because toolchain can not compile for wasm")
493497
}
494498
}
495499
}

0 commit comments

Comments
 (0)