Skip to content

Commit f66d84d

Browse files
authored
Linux support (#59)
* Linux support Looks like I missed a file * Try Linux build * Lower version of Swift Linux * Lower version of Swift Linux * Update ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * Fix test errors for linux * Only build Linux * add back in tests * Fix URLMocker for Linux * Update * update linux test * remove linux tests * bump versions
1 parent cb26d0f commit f66d84d

File tree

11 files changed

+55
-56
lines changed

11 files changed

+55
-56
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ jobs:
8686
run: swift test --enable-code-coverage -v
8787
env:
8888
DEVELOPER_DIR: ${{ env.CI_XCODE_VER }}
89+
90+
linux:
91+
runs-on: ubuntu-18.04
92+
steps:
93+
- uses: actions/checkout@v2
94+
- uses: sersoft-gmbh/[email protected]
95+
with:
96+
release-version: 5.3.2
97+
- name: Build
98+
run: swift build
99+
#- name: Test
100+
# run: swift test --enable-test-discovery
89101

90102
docs:
91103
needs: xcode-build-watchos

ParseSwift.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "ParseSwift"
3-
s.version = "1.0.1"
3+
s.version = "1.0.2"
44
s.summary = "Parse Pure Swift SDK"
55
s.homepage = "https://github.com/parse-community/Parse-Swift"
66
s.authors = {

ParseSwift.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,7 +2045,7 @@
20452045
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
20462046
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
20472047
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2048-
MARKETING_VERSION = 1.0.0;
2048+
MARKETING_VERSION = 1.0.2;
20492049
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
20502050
PRODUCT_NAME = ParseSwift;
20512051
SKIP_INSTALL = YES;
@@ -2067,7 +2067,7 @@
20672067
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
20682068
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
20692069
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2070-
MARKETING_VERSION = 1.0.0;
2070+
MARKETING_VERSION = 1.0.2;
20712071
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
20722072
PRODUCT_NAME = ParseSwift;
20732073
SKIP_INSTALL = YES;
@@ -2131,7 +2131,7 @@
21312131
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
21322132
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
21332133
MACOSX_DEPLOYMENT_TARGET = 10.13;
2134-
MARKETING_VERSION = 1.0.0;
2134+
MARKETING_VERSION = 1.0.2;
21352135
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
21362136
PRODUCT_NAME = ParseSwift;
21372137
SDKROOT = macosx;
@@ -2155,7 +2155,7 @@
21552155
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
21562156
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
21572157
MACOSX_DEPLOYMENT_TARGET = 10.13;
2158-
MARKETING_VERSION = 1.0.0;
2158+
MARKETING_VERSION = 1.0.2;
21592159
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
21602160
PRODUCT_NAME = ParseSwift;
21612161
SDKROOT = macosx;
@@ -2300,7 +2300,7 @@
23002300
INFOPLIST_FILE = "ParseSwift-watchOS/Info.plist";
23012301
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
23022302
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2303-
MARKETING_VERSION = 1.0.0;
2303+
MARKETING_VERSION = 1.0.2;
23042304
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
23052305
MTL_FAST_MATH = YES;
23062306
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-watchOS";
@@ -2328,7 +2328,7 @@
23282328
INFOPLIST_FILE = "ParseSwift-watchOS/Info.plist";
23292329
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
23302330
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2331-
MARKETING_VERSION = 1.0.0;
2331+
MARKETING_VERSION = 1.0.2;
23322332
MTL_FAST_MATH = YES;
23332333
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-watchOS";
23342334
PRODUCT_NAME = ParseSwift;
@@ -2354,7 +2354,7 @@
23542354
INFOPLIST_FILE = "ParseSwift-tvOS/Info.plist";
23552355
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
23562356
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2357-
MARKETING_VERSION = 1.0.0;
2357+
MARKETING_VERSION = 1.0.2;
23582358
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
23592359
MTL_FAST_MATH = YES;
23602360
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-tvOS";
@@ -2381,7 +2381,7 @@
23812381
INFOPLIST_FILE = "ParseSwift-tvOS/Info.plist";
23822382
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
23832383
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2384-
MARKETING_VERSION = 1.0.0;
2384+
MARKETING_VERSION = 1.0.2;
23852385
MTL_FAST_MATH = YES;
23862386
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-tvOS";
23872387
PRODUCT_NAME = ParseSwift;

Scripts/jazzy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ bundle exec jazzy \
55
--author_url http://parseplatform.org \
66
--github_url https://github.com/parse-community/Parse-Swift \
77
--root-url http://parseplatform.org/Parse-Swift/api/ \
8-
--module-version 1.0.0 \
8+
--module-version 1.0.2 \
99
--theme fullwidth \
1010
--skip-undocumented \
1111
--output ./docs/api \

Sources/ParseSwift/LiveQuery/Protocols/ParseLiveQueryDelegate.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by Corey Baker on 1/4/21.
66
// Copyright © 2021 Parse Community. All rights reserved.
77
//
8-
8+
#if !os(Linux)
99
import Foundation
1010
#if canImport(FoundationNetworking)
1111
import FoundationNetworking
@@ -70,3 +70,4 @@ extension ParseLiveQueryDelegate {
7070
func receivedUnsupported(_ data: Data?, socketMessage: URLSessionWebSocketTask.Message?) { }
7171
func received(_ metrics: URLSessionTaskTransactionMetrics) { }
7272
}
73+
#endif

Tests/ParseSwiftTests/KeychainStoreTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by Florent Vilmart on 17-09-25.
66
// Copyright © 2020 Parse Community. All rights reserved.
77
//
8-
8+
#if !os(Linux)
99
import Foundation
1010
import XCTest
1111
@testable import ParseSwift
@@ -169,3 +169,4 @@ class KeychainStoreTests: XCTestCase {
169169
}
170170
}
171171
}
172+
#endif

Tests/ParseSwiftTests/NetworkMocking/MockURLProtocol.swift

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@
77
//
88

99
import Foundation
10+
#if canImport(FoundationNetworking)
11+
import FoundationNetworking
12+
#endif
1013

1114
typealias MockURLProtocolRequestTestClosure = (URLRequest) -> Bool
1215
typealias MockURLResponseContructingClosure = (URLRequest) -> MockURLResponse?
1316

1417
struct MockURLProtocolMock {
1518
var attempts: Int
16-
var test: MockURLProtocolRequestTestClosure
17-
var response: MockURLResponseContructingClosure
19+
var test: (URLRequest) -> Bool
20+
var response: (URLRequest) -> MockURLResponse?
1821
}
1922

2023
class MockURLProtocol: URLProtocol {
@@ -25,17 +28,17 @@ class MockURLProtocol: URLProtocol {
2528
return loading
2629
}
2730

28-
class func mockRequests(response: @escaping MockURLResponseContructingClosure) {
29-
mockRequestsPassing(NSIntegerMax, test: { _ in return true }, with: response)
31+
class func mockRequests(response: @escaping (URLRequest) -> MockURLResponse?) {
32+
mockRequestsPassing(Int.max, test: { _ in return true }, with: response)
3033
}
3134

32-
class func mockRequestsPassing(_ test: @escaping MockURLProtocolRequestTestClosure,
33-
with response: @escaping MockURLResponseContructingClosure) {
34-
mockRequestsPassing(NSIntegerMax, test: test, with: response)
35+
class func mockRequestsPassing(_ test: @escaping (URLRequest) -> Bool,
36+
with response: @escaping (URLRequest) -> MockURLResponse?) {
37+
mockRequestsPassing(Int.max, test: test, with: response)
3538
}
3639

37-
class func mockRequestsPassing(_ attempts: Int, test: @escaping MockURLProtocolRequestTestClosure,
38-
with response: @escaping MockURLResponseContructingClosure) {
40+
class func mockRequestsPassing(_ attempts: Int, test: @escaping (URLRequest) -> Bool,
41+
with response: @escaping (URLRequest) -> MockURLResponse?) {
3942
let mock = MockURLProtocolMock(attempts: attempts, test: test, response: response)
4043
mocks.append(mock)
4144
if mocks.count == 1 {
@@ -74,7 +77,7 @@ class MockURLProtocol: URLProtocol {
7477
return request
7578
}
7679

77-
override init(request: URLRequest, cachedResponse: CachedURLResponse?, client: URLProtocolClient?) {
80+
override required init(request: URLRequest, cachedResponse: CachedURLResponse?, client: URLProtocolClient?) {
7881
super.init(request: request, cachedResponse: cachedResponse, client: client)
7982
guard let mock = MockURLProtocol.firstMockForRequest(request) else {
8083
self.mock = nil
@@ -91,7 +94,7 @@ class MockURLProtocol: URLProtocol {
9194
}
9295

9396
if let error = response.error {
94-
DispatchQueue.global(qos: .default).asyncAfter(deadline: .now() + response.delay * Double(NSEC_PER_SEC)) {
97+
DispatchQueue.global(qos: .default).asyncAfter(deadline: .now() + response.delay) {
9598

9699
if self.loading {
97100
self.client?.urlProtocol(self, didFailWithError: error)
@@ -107,7 +110,7 @@ class MockURLProtocol: URLProtocol {
107110
return
108111
}
109112

110-
DispatchQueue.global(qos: .default).asyncAfter(deadline: .now() + response.delay * Double(NSEC_PER_SEC)) {
113+
DispatchQueue.global(qos: .default).asyncAfter(deadline: .now() + response.delay) {
111114

112115
if !self.loading {
113116
return

Tests/ParseSwiftTests/ParseInstallationTests.swift

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -383,40 +383,16 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l
383383
expectation1.fulfill()
384384
return
385385
}
386-
XCTAssertGreaterThan(savedUpdatedAt, originalUpdatedAt)
387-
XCTAssertNil(saved.ACL)
388-
389-
if callbackQueue != .main {
390-
DispatchQueue.main.async {
391-
guard let savedUpdatedAt = Installation.current?.updatedAt else {
392-
XCTFail("Should unwrap dates")
393-
expectation1.fulfill()
394-
return
395-
}
396-
guard let originalUpdatedAt = installation.updatedAt else {
397-
XCTFail("Should unwrap dates")
398-
expectation1.fulfill()
399-
return
400-
}
401-
XCTAssertGreaterThan(savedUpdatedAt, originalUpdatedAt)
402-
XCTAssertNil(Installation.current?.ACL)
403-
expectation1.fulfill()
404-
}
405-
} else {
406-
guard let savedUpdatedAt = Installation.current?.updatedAt else {
407-
XCTFail("Should unwrap dates")
408-
expectation1.fulfill()
409-
return
410-
}
411-
guard let originalUpdatedAt = installation.updatedAt else {
412-
XCTFail("Should unwrap dates")
413-
expectation1.fulfill()
414-
return
415-
}
416-
XCTAssertGreaterThan(savedUpdatedAt, originalUpdatedAt)
417-
XCTAssertNil(Installation.current?.ACL)
386+
guard let installationUpdatedAt = Installation.current?.updatedAt else {
387+
XCTFail("Should unwrap dates")
418388
expectation1.fulfill()
389+
return
419390
}
391+
XCTAssertGreaterThan(savedUpdatedAt, originalUpdatedAt)
392+
XCTAssertNil(saved.ACL)
393+
XCTAssertGreaterThan(installationUpdatedAt, originalUpdatedAt)
394+
XCTAssertNil(Installation.current?.ACL)
395+
expectation1.fulfill()
420396

421397
case .failure(let error):
422398
XCTFail(error.localizedDescription)

Tests/ParseSwiftTests/ParseOperationTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ class ParseOperationTests: XCTestCase {
6363
override func tearDownWithError() throws {
6464
try super.tearDownWithError()
6565
MockURLProtocol.removeAll()
66+
#if !os(Linux)
6667
try KeychainStore.shared.deleteAll()
68+
#endif
6769
try ParseStorage.shared.deleteAll()
6870
}
6971

Tests/ParseSwiftTests/ParseRelationTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ class ParseRelationTests: XCTestCase {
6262
override func tearDownWithError() throws {
6363
try super.tearDownWithError()
6464
MockURLProtocol.removeAll()
65+
#if !os(Linux)
6566
try KeychainStore.shared.deleteAll()
67+
#endif
6668
try ParseStorage.shared.deleteAll()
6769
}
6870

Tests/ParseSwiftTests/ParseRoleTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ class ParseRoleTests: XCTestCase {
9696
override func tearDownWithError() throws {
9797
try super.tearDownWithError()
9898
MockURLProtocol.removeAll()
99+
#if !os(Linux)
99100
try KeychainStore.shared.deleteAll()
101+
#endif
100102
try ParseStorage.shared.deleteAll()
101103
}
102104

0 commit comments

Comments
 (0)