Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
with:
release-version: 5.3.2
- name: Build
run: swift build
#- name: Test
# run: swift test --enable-test-discovery

docs:
needs: xcode-build-watchos
Expand Down
2 changes: 1 addition & 1 deletion ParseSwift.podspec
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
16 changes: 8 additions & 8 deletions ParseSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand All @@ -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";
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Scripts/jazzy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -70,3 +70,4 @@ extension ParseLiveQueryDelegate {
func receivedUnsupported(_ data: Data?, socketMessage: URLSessionWebSocketTask.Message?) { }
func received(_ metrics: URLSessionTaskTransactionMetrics) { }
}
#endif
3 changes: 2 additions & 1 deletion Tests/ParseSwiftTests/KeychainStoreTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -169,3 +169,4 @@ class KeychainStoreTests: XCTestCase {
}
}
}
#endif
27 changes: 15 additions & 12 deletions Tests/ParseSwiftTests/NetworkMocking/MockURLProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down
40 changes: 8 additions & 32 deletions Tests/ParseSwiftTests/ParseInstallationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions Tests/ParseSwiftTests/ParseOperationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
2 changes: 2 additions & 0 deletions Tests/ParseSwiftTests/ParseRelationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
2 changes: 2 additions & 0 deletions Tests/ParseSwiftTests/ParseRoleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down