Skip to content

Commit ca38935

Browse files
authored
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
1 parent 18e2398 commit ca38935

File tree

12 files changed

+110
-12
lines changed

12 files changed

+110
-12
lines changed

.github/workflows/pull_request.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
name: Test
1010
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
1111
with:
12+
linux_exclude_swift_versions: "[{\"swift_version\": \"5.9\"}]"
13+
windows_exclude_swift_versions: "[{\"swift_version\": \"5.9\"}]"
1214
enable_wasm_sdk_build: true
1315
wasm_sdk_build_command: swift build -Xcc -D_WASI_EMULATED_PTHREAD
1416

Package.swift

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
import PackageDescription
44
import CompilerPluginSupport
55

6-
// Availability Macros
7-
86
let availabilityMacros: [SwiftSetting] = [
9-
.enableExperimentalFeature("AvailabilityMacro=AsyncAlgorithms 1.0:macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0"),
10-
.enableExperimentalFeature("AvailabilityMacro=AsyncAlgorithms 1.1:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0"),
7+
.enableExperimentalFeature(
8+
"AvailabilityMacro=AsyncAlgorithms 1.0:macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0"
9+
),
10+
.enableExperimentalFeature(
11+
"AvailabilityMacro=AsyncAlgorithms 1.1:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0"
12+
),
1113
]
1214

1315
let package = Package(
@@ -43,7 +45,39 @@ let package = Package(
4345
),
4446
.testTarget(
4547
name: "AsyncAlgorithmsTests",
46-
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation", "AsyncAlgorithms_XCTest"],
48+
dependencies: [
49+
.target(name: "AsyncAlgorithms"),
50+
.target(
51+
name: "AsyncSequenceValidation",
52+
condition: .when(platforms: [
53+
.macOS,
54+
.iOS,
55+
.tvOS,
56+
.watchOS,
57+
.visionOS,
58+
.macCatalyst,
59+
.android,
60+
.linux,
61+
.openbsd,
62+
.wasi,
63+
])
64+
),
65+
.target(
66+
name: "AsyncAlgorithms_XCTest",
67+
condition: .when(platforms: [
68+
.macOS,
69+
.iOS,
70+
.tvOS,
71+
.watchOS,
72+
.visionOS,
73+
.macCatalyst,
74+
.android,
75+
.linux,
76+
.openbsd,
77+
.wasi,
78+
])
79+
),
80+
],
4781
swiftSettings: availabilityMacros + [
4882
.enableExperimentalFeature("StrictConcurrency=complete")
4983
]
@@ -53,7 +87,7 @@ let package = Package(
5387

5488
if Context.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
5589
package.dependencies += [
56-
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0"),
90+
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0")
5791
]
5892
} else {
5993
package.dependencies += [

[email protected]

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ import CompilerPluginSupport
66
// Availability Macros
77

88
let availabilityMacros: [SwiftSetting] = [
9-
.enableExperimentalFeature("AvailabilityMacro=AsyncAlgorithms 1.0:macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0"),
10-
.enableExperimentalFeature("AvailabilityMacro=AsyncAlgorithms 1.1:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0"),
9+
.enableExperimentalFeature(
10+
"AvailabilityMacro=AsyncAlgorithms 1.0:macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0"
11+
),
12+
.enableExperimentalFeature(
13+
"AvailabilityMacro=AsyncAlgorithms 1.1:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0"
14+
),
1115
]
1216

1317
let package = Package(
@@ -43,7 +47,39 @@ let package = Package(
4347
),
4448
.testTarget(
4549
name: "AsyncAlgorithmsTests",
46-
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation", "AsyncAlgorithms_XCTest"],
50+
dependencies: [
51+
.target(name: "AsyncAlgorithms"),
52+
.target(
53+
name: "AsyncSequenceValidation",
54+
condition: .when(platforms: [
55+
.macOS,
56+
.iOS,
57+
.tvOS,
58+
.watchOS,
59+
.visionOS,
60+
.macCatalyst,
61+
.android,
62+
.linux,
63+
.openbsd,
64+
.wasi,
65+
])
66+
),
67+
.target(
68+
name: "AsyncAlgorithms_XCTest",
69+
condition: .when(platforms: [
70+
.macOS,
71+
.iOS,
72+
.tvOS,
73+
.watchOS,
74+
.visionOS,
75+
.macCatalyst,
76+
.android,
77+
.linux,
78+
.openbsd,
79+
.wasi,
80+
])
81+
),
82+
],
4783
swiftSettings: availabilityMacros + [
4884
.enableExperimentalFeature("StrictConcurrency=complete")
4985
]
@@ -53,7 +89,7 @@ let package = Package(
5389

5490
if Context.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
5591
package.dependencies += [
56-
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0"),
92+
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0")
5793
]
5894
} else {
5995
package.dependencies += [

Sources/AsyncAlgorithms/Buffer/AsyncBufferSequence.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public struct AsyncBufferSequence<Base: AsyncSequence & Sendable>: AsyncSequence
8080
// to specify that the element is actually Sendable since the draining mechanism passes
8181
// through the isolation that is in nature sending but cannot be marked as such for the
8282
// isolated next method.
83-
// In practice the users of this type are safe from isolation crossing since the Element
83+
// In practice the users of this type are safe from isolation crossing since the Element
8484
// is as sendable as it is required by the base sequences the buffer is constructed from.
8585
enum StorageType {
8686
case transparent(Base.AsyncIterator)

Sources/AsyncAlgorithms/Buffer/BoundedBufferStorage.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ final class BoundedBufferStorage<Base: AsyncSequence>: Sendable where Base: Send
109109
case .none:
110110
break
111111
case .resumeConsumer(let continuation, let result):
112-
113112
continuation.resume(returning: result)
114113
}
115114
}

Tests/AsyncAlgorithmsTests/TestBuffer.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ final class TestBuffer: XCTestCase {
108108
XCTAssertNil(pastFailure)
109109
}
110110

111+
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
111112
func test_given_a_base_sequence_when_bufferingOldest_then_the_policy_is_applied() async {
112113
validate {
113114
"X-12- 34- 5 |"
@@ -171,6 +172,7 @@ final class TestBuffer: XCTestCase {
171172
"X,,,,,,[45^]"
172173
}
173174
}
175+
#endif
174176

175177
func
176178
test_given_a_buffered_with_unbounded_sequence_when_cancelling_consumer_then_the_iteration_finishes_and_the_base_is_cancelled()
@@ -325,11 +327,13 @@ final class TestBuffer: XCTestCase {
325327
await fulfillment(of: [finished], timeout: 1.0)
326328
}
327329

330+
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
328331
func test_given_a_base_sequence_when_bounded_with_limit_0_then_the_policy_is_transparent() async {
329332
validate {
330333
"X-12- 34 -5|"
331334
$0.inputs[0].buffer(policy: .bounded(0))
332335
"X-12- 34 -5|"
333336
}
334337
}
338+
#endif
335339
}

Tests/AsyncAlgorithmsTests/TestChunk.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
import XCTest
13+
14+
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
15+
1316
import AsyncSequenceValidation
1417
import AsyncAlgorithms
1518

@@ -334,3 +337,5 @@ final class TestChunk: XCTestCase {
334337
}
335338
}
336339
}
340+
341+
#endif

Tests/AsyncAlgorithmsTests/TestDebounce.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import XCTest
1313
import AsyncAlgorithms
1414

1515
final class TestDebounce: XCTestCase {
16+
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
1617
func test_delayingValues() throws {
1718
guard #available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) else {
1819
throw XCTSkip("Skipped due to Clock/Instant/Duration availability")
@@ -67,6 +68,7 @@ final class TestDebounce: XCTestCase {
6768
"----|"
6869
}
6970
}
71+
#endif
7072

7173
func test_Rethrows() async throws {
7274
guard #available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) else {

Tests/AsyncAlgorithmsTests/TestMerge.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ final class TestMerge2: XCTestCase {
170170
XCTAssertEqual(collected.intersection(expected), expected)
171171
}
172172

173+
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
173174
func test_merge_makes_sequence_with_ordered_elements_when_sources_follow_a_timeline() {
174175
validate {
175176
"a-c-e-g-|"
@@ -178,6 +179,7 @@ final class TestMerge2: XCTestCase {
178179
"abcdefgh|"
179180
}
180181
}
182+
#endif
181183

182184
func test_merge_finishes_when_iteration_task_is_cancelled() async {
183185
let source1 = Indefinite(value: "test1")
@@ -508,6 +510,7 @@ final class TestMerge3: XCTestCase {
508510
XCTAssertEqual(collected.intersection(expected), expected)
509511
}
510512

513+
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
511514
func test_merge_makes_sequence_with_ordered_elements_when_sources_follow_a_timeline() {
512515
validate {
513516
"a---e---|"
@@ -517,6 +520,7 @@ final class TestMerge3: XCTestCase {
517520
"abcdefgh|"
518521
}
519522
}
523+
#endif
520524

521525
func test_merge_finishes_when_iteration_task_is_cancelled() async {
522526
let source1 = Indefinite(value: "test1")

Tests/AsyncAlgorithmsTests/TestThrottle.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import XCTest
1313
import AsyncAlgorithms
1414

1515
final class TestThrottle: XCTestCase {
16+
#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread)
1617
func test_rate_0() throws {
1718
guard #available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) else {
1819
throw XCTSkip("Skipped due to Clock/Instant/Duration availability")
@@ -188,4 +189,5 @@ final class TestThrottle: XCTestCase {
188189
"a--d--g--j--[l|]"
189190
}
190191
}
192+
#endif
191193
}

0 commit comments

Comments
 (0)