Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Experimental] Transition to Xcode 14.3 #1783

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ce189d7
Upgraded Nimble for compatibility with Xcode 14.3
maratal Jul 4, 2023
6f7cf23
Excluded watchOS from Makefile
maratal Jul 8, 2023
9b31fe5
Updated EXCLUDED_ARCHS in carthage workaround script for Xcode 14
maratal Jul 8, 2023
5fb8f1c
Explicit switch to macOS 13 and Xcode 14.2
maratal Jul 8, 2023
e337bdd
Updated workflows for Xcode 14.3
maratal Jul 8, 2023
ba76c50
Explicit switch to macOS 13 and Xcode 14.3
maratal Jul 8, 2023
94f71bc
Set unique timeout value to check if it waits here.
maratal Aug 31, 2023
4875be9
Revert "Set unique timeout value to check if it waits here."
maratal Aug 31, 2023
2294ca2
Passing error reason to auth cancel block.
maratal Sep 1, 2023
4f9a52c
Set default error in case of empty original error.
maratal Sep 1, 2023
cde3197
Added temporary error for closed connection.
maratal Sep 1, 2023
488d614
Pass artificial error for all states.
maratal Sep 1, 2023
207f35f
Fix message for "test__056...".
maratal Sep 1, 2023
87bf8a1
Changed local error message.
maratal Sep 1, 2023
0434824
Pass artificial error in cancelAuthorization.
maratal Sep 1, 2023
1fe30b5
Revert "Pass artificial error in cancelAuthorization."
maratal Sep 1, 2023
fcec6f4
Pass artificial error in cancelationEventEmitter.
maratal Sep 1, 2023
e686fb6
Pass artificial error in from other places.
maratal Sep 1, 2023
5a3472d
Revert "Pass artificial error in from other places."
maratal Sep 2, 2023
b94d363
Pass error from ARTAuthDelegate.ARTRealtimeDisconnected event.
maratal Sep 2, 2023
9a6a77a
Added assert messages.
maratal Sep 2, 2023
0b81033
Increased ttl of a token.
maratal Sep 2, 2023
f62c85b
Increased ttl of a token in all failed tests.
maratal Sep 2, 2023
dd7aaa2
Revert "Fix message for "test__056..."."
maratal Sep 2, 2023
a96ad05
Increased waiting timeout.
maratal Sep 2, 2023
0c103a5
Increased waiting timeout more.
maratal Sep 2, 2023
50eb198
Play with ttl time.
maratal Sep 2, 2023
e8ca835
Reverted ttl and timeout.
maratal Sep 2, 2023
245d77a
Made "test__081..." similar to "test__080..." and do what its title s…
maratal Sep 8, 2023
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
6 changes: 3 additions & 3 deletions .github/workflows/check-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ on:

jobs:
check:
runs-on: macos-latest
runs-on: macos-13
steps:
- uses: actions/checkout@v2

- name: Select Specific Xcode Version (13.4.1)
- name: Select Specific Xcode Version (14.3)
run: |
sudo xcode-select -s /Applications/Xcode_13.4.1.app
sudo xcode-select -s /Applications/Xcode_14.3.app
echo "Selected Xcode version:"
xcodebuild -version

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
build:
runs-on: macos-latest
runs-on: macos-13

permissions:
deployments: write
Expand All @@ -19,9 +19,9 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Select Specific Xcode Version
- name: Select Specific Xcode Version (14.3)
run: |
sudo xcode-select -s /Applications/Xcode_13.2.app
sudo xcode-select -s /Applications/Xcode_14.3.app
echo "Selected Xcode version:"
xcodebuild -version

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Integration Test: iOS 16.2"
name: "Integration Test: iOS 16.4"

on:
pull_request:
Expand All @@ -12,7 +12,7 @@ on:

jobs:
check:
runs-on: macos-latest
runs-on: macos-13

env:
LC_CTYPE: en_US.UTF-8
Expand All @@ -22,6 +22,12 @@ jobs:
steps:
- name: Check out SDK repo
uses: actions/checkout@v2

- name: Select Specific Xcode Version (14.3)
run: |
sudo xcode-select -s /Applications/Xcode_14.3.app
echo "Selected Xcode version:"
xcodebuild -version

- name: Log environment information
run: ./Scripts/log-environment-information.sh
Expand Down Expand Up @@ -54,7 +60,7 @@ jobs:
make submodules
bundle install
make update_carthage_dependencies_ios
bundle exec fastlane test_iOS16_2
bundle exec fastlane test_iOS16_4

- name: Check Static Analyzer Output
id: analyzer-output
Expand All @@ -70,15 +76,15 @@ jobs:
if: ${{ failure() && steps.analyzer-output.outcome == 'failure' }}
uses: actions/upload-artifact@v2
with:
name: static-analyzer-reports-test_iOS16_2
name: static-analyzer-reports-test_iOS16_4
path: ./derived_data/**/report-*.html

- name: Run Examples Tests
working-directory: ./Examples/Tests
run: |
pod repo update
pod install
bundle exec fastlane scan -s Tests --output-directory "fastlane/test_output/examples/test_iOS16_2"
bundle exec fastlane scan -s Tests --output-directory "fastlane/test_output/examples/test_iOS16_4"

- name: Build APNS Example Project
working-directory: ./Examples/AblyPush
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Integration Test: macOS Latest"
name: "Integration Test: macOS 13"

on:
pull_request:
Expand All @@ -12,7 +12,7 @@ on:

jobs:
check:
runs-on: macos-latest
runs-on: macos-13

env:
LC_CTYPE: en_US.UTF-8
Expand All @@ -22,6 +22,12 @@ jobs:
steps:
- name: Check out SDK repo
uses: actions/checkout@v2

- name: Select Specific Xcode Version (14.3)
run: |
sudo xcode-select -s /Applications/Xcode_14.3.app
echo "Selected Xcode version:"
xcodebuild -version

- name: Log environment information
run: ./Scripts/log-environment-information.sh
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Integration Test: tvOS 16.1"
name: "Integration Test: tvOS 16.4"

on:
pull_request:
Expand All @@ -12,7 +12,7 @@ on:

jobs:
check:
runs-on: macos-latest
runs-on: macos-13

env:
LC_CTYPE: en_US.UTF-8
Expand All @@ -22,6 +22,12 @@ jobs:
steps:
- name: Check out SDK repo
uses: actions/checkout@v2

- name: Select Specific Xcode Version (14.3)
run: |
sudo xcode-select -s /Applications/Xcode_14.3.app
echo "Selected Xcode version:"
xcodebuild -version

- name: Log environment information
run: ./Scripts/log-environment-information.sh
Expand Down Expand Up @@ -54,7 +60,7 @@ jobs:
make submodules
bundle install
make update_carthage_dependencies_tvos
bundle exec fastlane test_tvOS16_1
bundle exec fastlane test_tvOS16_4

- name: Check Static Analyzer Output
id: analyzer-output
Expand All @@ -70,15 +76,15 @@ jobs:
if: ${{ failure() && steps.analyzer-output.outcome == 'failure' }}
uses: actions/upload-artifact@v2
with:
name: static-analyzer-reports-test_tvOS16_1
name: static-analyzer-reports-test_tvOS16_4
path: ./derived_data/**/report-*.html

- name: Run Examples Tests
working-directory: ./Examples/Tests
run: |
pod repo update
pod install
bundle exec fastlane scan -s Tests --output-directory "fastlane/test_output/examples/test_tvOS_16_1"
bundle exec fastlane scan -s Tests --output-directory "fastlane/test_output/examples/test_tvOS_16_4"

- name: Xcodebuild Logs Artifact
if: always()
Expand Down
2 changes: 1 addition & 1 deletion Cartfile.private
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "Quick/Nimble" == 9.2.1
github "Quick/Nimble" == 11.2.2
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "Quick/Nimble" "v9.2.1"
github "Quick/Nimble" "v11.2.2"
github "ably/delta-codec-cocoa" "1.3.3"
github "rvi/msgpack-objective-C" "0.4.0"
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ carthage_package:

# https://github.com/Carthage/Carthage#archive-prebuilt-frameworks-into-one-zip-file
# From `carthage help build` we are told that `--archive` implies `--no-skip-current`.
./Scripts/carthage-with-workaround-for-issue-3019.sh build --archive --no-use-binaries
./Scripts/carthage-with-workaround-for-issue-3019.sh build --archive --no-use-binaries --platform iOS,macOS,tvOS
# Add LICENSE files (ours and SocketRocket’s).
./Scripts/add-licenses-to-carthage-output.sh

Expand All @@ -105,7 +105,7 @@ carthage_clean:
update_carthage_dependencies:
$(info Updating Carthage dependencies for all platforms…)

carthage update --use-xcframeworks --no-use-binaries
carthage update --use-xcframeworks --platform iOS,macOS,tvOS --no-use-binaries

## [Carthage] Update dependencies for just iOS
update_carthage_dependencies_ios:
Expand Down
4 changes: 2 additions & 2 deletions Scripts/carthage-with-workaround-for-issue-3019.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ trap 'rm -f "$xcconfig"' INT TERM HUP EXIT

# For Xcode 13 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
# the build will fail on lipo due to duplicate architectures.
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1300 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_arm64__XCODE_1300 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1400 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_arm64__XCODE_1400 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig

export XCODE_XCCONFIG_FILE="$xcconfig"
Expand Down
12 changes: 7 additions & 5 deletions Source/ARTAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams

NSString *authorizeId = [[NSUUID new] UUIDString];
__block BOOL hasBeenExplicitlyCanceled = NO;
__block ARTErrorInfo *explicitlyCanceledError = nil;
// Request always a new token
ARTLogVerbose(self.logger, @"RS:%p ARTAuthInternal [authorize.%@, delegate=%@]: requesting new token", _rest, authorizeId, lastDelegate ? @"YES" : @"NO");
NSObject<ARTCancellable> *task;
Expand All @@ -587,10 +588,10 @@ - (void)authorize:(ARTTokenParams *)tokenParams
}
};

void (^const canceledCallbackBlock)(void) = ^{
void (^const canceledCallbackBlock)(NSError *) = ^(NSError *error) {
ARTLogVerbose(self.logger, @"RS:%p ARTAuthInternal [authorize.%@]: canceled callback", self->_rest, authorizeId);
if (callback) {
callback(nil, [ARTErrorInfo createWithCode:kCFURLErrorCancelled message:@"Authorization has been canceled"]);
callback(nil, error ?: [ARTErrorInfo createWithCode:kCFURLErrorCancelled message:@"Authorization has been canceled."]);
}
};

Expand All @@ -601,7 +602,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams
}

if (hasBeenExplicitlyCanceled) {
canceledCallbackBlock();
canceledCallbackBlock(explicitlyCanceledError);
return;
}

Expand All @@ -618,7 +619,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams
switch (state) {
case ARTAuthorizationSucceeded:
if (hasBeenExplicitlyCanceled) {
canceledCallbackBlock();
canceledCallbackBlock(explicitlyCanceledError);
return;
}
successCallbackBlock();
Expand All @@ -631,7 +632,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams
break;
case ARTAuthorizationCancelled: {
ARTLogDebug(self.logger, @"RS:%p authorization cancelled but the request token has already completed", self->_rest);
canceledCallbackBlock();
canceledCallbackBlock(error);
break;
}
}
Expand All @@ -644,6 +645,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams

[_cancelationEventEmitter once:^(ARTErrorInfo * _Nullable error) {
hasBeenExplicitlyCanceled = YES;
explicitlyCanceledError = [ARTErrorInfo createWithCode:kCFURLErrorCancelled message:@"Authorization has been canceled.."];
[task cancel];
}];

Expand Down
8 changes: 4 additions & 4 deletions Source/ARTRealtime.m
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ - (void)auth:(ARTAuthInternal *)auth didAuthorize:(ARTTokenDetails *)tokenDetail
completion(ARTAuthorizationFailed, [ARTErrorInfo createWithCode:ARTStateAuthorizationFailed message:@"Connection has been closed"]);
break;
case ARTRealtimeDisconnected:
completion(ARTAuthorizationCancelled, nil);
completion(ARTAuthorizationCancelled, error);
break;
case ARTRealtimeInitialized:
case ARTRealtimeConnecting:
Expand Down Expand Up @@ -650,7 +650,7 @@ - (ARTEventListener *)performTransitionWithStateChange:(ARTConnectionStateChange
_connection.id = nil;
_transport = nil;
self.rest.prioritizedHost = nil;
[self.auth cancelAuthorization:nil];
[self.auth cancelAuthorization:stateChange.reason ?: [ARTErrorInfo createWithCode:kCFURLErrorUnknown message:@"Connection was closed."]];
[self failPendingMessages:[ARTStatus state:ARTStateError info:[ARTErrorInfo createWithCode:ARTErrorConnectionClosed message:@"connection broken before receiving publishing acknowledgment"]]];
break;
case ARTRealtimeFailed: {
Expand All @@ -659,7 +659,7 @@ - (ARTEventListener *)performTransitionWithStateChange:(ARTConnectionStateChange
errorInfo:status.errorInfo];
[self abortAndReleaseTransport:status];
self.rest.prioritizedHost = nil;
[self.auth cancelAuthorization:stateChange.reason];
[self.auth cancelAuthorization:stateChange.reason ?: [ARTErrorInfo createWithCode:kCFURLErrorUnknown message:@"Connection was failed."]];
[self failPendingMessages:[ARTStatus state:ARTStateError info:[ARTErrorInfo createWithCode:ARTErrorConnectionFailed message:@"connection broken before receiving publishing acknowledgment"]]];
break;
}
Expand Down Expand Up @@ -699,7 +699,7 @@ - (ARTEventListener *)performTransitionWithStateChange:(ARTConnectionStateChange
case ARTRealtimeSuspended: {
[_connectionRetryFromDisconnectedListener stopTimer];
_connectionRetryFromDisconnectedListener = nil;
[self.auth cancelAuthorization:nil];
[self.auth cancelAuthorization:stateChange.reason ?: [ARTErrorInfo createWithCode:kCFURLErrorUnknown message:@"Connection was suspended."]];
[self closeAndReleaseTransport];
[stateChange setRetryIn:self.options.suspendedRetryTimeout];
stateChangeEventListener = [self unlessStateChangesBefore:stateChange.retryIn do:^{
Expand Down
2 changes: 1 addition & 1 deletion Test/Tests/AuthTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3740,7 +3740,7 @@ class AuthTests: XCTestCase {
realtime.auth.authorize(callback)
}

expect(didCancelAuthorization).to(be(true))
XCTAssertTrue(didCancelAuthorization)
XCTAssertTrue(realtime.auth.tokenDetails === tokenDetailsLast)
XCTAssertEqual(realtime.auth.tokenDetails?.token, tokenDetailsLast?.token)

Expand Down
31 changes: 24 additions & 7 deletions Test/Tests/RealtimeClientChannelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ class RealtimeClientChannelTests: XCTestCase {
}

expect(channel1.internal.presenceMap.members).toEventually(haveCount(2), timeout: testTimeout)
expect(channel1.internal.presenceMap.members.keys).to(allPass { $0!.hasPrefix("\(channel1.internal.connectionId):Client") || $0!.hasPrefix("\(channel2.internal.connectionId):Client") })
expect(channel1.internal.presenceMap.members.values).to(allPass { $0!.action == .present })
expect(channel1.internal.presenceMap.members.keys).to(allPass { $0.hasPrefix("\(channel1.internal.connectionId):Client") || $0.hasPrefix("\(channel2.internal.connectionId):Client") })
expect(channel1.internal.presenceMap.members.values).to(allPass { $0.action == .present })

expect(channel2.internal.presenceMap.members).toEventually(haveCount(2), timeout: testTimeout)
expect(channel2.internal.presenceMap.members.keys).to(allPass { $0!.hasPrefix("\(channel1.internal.connectionId):Client") || $0!.hasPrefix("\(channel2.internal.connectionId):Client") })
expect(channel2.internal.presenceMap.members.keys).to(allPass { $0.hasPrefix("\(channel1.internal.connectionId):Client") || $0.hasPrefix("\(channel2.internal.connectionId):Client") })
XCTAssertEqual(channel2.internal.presenceMap.members["\(channel1.internal.connectionId):Client 1"]!.action, ARTPresenceAction.present)
XCTAssertEqual(channel2.internal.presenceMap.members["\(channel2.internal.connectionId):Client 2"]!.action, ARTPresenceAction.present)
}
Expand Down Expand Up @@ -501,7 +501,7 @@ class RealtimeClientChannelTests: XCTestCase {
func test__011__Channel__EventEmitter__channel_states_and_events__ChannelStateChange_will_contain_a_resumed_boolean_attribute_with_value__true__if_the_bit_flag_RESUMED_was_included() throws {
let test = Test()
let options = try AblyTests.commonAppSetup(for: test)
options.tokenDetails = try getTestTokenDetails(for: test, ttl: 5.0)
options.tokenDetails = try getTestTokenDetails(for: test, ttl: 15.0)
let client = ARTRealtime(options: options)
defer { client.dispose(); client.close() }
let channel = client.channels.get(test.uniqueChannelName())
Expand Down Expand Up @@ -993,7 +993,7 @@ class RealtimeClientChannelTests: XCTestCase {
func test__016__Channel__connection_state__if_the_connection_state_enters_the_DISCONNECTED_state__it_will_have_no_effect_on_the_channel_states() throws {
let test = Test()
let options = try AblyTests.commonAppSetup(for: test)
options.token = try getTestToken(for: test, ttl: 5.0)
options.token = try getTestToken(for: test, ttl: 15.0)
let client = ARTRealtime(options: options)
defer { client.dispose(); client.close() }

Expand Down Expand Up @@ -2449,9 +2449,26 @@ class RealtimeClientChannelTests: XCTestCase {
let test = Test()
try beforeEach__Channel__publish__Connection_state_conditions__the_message(for: test, channelName: test.uniqueChannelName())

rtl6c2TestsClient.connect()
expect(rtl6c2TestsClient.connection.state).toEventually(equal(ARTRealtimeConnectionState.connected), timeout: testTimeout)
expect(rtl6c2TestsChannel.state).toEventually(equal(ARTRealtimeChannelState.attached), timeout: testTimeout)

waitUntil(timeout: testTimeout) { done in
rtl16c2TestsPublish(done)
XCTAssertEqual(rtl6c2TestsClient.internal.queuedMessages.count, 0)
XCTAssertEqual((rtl6c2TestsClient.internal.transport as! TestProxyTransport).protocolMessagesSent.filter { $0.action == .message }.count, 1)
}

afterEach__Channel__publish__Connection_state_conditions__the_message()
}

func skip_test__081__Channel__publish__Connection_state_conditions__the_message__should_NOT_be_queued_instead_it_should_be_published_if_the_channel_is__ATTACHED() throws {
let test = Test()
try beforeEach__Channel__publish__Connection_state_conditions__the_message(for: test, channelName: test.uniqueChannelName())

waitUntil(timeout: testTimeout) { done in
rtl6c2TestsChannel.attach { error in
XCTAssertNil(error)
XCTAssertNil(error, "Attach failed.")
done()
}
rtl6c2TestsClient.connect()
Expand All @@ -2461,7 +2478,7 @@ class RealtimeClientChannelTests: XCTestCase {
let tokenParams = ARTTokenParams()
tokenParams.ttl = 5.0
rtl6c2TestsClient.auth.authorize(tokenParams, options: nil) { tokenDetails, error in
XCTAssertNil(error)
XCTAssertNil(error, "Authorize failed.")
XCTAssertNotNil(tokenDetails)
done()
}
Expand Down
Loading
Loading