Switch to Xcode 15 (with the iOS 16.4 Simulator for tests still) (#2113)

* Use Xcode 15 in GitHub actions.

Use iOS 16.4 simulators from Xcode 14 as iOS 17.0.1 simulators are **super** slow.

* Fix failing preview snapshots.

Snapshot fix.

* Improve setup

* Regenerate snapshots that had a conflict.

---------

Co-authored-by: Alfonso Grillo <alfogrillo@gmail.com>
This commit is contained in:
Doug 2023-11-21 16:25:18 +00:00 committed by GitHub
parent 390bf08bab
commit d03c97a02a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
68 changed files with 163 additions and 134 deletions

View File

@ -38,6 +38,13 @@ jobs:
- name: SwiftFormat
run:
swiftformat --lint .
- name: Link to 16.4 Simulators
run: |
echo "Creating Runtimes folder if needed..."
sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes
echo "Creating symlink of the iOS 16.4 runtime..."
sudo ln -s /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ 16.4.simruntime
- name: Run tests
run: bundle exec fastlane unit_tests

View File

@ -21,6 +21,7 @@ import XCTest
@MainActor
class AudioPlayerStateTests: XCTestCase {
static let audioDuration = 10.0
private var audioPlayerState: AudioPlayerState!
private var audioPlayerMock: AudioPlayerMock!
@ -48,8 +49,11 @@ class AudioPlayerStateTests: XCTestCase {
override func setUp() async throws {
audioPlayerActionsSubject = .init()
audioPlayerSeekCallsSubject = .init()
audioPlayerState = AudioPlayerState(id: .timelineItemIdentifier(.random), duration: 10.0)
audioPlayerState = AudioPlayerState(id: .timelineItemIdentifier(.random), duration: Self.audioDuration)
audioPlayerMock = buildAudioPlayerMock()
audioPlayerMock.seekToClosure = { [weak self] progress in
self?.audioPlayerMock.currentTime = Self.audioDuration * progress
}
}
func testAttach() async throws {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
Adopt Xcode 15 (sticking with iOS 16 simulator on CI).

View File

@ -3,7 +3,7 @@ require 'semantic'
require_relative 'changelog'
before_all do
xcversion(version: "~> 14.3")
xcversion(version: "~> 15.0")
ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = "180"
ENV["FASTLANE_XCODE_LIST_TIMEOUT"] = "180"
@ -76,6 +76,12 @@ lane :alpha do
end
lane :unit_tests do
create_simulator_if_necessary(
name: "iPhone 14 (16.4)",
type: "com.apple.CoreSimulator.SimDeviceType.iPhone-14",
runtime: "com.apple.CoreSimulator.SimRuntime.iOS-16-4"
)
run_tests(
scheme: "UnitTests",
device: 'iPhone 14 (16.4)',
@ -97,9 +103,16 @@ lane :ui_tests do |options|
# Use a fresh simulator state to ensure hardware keyboard isn't attached.
reset_simulator_contents()
create_simulator_if_necessary(
name: "iPhone 14 (16.4)",
type: "com.apple.CoreSimulator.SimDeviceType.iPhone-14",
runtime: "com.apple.CoreSimulator.SimRuntime.iOS-16-4"
)
create_simulator_if_necessary(
name: "iPad (9th generation)",
type: "com.apple.CoreSimulator.SimDeviceType.iPad-9th-generation"
type: "com.apple.CoreSimulator.SimDeviceType.iPad-9th-generation",
runtime: "com.apple.CoreSimulator.SimRuntime.iOS-16-4"
)
if options[:test_name]
@ -141,7 +154,8 @@ lane :integration_tests do
create_simulator_if_necessary(
name: "iPhone 14 Pro",
type: "com.apple.CoreSimulator.SimDeviceType.iPhone-14-Pro"
type: "com.apple.CoreSimulator.SimDeviceType.iPhone-14-Pro",
runtime: "com.apple.CoreSimulator.SimRuntime.iOS-16-4"
)
run_tests(
@ -411,13 +425,16 @@ private_lane :create_simulator_if_necessary do |options|
simulator_type = options[:type]
UI.user_error!("Invalid simulator type") unless !simulator_type.to_s.empty?
simulator_runtime = options[:runtime]
UI.user_error!("Invalid simulator runtime") unless !simulator_runtime.to_s.empty?
# Use use a `(` here to avoid matching `iPhone 14 Pro` on `iPhone 14 Pro Max` for example
# Use a `(` here to avoid matching `iPhone 14 Pro` on `iPhone 14 Pro Max` for example
begin sh("xcrun simctl list devices | grep '#{simulator_name} ('")
UI.success "Simulator already exists"
rescue
sh("xcrun simctl create '#{simulator_name}' #{simulator_type}")
sh("xcrun simctl create '#{simulator_name}' #{simulator_type} #{simulator_runtime}")
end
end