mirror of
https://github.com/apple/swift-async-algorithms
synced 2026-11-22 04:10:40 +00:00
Clear up CI issues and testing failures (#365)
* Conditionalize the testing targets for non-windows targets to avoid the TaskDriver requirements * Some driveby formatting fixes and remove the freebsd target since that is not supported in swiftpm yet * Rework validation import conditions to dependency conditionals * Exclude 5.9 workflows and enable macOS testing scheme for CI * Additional ifdefing out non windows targets for sequence diagram testing and more formatting fixes
This commit is contained in:
1 parent
18e2398481
commit
ca38935fc0
12 files changed
+110
-12
No files matched your search
@@ -9,6 +9,8 @@ jobs:
|
||||
name: Test
|
||||
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
|
||||
with:
|
||||
linux_exclude_swift_versions: "[{\"swift_version\": \"5.9\"}]"
|
||||
windows_exclude_swift_versions: "[{\"swift_version\": \"5.9\"}]"
|
||||
enable_wasm_sdk_build: true
|
||||
wasm_sdk_build_command: swift build -Xcc -D_WASI_EMULATED_PTHREAD
|
||||
|
||||
|
||||
+40
-6
@@ -3,11 +3,13 @@
|
||||
import PackageDescription
|
||||
import CompilerPluginSupport
|
||||
|
||||
// Availability Macros
|
||||
|
||||
let availabilityMacros: [SwiftSetting] = [
|
||||
.enableExperimentalFeature("AvailabilityMacro=AsyncAlgorithms 1.0:macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0"),
|
||||
.enableExperimentalFeature("AvailabilityMacro=AsyncAlgorithms 1.1:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0"),
|
||||
.enableExperimentalFeature(
|
||||
"AvailabilityMacro=AsyncAlgorithms 1.0:macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0"
|
||||
),
|
||||
.enableExperimentalFeature(
|
||||
"AvailabilityMacro=AsyncAlgorithms 1.1:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0"
|
||||
),
|
||||
]
|
||||
|
||||
let package = Package(
|
||||
@@ -43,7 +45,39 @@ let package = Package(
|
||||
),
|
||||
.testTarget(
|
||||
name: "AsyncAlgorithmsTests",
|
||||
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation", "AsyncAlgorithms_XCTest"],
|
||||
dependencies: [
|
||||
.target(name: "AsyncAlgorithms"),
|
||||
.target(
|
||||
name: "AsyncSequenceValidation",
|
||||
condition: .when(platforms: [
|
||||
.macOS,
|
||||
.iOS,
|
||||
.tvOS,
|
||||
.watchOS,
|
||||
.visionOS,
|
||||
.macCatalyst,
|
||||
.android,
|
||||
.linux,
|
||||
.openbsd,
|
||||
.wasi,
|
||||
])
|
||||
),
|
||||
.target(
|
||||
name: "AsyncAlgorithms_XCTest",
|
||||
condition: .when(platforms: [
|
||||
.macOS,
|
||||
.iOS,
|
||||
.tvOS,
|
||||
.watchOS,
|
||||
.visionOS,
|
||||
.macCatalyst,
|
||||
.android,
|
||||
.linux,
|
||||
.openbsd,
|
||||
.wasi,
|
||||
])
|
||||
),
|
||||
],
|
||||
swiftSettings: availabilityMacros + [
|
||||
.enableExperimentalFeature("StrictConcurrency=complete")
|
||||
]
|
||||
@@ -53,7 +87,7 @@ let package = Package(
|
||||
|
||||
if Context.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
|
||||
package.dependencies += [
|
||||
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0"),
|
||||
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0")
|
||||
]
|
||||
} else {
|
||||
package.dependencies += [
|
||||
|
||||
+40
-4
@@ -6,8 +6,12 @@ import CompilerPluginSupport
|
||||
// Availability Macros
|
||||
|
||||
let availabilityMacros: [SwiftSetting] = [
|
||||
.enableExperimentalFeature("AvailabilityMacro=AsyncAlgorithms 1.0:macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0"),
|
||||
.enableExperimentalFeature("AvailabilityMacro=AsyncAlgorithms 1.1:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0"),
|
||||
.enableExperimentalFeature(
|
||||
"AvailabilityMacro=AsyncAlgorithms 1.0:macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0"
|
||||
),
|
||||
.enableExperimentalFeature(
|
||||
"AvailabilityMacro=AsyncAlgorithms 1.1:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0"
|
||||
),
|
||||
]
|
||||
|
||||
let package = Package(
|
||||
@@ -43,7 +47,39 @@ let package = Package(
|
||||
),
|
||||
.testTarget(
|
||||
name: "AsyncAlgorithmsTests",
|
||||
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation", "AsyncAlgorithms_XCTest"],
|
||||
dependencies: [
|
||||
.target(name: "AsyncAlgorithms"),
|
||||
.target(
|
||||
name: "AsyncSequenceValidation",
|
||||
condition: .when(platforms: [
|
||||
.macOS,
|
||||
.iOS,
|
||||
.tvOS,
|
||||
.watchOS,
|
||||
.visionOS,
|
||||
.macCatalyst,
|
||||
.android,
|
||||
.linux,
|
||||
.openbsd,
|
||||
.wasi,
|
||||
])
|
||||
),
|
||||
.target(
|
||||
name: "AsyncAlgorithms_XCTest",
|
||||
condition: .when(platforms: [
|
||||
.macOS,
|
||||
.iOS,
|
||||
.tvOS,
|
||||
.watchOS,
|
||||
.visionOS,
|
||||
.macCatalyst,
|
||||
.android,
|
||||
.linux,
|
||||
.openbsd,
|
||||
.wasi,
|
||||
])
|
||||
),
|
||||
],
|
||||
swiftSettings: availabilityMacros + [
|
||||
.enableExperimentalFeature("StrictConcurrency=complete")
|
||||
]
|
||||
@@ -53,7 +89,7 @@ let package = Package(
|
||||
|
||||
if Context.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
|
||||
package.dependencies += [
|
||||
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0"),
|
||||
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0")
|
||||
]
|
||||
} else {
|
||||
package.dependencies += [
|
||||
|
||||
@@ -80,7 +80,7 @@ public struct AsyncBufferSequence<Base: AsyncSequence & Sendable>: AsyncSequence
|
||||
// to specify that the element is actually Sendable since the draining mechanism passes
|
||||
// through the isolation that is in nature sending but cannot be marked as such for the
|
||||
// isolated next method.
|
||||
// In practice the users of this type are safe from isolation crossing since the Element
|
||||
// In practice the users of this type are safe from isolation crossing since the Element
|
||||
// is as sendable as it is required by the base sequences the buffer is constructed from.
|
||||
enum StorageType {
|
||||
case transparent(Base.AsyncIterator)
|
||||
|
||||
@@ -109,7 +109,6 @@ final class BoundedBufferStorage<Base: AsyncSequence>: Sendable where Base: Send
|
||||
case .none:
|
||||
break
|
||||
case .resumeConsumer(let continuation, let result):
|
||||
|
||||
continuation.resume(returning: result)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ final class TestBuffer: XCTestCase {
|
||||
XCTAssertNil(pastFailure)
|
||||
}
|
||||
|
||||
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
|
||||
func test_given_a_base_sequence_when_bufferingOldest_then_the_policy_is_applied() async {
|
||||
validate {
|
||||
"X-12- 34- 5 |"
|
||||
@@ -171,6 +172,7 @@ final class TestBuffer: XCTestCase {
|
||||
"X,,,,,,[45^]"
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
func
|
||||
test_given_a_buffered_with_unbounded_sequence_when_cancelling_consumer_then_the_iteration_finishes_and_the_base_is_cancelled()
|
||||
@@ -325,6 +327,7 @@ final class TestBuffer: XCTestCase {
|
||||
await fulfillment(of: [finished], timeout: 1.0)
|
||||
}
|
||||
|
||||
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
|
||||
func test_given_a_base_sequence_when_bounded_with_limit_0_then_the_policy_is_transparent() async {
|
||||
validate {
|
||||
"X-12- 34 -5|"
|
||||
@@ -332,4 +335,5 @@ final class TestBuffer: XCTestCase {
|
||||
"X-12- 34 -5|"
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -10,6 +10,9 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import XCTest
|
||||
|
||||
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
|
||||
|
||||
import AsyncSequenceValidation
|
||||
import AsyncAlgorithms
|
||||
|
||||
@@ -334,3 +337,5 @@ final class TestChunk: XCTestCase {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -13,6 +13,7 @@ import XCTest
|
||||
import AsyncAlgorithms
|
||||
|
||||
final class TestDebounce: XCTestCase {
|
||||
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
|
||||
func test_delayingValues() throws {
|
||||
guard #available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) else {
|
||||
throw XCTSkip("Skipped due to Clock/Instant/Duration availability")
|
||||
@@ -67,6 +68,7 @@ final class TestDebounce: XCTestCase {
|
||||
"----|"
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
func test_Rethrows() async throws {
|
||||
guard #available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) else {
|
||||
|
||||
@@ -170,6 +170,7 @@ final class TestMerge2: XCTestCase {
|
||||
XCTAssertEqual(collected.intersection(expected), expected)
|
||||
}
|
||||
|
||||
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
|
||||
func test_merge_makes_sequence_with_ordered_elements_when_sources_follow_a_timeline() {
|
||||
validate {
|
||||
"a-c-e-g-|"
|
||||
@@ -178,6 +179,7 @@ final class TestMerge2: XCTestCase {
|
||||
"abcdefgh|"
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
func test_merge_finishes_when_iteration_task_is_cancelled() async {
|
||||
let source1 = Indefinite(value: "test1")
|
||||
@@ -508,6 +510,7 @@ final class TestMerge3: XCTestCase {
|
||||
XCTAssertEqual(collected.intersection(expected), expected)
|
||||
}
|
||||
|
||||
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
|
||||
func test_merge_makes_sequence_with_ordered_elements_when_sources_follow_a_timeline() {
|
||||
validate {
|
||||
"a---e---|"
|
||||
@@ -517,6 +520,7 @@ final class TestMerge3: XCTestCase {
|
||||
"abcdefgh|"
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
func test_merge_finishes_when_iteration_task_is_cancelled() async {
|
||||
let source1 = Indefinite(value: "test1")
|
||||
|
||||
@@ -13,6 +13,7 @@ import XCTest
|
||||
import AsyncAlgorithms
|
||||
|
||||
final class TestThrottle: XCTestCase {
|
||||
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
|
||||
func test_rate_0() throws {
|
||||
guard #available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) else {
|
||||
throw XCTSkip("Skipped due to Clock/Instant/Duration availability")
|
||||
@@ -188,4 +189,5 @@ final class TestThrottle: XCTestCase {
|
||||
"a--d--g--j--[l|]"
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -10,6 +10,9 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import XCTest
|
||||
|
||||
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
|
||||
|
||||
import AsyncAlgorithms
|
||||
import AsyncSequenceValidation
|
||||
|
||||
@@ -57,3 +60,5 @@ final class TestTimer: XCTestCase {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -10,6 +10,9 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import XCTest
|
||||
|
||||
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
|
||||
|
||||
import AsyncAlgorithms
|
||||
import AsyncSequenceValidation
|
||||
@testable import AsyncAlgorithms_XCTest
|
||||
@@ -354,3 +357,5 @@ struct LaggingAsyncSequence<Base: AsyncSequence, C: Clock>: AsyncSequence {
|
||||
self.clock = clock
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user