diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c656597eb..174caea77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,6 +86,18 @@ jobs: run: swift test --enable-code-coverage -v env: DEVELOPER_DIR: ${{ env.CI_XCODE_VER }} + + linux: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - uses: sersoft-gmbh/SwiftyActions@v1.1.1 + with: + release-version: 5.3.2 + - name: Build + run: swift build + #- name: Test + # run: swift test --enable-test-discovery docs: needs: xcode-build-watchos diff --git a/ParseSwift.podspec b/ParseSwift.podspec index dd461b95d..35eb6f62e 100644 --- a/ParseSwift.podspec +++ b/ParseSwift.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ParseSwift" - s.version = "1.0.1" + s.version = "1.0.2" s.summary = "Parse Pure Swift SDK" s.homepage = "https://github.com/parse-community/Parse-Swift" s.authors = { diff --git a/ParseSwift.xcodeproj/project.pbxproj b/ParseSwift.xcodeproj/project.pbxproj index c88b63683..91a9903c5 100644 --- a/ParseSwift.xcodeproj/project.pbxproj +++ b/ParseSwift.xcodeproj/project.pbxproj @@ -2045,7 +2045,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift; PRODUCT_NAME = ParseSwift; SKIP_INSTALL = YES; @@ -2067,7 +2067,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift; PRODUCT_NAME = ParseSwift; SKIP_INSTALL = YES; @@ -2131,7 +2131,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift; PRODUCT_NAME = ParseSwift; SDKROOT = macosx; @@ -2155,7 +2155,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift; PRODUCT_NAME = ParseSwift; SDKROOT = macosx; @@ -2300,7 +2300,7 @@ INFOPLIST_FILE = "ParseSwift-watchOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.0.2; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-watchOS"; @@ -2328,7 +2328,7 @@ INFOPLIST_FILE = "ParseSwift-watchOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.0.2; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-watchOS"; PRODUCT_NAME = ParseSwift; @@ -2354,7 +2354,7 @@ INFOPLIST_FILE = "ParseSwift-tvOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.0.2; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-tvOS"; @@ -2381,7 +2381,7 @@ INFOPLIST_FILE = "ParseSwift-tvOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.0.2; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-tvOS"; PRODUCT_NAME = ParseSwift; diff --git a/Scripts/jazzy.sh b/Scripts/jazzy.sh index 40e730032..ab6344f97 100755 --- a/Scripts/jazzy.sh +++ b/Scripts/jazzy.sh @@ -5,7 +5,7 @@ bundle exec jazzy \ --author_url http://parseplatform.org \ --github_url https://github.com/parse-community/Parse-Swift \ --root-url http://parseplatform.org/Parse-Swift/api/ \ - --module-version 1.0.0 \ + --module-version 1.0.2 \ --theme fullwidth \ --skip-undocumented \ --output ./docs/api \ diff --git a/Sources/ParseSwift/LiveQuery/Protocols/ParseLiveQueryDelegate.swift b/Sources/ParseSwift/LiveQuery/Protocols/ParseLiveQueryDelegate.swift index c817d3890..9a717802a 100644 --- a/Sources/ParseSwift/LiveQuery/Protocols/ParseLiveQueryDelegate.swift +++ b/Sources/ParseSwift/LiveQuery/Protocols/ParseLiveQueryDelegate.swift @@ -5,7 +5,7 @@ // Created by Corey Baker on 1/4/21. // Copyright © 2021 Parse Community. All rights reserved. // - +#if !os(Linux) import Foundation #if canImport(FoundationNetworking) import FoundationNetworking @@ -70,3 +70,4 @@ extension ParseLiveQueryDelegate { func receivedUnsupported(_ data: Data?, socketMessage: URLSessionWebSocketTask.Message?) { } func received(_ metrics: URLSessionTaskTransactionMetrics) { } } +#endif diff --git a/Tests/ParseSwiftTests/KeychainStoreTests.swift b/Tests/ParseSwiftTests/KeychainStoreTests.swift index f757b4c4a..4ffc7e7a1 100644 --- a/Tests/ParseSwiftTests/KeychainStoreTests.swift +++ b/Tests/ParseSwiftTests/KeychainStoreTests.swift @@ -5,7 +5,7 @@ // Created by Florent Vilmart on 17-09-25. // Copyright © 2020 Parse Community. All rights reserved. // - +#if !os(Linux) import Foundation import XCTest @testable import ParseSwift @@ -169,3 +169,4 @@ class KeychainStoreTests: XCTestCase { } } } +#endif diff --git a/Tests/ParseSwiftTests/NetworkMocking/MockURLProtocol.swift b/Tests/ParseSwiftTests/NetworkMocking/MockURLProtocol.swift index 2d182c852..9629e34c2 100644 --- a/Tests/ParseSwiftTests/NetworkMocking/MockURLProtocol.swift +++ b/Tests/ParseSwiftTests/NetworkMocking/MockURLProtocol.swift @@ -7,14 +7,17 @@ // import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif typealias MockURLProtocolRequestTestClosure = (URLRequest) -> Bool typealias MockURLResponseContructingClosure = (URLRequest) -> MockURLResponse? struct MockURLProtocolMock { var attempts: Int - var test: MockURLProtocolRequestTestClosure - var response: MockURLResponseContructingClosure + var test: (URLRequest) -> Bool + var response: (URLRequest) -> MockURLResponse? } class MockURLProtocol: URLProtocol { @@ -25,17 +28,17 @@ class MockURLProtocol: URLProtocol { return loading } - class func mockRequests(response: @escaping MockURLResponseContructingClosure) { - mockRequestsPassing(NSIntegerMax, test: { _ in return true }, with: response) + class func mockRequests(response: @escaping (URLRequest) -> MockURLResponse?) { + mockRequestsPassing(Int.max, test: { _ in return true }, with: response) } - class func mockRequestsPassing(_ test: @escaping MockURLProtocolRequestTestClosure, - with response: @escaping MockURLResponseContructingClosure) { - mockRequestsPassing(NSIntegerMax, test: test, with: response) + class func mockRequestsPassing(_ test: @escaping (URLRequest) -> Bool, + with response: @escaping (URLRequest) -> MockURLResponse?) { + mockRequestsPassing(Int.max, test: test, with: response) } - class func mockRequestsPassing(_ attempts: Int, test: @escaping MockURLProtocolRequestTestClosure, - with response: @escaping MockURLResponseContructingClosure) { + class func mockRequestsPassing(_ attempts: Int, test: @escaping (URLRequest) -> Bool, + with response: @escaping (URLRequest) -> MockURLResponse?) { let mock = MockURLProtocolMock(attempts: attempts, test: test, response: response) mocks.append(mock) if mocks.count == 1 { @@ -74,7 +77,7 @@ class MockURLProtocol: URLProtocol { return request } - override init(request: URLRequest, cachedResponse: CachedURLResponse?, client: URLProtocolClient?) { + override required init(request: URLRequest, cachedResponse: CachedURLResponse?, client: URLProtocolClient?) { super.init(request: request, cachedResponse: cachedResponse, client: client) guard let mock = MockURLProtocol.firstMockForRequest(request) else { self.mock = nil @@ -91,7 +94,7 @@ class MockURLProtocol: URLProtocol { } if let error = response.error { - DispatchQueue.global(qos: .default).asyncAfter(deadline: .now() + response.delay * Double(NSEC_PER_SEC)) { + DispatchQueue.global(qos: .default).asyncAfter(deadline: .now() + response.delay) { if self.loading { self.client?.urlProtocol(self, didFailWithError: error) @@ -107,7 +110,7 @@ class MockURLProtocol: URLProtocol { return } - DispatchQueue.global(qos: .default).asyncAfter(deadline: .now() + response.delay * Double(NSEC_PER_SEC)) { + DispatchQueue.global(qos: .default).asyncAfter(deadline: .now() + response.delay) { if !self.loading { return diff --git a/Tests/ParseSwiftTests/ParseInstallationTests.swift b/Tests/ParseSwiftTests/ParseInstallationTests.swift index 7c18b90bd..53380d9e2 100644 --- a/Tests/ParseSwiftTests/ParseInstallationTests.swift +++ b/Tests/ParseSwiftTests/ParseInstallationTests.swift @@ -383,40 +383,16 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l expectation1.fulfill() return } - XCTAssertGreaterThan(savedUpdatedAt, originalUpdatedAt) - XCTAssertNil(saved.ACL) - - if callbackQueue != .main { - DispatchQueue.main.async { - guard let savedUpdatedAt = Installation.current?.updatedAt else { - XCTFail("Should unwrap dates") - expectation1.fulfill() - return - } - guard let originalUpdatedAt = installation.updatedAt else { - XCTFail("Should unwrap dates") - expectation1.fulfill() - return - } - XCTAssertGreaterThan(savedUpdatedAt, originalUpdatedAt) - XCTAssertNil(Installation.current?.ACL) - expectation1.fulfill() - } - } else { - guard let savedUpdatedAt = Installation.current?.updatedAt else { - XCTFail("Should unwrap dates") - expectation1.fulfill() - return - } - guard let originalUpdatedAt = installation.updatedAt else { - XCTFail("Should unwrap dates") - expectation1.fulfill() - return - } - XCTAssertGreaterThan(savedUpdatedAt, originalUpdatedAt) - XCTAssertNil(Installation.current?.ACL) + guard let installationUpdatedAt = Installation.current?.updatedAt else { + XCTFail("Should unwrap dates") expectation1.fulfill() + return } + XCTAssertGreaterThan(savedUpdatedAt, originalUpdatedAt) + XCTAssertNil(saved.ACL) + XCTAssertGreaterThan(installationUpdatedAt, originalUpdatedAt) + XCTAssertNil(Installation.current?.ACL) + expectation1.fulfill() case .failure(let error): XCTFail(error.localizedDescription) diff --git a/Tests/ParseSwiftTests/ParseOperationTests.swift b/Tests/ParseSwiftTests/ParseOperationTests.swift index 503647990..b8ae8abde 100644 --- a/Tests/ParseSwiftTests/ParseOperationTests.swift +++ b/Tests/ParseSwiftTests/ParseOperationTests.swift @@ -63,7 +63,9 @@ class ParseOperationTests: XCTestCase { override func tearDownWithError() throws { try super.tearDownWithError() MockURLProtocol.removeAll() + #if !os(Linux) try KeychainStore.shared.deleteAll() + #endif try ParseStorage.shared.deleteAll() } diff --git a/Tests/ParseSwiftTests/ParseRelationTests.swift b/Tests/ParseSwiftTests/ParseRelationTests.swift index f7180101d..53d832e78 100644 --- a/Tests/ParseSwiftTests/ParseRelationTests.swift +++ b/Tests/ParseSwiftTests/ParseRelationTests.swift @@ -62,7 +62,9 @@ class ParseRelationTests: XCTestCase { override func tearDownWithError() throws { try super.tearDownWithError() MockURLProtocol.removeAll() + #if !os(Linux) try KeychainStore.shared.deleteAll() + #endif try ParseStorage.shared.deleteAll() } diff --git a/Tests/ParseSwiftTests/ParseRoleTests.swift b/Tests/ParseSwiftTests/ParseRoleTests.swift index d664b8ae7..0f775a705 100644 --- a/Tests/ParseSwiftTests/ParseRoleTests.swift +++ b/Tests/ParseSwiftTests/ParseRoleTests.swift @@ -96,7 +96,9 @@ class ParseRoleTests: XCTestCase { override func tearDownWithError() throws { try super.tearDownWithError() MockURLProtocol.removeAll() + #if !os(Linux) try KeychainStore.shared.deleteAll() + #endif try ParseStorage.shared.deleteAll() }