Skip to content

Commit

Permalink
ci: Update Xcode to 15.4 (#166)
Browse files Browse the repository at this point in the history
* ci: Update Xcode to 15.3

* Update release.yml

* Update ci.yml

* Update ci.yml

* fix test host for xrsimulator

* add visionOS to targeted devices

* Update ci.yml

* Update ci.yml

* install SwiftLint

* Update release.yml

* Update ci.yml

* fix swiftlint non_optional_string_data_conversion

* revert ParseTypeable description due to failures

* dont test some tests on tvOS

* set OS version of iOS, tvOS, and visionOS

* fix omitted tests in matrix

* remove visionOS test for now
  • Loading branch information
cbaker6 authored Jun 24, 2024
1 parent 077d457 commit 47b0a3b
Show file tree
Hide file tree
Showing 39 changed files with 191 additions and 243 deletions.
28 changes: 12 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
env:
CI_XCODE_OLDEST: '/Applications/Xcode_13.3.1.app/Contents/Developer'
CI_XCODE_14: '/Applications/Xcode_14.3.1.app/Contents/Developer'
CI_XCODE_LATEST: '/Applications/Xcode_15.2.app/Contents/Developer'
CI_XCODE_LATEST: '/Applications/Xcode_15.4.app/Contents/Developer'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -19,26 +19,26 @@ concurrency:
jobs:
test:
timeout-minutes: 25
runs-on: macos-13
runs-on: macos-14
strategy:
matrix:
destination: ['platform=iOS\ Simulator,name=iPhone\ 15\ Pro\ Max', 'platform\=tvOS\ Simulator,name\=Apple\ TV', 'platform=watchOS\ Simulator,name=Apple\ Watch\ Series\ 9\ \(41mm\)', 'platform=visionOS\ Simulator,name=Apple\ Vision\ Pro', 'platform=macOS']
destination: ['platform=iOS\ Simulator,OS=17.5,name=iPhone\ 15\ Pro\ Max', 'platform\=tvOS\ Simulator,OS=17.5,name\=Apple\ TV', 'platform=watchOS\ Simulator,name=Apple\ Watch\ Series\ 9\ \(41mm\)', 'platform=macOS'] # 'platform=visionOS\ Simulator,OS=1.2,name=Apple\ Vision\ Pro'
action: ['test', 'build']
exclude:
- destination: 'platform=iOS\ Simulator,name=iPhone\ 15\ Pro\ Max'
- destination: 'platform=iOS\ Simulator,OS=17.5,name=iPhone\ 15\ Pro\ Max'
action: 'build'
- destination: 'platform\=tvOS\ Simulator,name\=Apple\ TV'
- destination: 'platform\=tvOS\ Simulator,OS=17.5,name\=Apple\ TV'
action: 'build'
- destination: 'platform=macOS'
action: 'build'
- destination: 'platform=visionOS\ Simulator,name=Apple\ Vision\ Pro'
action: 'build'
# - destination: 'platform=visionOS\ Simulator,OS=1.2,name=Apple\ Vision\ Pro'
# action: 'build'
- destination: 'platform=watchOS\ Simulator,name=Apple\ Watch\ Series\ 9\ \(41mm\)'
action: 'test'
steps:
- uses: actions/checkout@v4
- name: Use multiple cores
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
- name: Install SwiftLint
run: brew install swiftlint
- name: Create and set the default keychain
run: |
security create-keychain -p "" temporary
Expand Down Expand Up @@ -77,8 +77,8 @@ jobs:
security default-keychain -s temporary
security unlock-keychain -p "" temporary
security set-keychain-settings -lut 7200 temporary
- name: Use multiple cores
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
- name: Install SwiftLint
run: brew install swiftlint
- name: Build-Test
run: set -o pipefail && env NSUnbufferedIO=YES swift test --enable-code-coverage | xcpretty -c
env:
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
uses: codecov/codecov-action@v4
with:
env_vars: LINUX
fail_ci_if_error: false
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

windows:
Expand Down Expand Up @@ -159,8 +159,6 @@ jobs:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Use multiple cores
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
- name: Generate Docs
run: set -o pipefail && env NSUnbufferedIO=YES Scripts/generate-documentation
env:
Expand All @@ -171,8 +169,6 @@ jobs:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Use multiple cores
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
- name: Update Framework Version
run: ./Scripts/update_build
env:
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
types: [published]
env:
CI_XCODE_14: '/Applications/Xcode_14.3.1.app/Contents/Developer'
CI_XCODE_LATEST: '/Applications/Xcode_15.2.app/Contents/Developer'
CI_XCODE_LATEST: '/Applications/Xcode_15.4.app/Contents/Developer'

jobs:
cocoapods:
Expand All @@ -13,8 +13,6 @@ jobs:
- uses: actions/checkout@v4
- name: Get release version
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Use multiple cores
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
- name: Update Framework Version
run: ./Scripts/update_build
env:
Expand All @@ -31,8 +29,6 @@ jobs:
- uses: actions/checkout@v4
- name: Get release version
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Use multiple cores
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
- name: Build and Deploy Docs
run: set -o pipefail && env NSUnbufferedIO=YES Scripts/update-gh-pages-documentation-site
env:
Expand Down
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ disabled_rules:
- file_length
- identifier_name
- blanket_disable_command
- non_optional_string_data_conversion
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Tests/ParseSwiftTests/ParseEncoderTests
- DerivedData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,7 @@ Task {
assertionFailure("Data is not the same. Something went wrong.")
}

guard let parseFileString = String(data: dataFromParseFile, encoding: .utf8) else {
fatalError("Error: Could not create String from data.")
}
let parseFileString = String(decoding: dataFromParseFile, as: UTF8.self)
print("The data saved on parse is: \"\(parseFileString)\"")
} else {
assertionFailure("Error fetching: there should be a localURL")
Expand Down
14 changes: 6 additions & 8 deletions ParseSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,7 @@
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7";
TVOS_DEPLOYMENT_TARGET = 13.0;
WATCHOS_DEPLOYMENT_TARGET = 6.0;
};
Expand Down Expand Up @@ -2056,7 +2056,7 @@
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7";
TVOS_DEPLOYMENT_TARGET = 13.0;
WATCHOS_DEPLOYMENT_TARGET = 6.0;
};
Expand Down Expand Up @@ -2086,7 +2086,7 @@
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestHost.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/TestHost";
};
name = Debug;
Expand Down Expand Up @@ -2115,7 +2115,7 @@
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestHost.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/TestHost";
};
name = Release;
Expand Down Expand Up @@ -2155,12 +2155,11 @@
PRODUCT_BUNDLE_IDENTIFIER = com.parse.TestHost;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos xrsimulator xros";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
TVOS_DEPLOYMENT_TARGET = 14.0;
WATCHOS_DEPLOYMENT_TARGET = 7.0;
};
Expand Down Expand Up @@ -2200,12 +2199,11 @@
PRODUCT_BUNDLE_IDENTIFIER = com.parse.TestHost;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos xrsimulator xros";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
TVOS_DEPLOYMENT_TARGET = 14.0;
WATCHOS_DEPLOYMENT_TARGET = 7.0;
};
Expand Down
8 changes: 4 additions & 4 deletions Sources/ParseSwift/API/API.swift
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,17 @@ public struct API {
case .removeMimeType:
headers.removeValue(forKey: "Content-Type")
case .metadata(let metadata):
metadata.forEach {(key, value) -> Void in
metadata.forEach {(key, value) in
headers[key] = value
}
case .tags(let tags):
tags.forEach {(key, value) -> Void in
tags.forEach {(key, value) in
headers[key] = value
}
case .context(let context):
let context = AnyEncodable(context)
if let encoded = try? ParseCoding.jsonEncoder().encode(context),
let encodedString = String(data: encoded, encoding: .utf8) {
if let encoded = try? ParseCoding.jsonEncoder().encode(context) {
let encodedString = String(decoding: encoded, as: UTF8.self)
headers["X-Parse-Cloud-Context"] = encodedString
}
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ public struct ParseApple<AuthenticatedUser: ParseUser>: ParseAuthentication {
/// to a string.
func makeDictionary(user: String,
identityToken: Data) throws -> [String: String] {
guard let identityTokenString = String(data: identityToken, encoding: .utf8) else {
throw ParseError(code: .otherCause, message: "Could not convert identityToken to String")
}
let identityTokenString = String(decoding: identityToken, as: UTF8.self)
return [AuthenticationKeys.id.rawValue: user,
AuthenticationKeys.token.rawValue: identityTokenString]
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/ParseSwift/Coding/AnyCodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ extension AnyCodable: Hashable {
public func hash(into hasher: inout Hasher) {
do {
let encodedData = try ParseCoding.jsonEncoder().encode(self)
let encodedString = String(data: encodedData, encoding: .utf8)
let encodedString = String(decoding: encodedData, as: UTF8.self)
hasher.combine(encodedString)
} catch {
hasher.combine(0)
Expand Down
2 changes: 1 addition & 1 deletion Sources/ParseSwift/Coding/AnyEncodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ extension AnyEncodable: Hashable {
public func hash(into hasher: inout Hasher) {
do {
let encodedData = try ParseCoding.jsonEncoder().encode(self)
let encodedString = String(data: encodedData, encoding: .utf8)
let encodedString = String(decoding: encodedData, as: UTF8.self)
hasher.combine(encodedString)
} catch {
hasher.combine(0)
Expand Down
3 changes: 1 addition & 2 deletions Sources/ParseSwift/Coding/ParseCoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ extension ParseCoding {

if
let decoded = try container.decodeIfPresent(String.self, forKey: .iso),
let date = dateFormatter.date(from: decoded)
{
let date = dateFormatter.date(from: decoded) {
return date
} else {
throw ParseError(
Expand Down
9 changes: 3 additions & 6 deletions Sources/ParseSwift/Extensions/Encodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,17 @@ internal extension Encodable {
self,
acl: nil
),
let lhsString = String(data: lhsData, encoding: .utf8),
let other = other,
let rhsData = try? ParseCoding
.parseEncoder()
.encode(
other,
acl: nil
),
let rhsString = String(
data: rhsData,
encoding: .utf8
) else {
) else {
return false
}
let lhsString = String(decoding: lhsData, as: UTF8.self)
let rhsString = String(decoding: rhsData, as: UTF8.self)
return lhsString == rhsString
}
}
3 changes: 2 additions & 1 deletion Sources/ParseSwift/Extensions/URLSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ internal extension URLSession {
return .failure(ParseError(message: "Error decoding parse-server response: \(response)",
swift: error))
}
let errorString = String(decoding: json, as: UTF8.self)
// swiftlint:disable:next line_length
return .failure(ParseError(message: "Error decoding parse-server response: \(response) with error: \(String(describing: error)) Format: \(String(describing: String(data: json, encoding: .utf8)))",
return .failure(ParseError(message: "Error decoding parse-server response: \(response) with error: \(String(describing: error)) Format: \(errorString)",
swift: error))
}
return .failure(parseError)
Expand Down
10 changes: 2 additions & 8 deletions Sources/ParseSwift/LiveQuery/LiveQuerySocket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ extension LiveQuerySocket {
.encode(await StandardMessage(operation: .connect,
// swiftlint:disable:next line_length
additionalProperties: Parse.configuration.liveQueryConnectionAdditionalProperties))
guard let encodedAsString = String(data: encoded, encoding: .utf8) else {
throw ParseError(code: .otherCause,
message: "Could not encode connect message: \(encoded)")
}
let encodedAsString = String(decoding: encoded, as: UTF8.self)
try await task.send(.string(encodedAsString))
await self.receive(task)
}
Expand All @@ -69,10 +66,7 @@ extension LiveQuerySocket {
// MARK: Send
extension LiveQuerySocket {
func send(_ data: Data, task: URLSessionWebSocketTask) async throws {
guard let encodedAsString = String(data: data, encoding: .utf8) else {
throw ParseError(code: .otherCause,
message: "Could not encode data as string: \(data)")
}
let encodedAsString = String(decoding: data, as: UTF8.self)
try await task.send(.string(encodedAsString))
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Not attempting to open ParseLiveQuery socket anymore
// Resubscribe to all subscriptions by moving them in front of pending
var tempPendingSubscriptions = [(RequestId, SubscriptionRecord)]()
let subscriptions = await self.subscriptions.getCurrent()
subscriptions.forEach { (key, value) -> Void in
subscriptions.forEach { (key, value) in
tempPendingSubscriptions.append((key, value))
}
await self.subscriptions.removeAll()
Expand Down
5 changes: 2 additions & 3 deletions Sources/ParseSwift/Objects/ParseObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -721,11 +721,10 @@ transactions for this call.
// MARK: CustomDebugStringConvertible
extension ParseObject {
public var debugDescription: String {
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self),
let descriptionString = String(data: descriptionData, encoding: .utf8) else {
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else {
return "\(className) ()"
}

let descriptionString = String(decoding: descriptionData, as: UTF8.self)
return "\(className) (\(descriptionString))"
}
}
Expand Down
4 changes: 1 addition & 3 deletions Sources/ParseSwift/Protocols/Objectable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ extension Objectable {
let encoded = try ParseCoding.parseEncoder().encode(object,
acl: nil,
batching: false)
guard let hashString = String(data: encoded, encoding: .utf8) else {
throw ParseError(code: .otherCause, message: "Could not create hash")
}
let hashString = String(decoding: encoded, as: UTF8.self)
return hashString
}

Expand Down
5 changes: 2 additions & 3 deletions Sources/ParseSwift/Protocols/ParseEncodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ public protocol ParseEncodable: Encodable {}
// MARK: CustomDebugStringConvertible
extension ParseEncodable {
public var debugDescription: String {
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self),
let descriptionString = String(data: descriptionData, encoding: .utf8) else {
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else {
return "()"
}

let descriptionString = String(decoding: descriptionData, as: UTF8.self)
return "\(descriptionString)"
}
}
Expand Down
7 changes: 3 additions & 4 deletions Sources/ParseSwift/Protocols/ParseOperationable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ public protocol ParseOperationable: Codable,
// MARK: CustomDebugStringConvertible
public extension ParseOperationable {
var debugDescription: String {
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self),
let descriptionString = String(data: descriptionData, encoding: .utf8) else {
return "()"
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else {
return "()"
}

let descriptionString = String(decoding: descriptionData, as: UTF8.self)
return "\(descriptionString)"
}
}
Expand Down
7 changes: 3 additions & 4 deletions Sources/ParseSwift/Protocols/ParseTypeable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ public protocol ParseTypeable: Codable,
// MARK: CustomDebugStringConvertible
extension ParseTypeable {
public var debugDescription: String {
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self),
let descriptionString = String(data: descriptionData, encoding: .utf8) else {
return "()"
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else {
return "()"
}

let descriptionString = String(decoding: descriptionData, as: UTF8.self)
return "\(descriptionString)"
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/ParseSwift/Types/ParseError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ extension ParseError: LocalizedError {
}
}

// MARK:
// MARK: Equatable
extension ParseError: Equatable {
public static func == (lhs: Self, rhs: Self) -> Bool {
lhs.code == rhs.code &&
Expand Down
Loading

0 comments on commit 47b0a3b

Please sign in to comment.