Skip to content

Commit ac5f18c

Browse files
authored
feat: Add Compilation & Testing On Windows (#68)
1 parent 2b479e0 commit ac5f18c

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed

.github/workflows/windows.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Windows CI
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
library-windows:
9+
name: Windows - Swift 5.9
10+
runs-on: windows-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Install Swift
14+
uses: compnerd/gha-setup-swift@325a5c6b81322f9b7497530aef08119d238ddfa8
15+
with:
16+
branch: swift-5.9-release
17+
tag: 5.9-RELEASE
18+
- name: Build and test
19+
run: swift test

Source/LDSwiftEventSource.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
#if os(Linux)
3+
#if os(Linux) || os(Windows)
44
import FoundationNetworking
55
#endif
66

@@ -86,7 +86,7 @@ public class EventSource {
8686
sessionConfig.httpAdditionalHeaders = ["Accept": "text/event-stream", "Cache-Control": "no-cache"]
8787
sessionConfig.timeoutIntervalForRequest = idleTimeout
8888

89-
#if !os(Linux)
89+
#if !os(Linux) && !os(Windows)
9090
if #available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *) {
9191
sessionConfig.tlsMinimumSupportedProtocolVersion = .TLSv12
9292
} else {

Source/Logs.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import Foundation
22

3-
#if !os(Linux)
3+
#if !os(Linux) && !os(Windows)
44
import os.log
55
#endif
66

77
class Logs {
88
enum Level {
99
case debug, info, warn, error
1010

11-
#if !os(Linux)
11+
#if !os(Linux) && !os(Windows)
1212
private static let osLogTypes = [ Level.debug: OSLogType.debug,
1313
Level.info: OSLogType.info,
1414
Level.warn: OSLogType.default,
@@ -17,7 +17,7 @@ class Logs {
1717
#endif
1818
}
1919

20-
#if !os(Linux)
20+
#if !os(Linux) && !os(Windows)
2121
private let logger: OSLog = OSLog(subsystem: "com.launchdarkly.swift-eventsource", category: "LDEventSource")
2222

2323
func log(_ level: Level, _ staticMsg: StaticString) {

Tests/LDSwiftEventSourceTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import XCTest
22
@testable import LDSwiftEventSource
33

4-
#if os(Linux)
4+
#if os(Linux) || os(Windows)
55
import FoundationNetworking
66
#endif
77

@@ -169,7 +169,7 @@ final class LDSwiftEventSourceTests: XCTestCase {
169169
return sessionConfig
170170
}
171171

172-
#if !os(Linux)
172+
#if !os(Linux) && !os(Windows)
173173
func testStartDefaultRequest() {
174174
var config = EventSource.Config(handler: mockHandler, url: URL(string: "http://example.com")!)
175175
config.urlSessionConfiguration = sessionWithMockProtocol()

Tests/TestUtil.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import XCTest
22

3-
#if os(Linux)
3+
#if os(Linux) || os(Windows)
44
import FoundationNetworking
55
#endif
66

0 commit comments

Comments
 (0)