Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Windows CI #116

Merged
merged 11 commits into from
Sep 11, 2023
Merged
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,27 @@ jobs:
- uses: actions/checkout@v2
- name: Run tests
run: make test-linux

windows:
name: Windows
strategy:
matrix:
os: [windows-latest]
config: ['debug', 'release']
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: compnerd/gha-setup-swift@main
with:
branch: swift-5.8.1-release
tag: 5.8.1-RELEASE
- uses: actions/checkout@v3
- name: Build
run: swift build -c ${{ matrix.config }}
- name: Run tests (debug only)
# There is an issue that exists in the 5.8.1 toolchain
# which fails on release configuration testing, but
# this issue is fixed 5.9 so we can remove the if once
# that is generally available.
if: ${{ matrix.config == 'debug' }}
run: swift test
16 changes: 12 additions & 4 deletions Tests/CasePathsTests/CasePathsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1202,12 +1202,21 @@ final class CasePathsTests: XCTestCase {
}

#if canImport(_Concurrency) && compiler(>=5.5.2)
#if os(Windows)
// There seems to be some strangeness with the current
// concurrency implmentation on Windows that breaks if
// you have more than 100 tasks here.
let maxIterations = 100
#else
let maxIterations = 100_000
#endif

func testConcurrency_SharedCasePath() async throws {
enum Enum { case payload(Int) }
let casePath = /Enum.payload

await withTaskGroup(of: Void.self) { group in
for index in 1...100_000 {
for index in 1...maxIterations {
group.addTask {
XCTAssertEqual(casePath.extract(from: Enum.payload(index)), index)
}
Expand All @@ -1217,11 +1226,10 @@ final class CasePathsTests: XCTestCase {

func testConcurrency_NonSendableEmbed() async throws {
enum Enum: Equatable { case payload(Int) }
let iterationCount = 100_000
var count = 0

await withTaskGroup(of: Void.self) { group in
for index in 1...iterationCount {
for index in 1...maxIterations {
let casePath1 = CasePath<Enum, Int> {
count += 1
return .payload($0)
Expand All @@ -1242,7 +1250,7 @@ final class CasePathsTests: XCTestCase {
}
}

XCTAssertEqual(count, iterationCount * 4)
XCTAssertEqual(count, maxIterations * 4)
}
#endif
}
Expand Down
Loading