Skip to content

Commit 8194ce7

Browse files
committed
[ci] Windows
1 parent 069e3c3 commit 8194ce7

File tree

20 files changed

+80
-32
lines changed

20 files changed

+80
-32
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ concurrency:
99
group: ${{ github.head_ref }}
1010
cancel-in-progress: true
1111
jobs:
12-
smoke:
12+
lint:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: harupy/find-trailing-whitespace@v1.0
1616

1717
linux:
18-
name: linux
1918
runs-on: ubuntu-latest
2019
strategy:
2120
matrix:
@@ -57,6 +56,7 @@ jobs:
5756
- 5.3
5857
- 5.4
5958
- 5.5
59+
name: ${{ matrix.platform }} (${{ matrix.swift }})
6060
steps:
6161
- uses: actions/checkout@v2
6262
- run: |
@@ -71,3 +71,23 @@ jobs:
7171
code-coverage: true
7272
warnings-as-errors: true
7373
- uses: codecov/codecov-action@v1
74+
75+
windows:
76+
runs-on: windows-latest
77+
steps:
78+
- uses: seanmiddleditch/gha-setup-vsdevenv@v3
79+
- run: |
80+
Install-Binary -Url "https://swift.org/builds/swift-5.4.1-release/windows10/swift-5.4.1-RELEASE/swift-5.4.1-RELEASE-windows10.exe" -Name "installer.exe" -ArgumentList ("-q")
81+
- run: |
82+
echo "SDKROOT=C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
83+
echo "DEVELOPER_DIR=C:\Library\Developer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
84+
- run: |
85+
echo "C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
86+
echo "C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
87+
- run: |
88+
Copy-Item "$env:SDKROOT\usr\share\ucrt.modulemap" -destination "$env:UniversalCRTSdkDir\Include\$env:UCRTVersion\ucrt\module.modulemap"
89+
Copy-Item "$env:SDKROOT\usr\share\visualc.modulemap" -destination "$env:VCToolsInstallDir\include\module.modulemap"
90+
Copy-Item "$env:SDKROOT\usr\share\visualc.apinotes" -destination "$env:VCToolsInstallDir\include\visualc.apinotes"
91+
Copy-Item "$env:SDKROOT\usr\share\winsdk.modulemap" -destination "$env:UniversalCRTSdkDir\Include\$env:UCRTVersion\um\module.modulemap"
92+
- uses: actions/checkout@v2
93+
- run: swift test --parallel

Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pkg.platforms = [
1111
]
1212
pkg.swiftLanguageVersions = [.v5]
1313

14-
#if !os(Linux)
14+
#if !os(Linux) && !os(Windows)
1515
pkg.dependencies = [
1616
.package(url: "https://github.com/AliSoftware/OHHTTPStubs", from: "9.1.0")
1717
]
@@ -30,7 +30,7 @@ func has(tests name: String) -> Target? {
3030
switch name {
3131
case "PMKFoundation":
3232
var deps = [Target.Dependency.target(name: "PMKFoundation")]
33-
#if !os(Linux)
33+
#if !os(Linux) && !os(Windows)
3434
deps.append(.product(name: "OHHTTPStubsSwift", package: "OHHTTPStubs"))
3535
#endif
3636
return .testTarget(name: "\(name)Tests", dependencies: deps, path: "Tests/\(name)")
@@ -43,7 +43,7 @@ func has(tests name: String) -> Target? {
4343

4444
for name in ["PMKCloudKit", "PMKCoreLocation", "PMKFoundation", "PMKHealthKit", "PMKHomeKit", "PMKMapKit", "PMKPhotos", "PMKStoreKit", "PromiseKit"] {
4545

46-
#if os(Linux)
46+
#if os(Linux) || os(Windows)
4747
guard name == "PromiseKit" || name == "PMKFoundation" else { continue }
4848
#endif
4949

Sources/PMKFoundation/NSObject+Promise.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if !os(Linux)
1+
#if !os(Linux) && !os(Windows)
22

33
import Foundation
44
#if !PMKCocoaPods

Sources/PMKFoundation/NSURLSession+Promise.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ extension URL: URLRequestConvertible {
128128
}
129129

130130

131-
#if !os(Linux)
131+
#if !os(Linux) && !os(Windows)
132132
public extension String {
133133
/**
134134
- Remark: useful when converting a `URLSession` response into a `String`

Sources/PMKFoundation/afterlife.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if !os(Linux)
1+
#if !os(Linux) && !os(Windows)
22

33
import Foundation
44
#if !PMKCocoaPods

Sources/PromiseKit/Dispatchers/CoreDataDispatcher.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if !os(Linux)
1+
#if canImport(CoreData)
22

33
import Foundation
44
import CoreData
@@ -28,4 +28,3 @@ public struct CoreDataDispatcher: Dispatcher {
2828
}
2929

3030
#endif
31-

Sources/PromiseKit/Guarantee.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,3 @@ public extension Dispatcher {
380380
return rg
381381
}
382382
}
383-
384-
#if os(Linux)
385-
import func CoreFoundation._CFIsMainThread
386-
387-
extension Thread {
388-
// `isMainThread` is not implemented yet in swift-corelibs-foundation.
389-
static var isMainThread: Bool {
390-
return _CFIsMainThread()
391-
}
392-
}
393-
#endif

Sources/PromiseKit/hang.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if canImport(CoreFoundation)
2+
13
import Foundation
24
import CoreFoundation
35

@@ -64,3 +66,5 @@ public func hang<T>(_ promise: Promise<T>) throws -> T {
6466
public func hang<T>(_ promise: CancellablePromise<T>) throws -> T {
6567
return try hang(promise.promise)
6668
}
69+
70+
#endif

Tests/A+/JavaScript/AllTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by Lois Di Qual on 2/28/18.
66
//
77

8-
#if !os(Linux) && !os(watchOS)
8+
#if !os(Linux) && !os(watchOS) && !os(Windows)
99
import JavaScriptCore
1010
import PromiseKit
1111
import XCTest

Tests/A+/JavaScript/JSAdapter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by Lois Di Qual on 3/2/18.
66
//
77

8-
#if !os(Linux) && !os(watchOS)
8+
#if !os(Linux) && !os(watchOS) && !os(Windows)
99
import JavaScriptCore
1010
import PromiseKit
1111

0 commit comments

Comments
 (0)