From aabf17f37c14d8219dfc4a74bf157453b1601f85 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Mon, 27 Apr 2026 12:24:32 +0200 Subject: [PATCH] splitting runtime sim version from the os version --- Tools/Sources/Commands/CI/PreviewTests.swift | 6 ++---- Tools/Sources/Commands/CI/RunTests.swift | 12 ++++++++---- Tools/Sources/Commands/CI/UnitTests.swift | 15 ++++++--------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Tools/Sources/Commands/CI/PreviewTests.swift b/Tools/Sources/Commands/CI/PreviewTests.swift index a97f1067a..dcb288ffd 100644 --- a/Tools/Sources/Commands/CI/PreviewTests.swift +++ b/Tools/Sources/Commands/CI/PreviewTests.swift @@ -5,14 +5,12 @@ struct PreviewTests: AsyncParsableCommand { static let configuration = CommandConfiguration(commandName: "preview-tests", abstract: "Runs the preview test CI workflow, with optional snapshot recording.") - @Option(help: "iOS version for the simulator.") - var osVersion = "26.4" - @Flag(help: "Re-record snapshots for tests that fail or are missing a reference image.") var record = false private static let scheme = "PreviewTests" private static let device = "iPhone SE (3rd generation)" + private static let osVersion = "26.4.1" private static let simulatorType = "com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation" private static let testPlanPath = "PreviewTests/SupportingFiles/PreviewTests.xctestplan" @@ -27,7 +25,7 @@ struct PreviewTests: AsyncParsableCommand { try await RunTests.parse([ "--scheme", Self.scheme, "--device", Self.device, - "--os-version", osVersion, + "--os-version", Self.osVersion, "--create-simulator-name", Self.device, "--create-simulator-type", Self.simulatorType ]).run() diff --git a/Tools/Sources/Commands/CI/RunTests.swift b/Tools/Sources/Commands/CI/RunTests.swift index f07186ac6..8676b9301 100644 --- a/Tools/Sources/Commands/CI/RunTests.swift +++ b/Tools/Sources/Commands/CI/RunTests.swift @@ -21,7 +21,11 @@ struct RunTests: AsyncParsableCommand { var device = "iPhone 17" @Option(help: "The iOS version to use for the simulator runtime (e.g. '26.4').") - var osVersion = "26.4" + var osVersion = "26.4.1" + + var runtime: String { + osVersion.split(separator: ".").prefix(2).joined(separator: ".") + } @Option(help: "Number of times to retry failed tests. Only the failing tests are re-run, not the entire suite.") var retries = 0 @@ -48,7 +52,7 @@ struct RunTests: AsyncParsableCommand { } private var simulatorRuntime: String { - "com.apple.CoreSimulator.SimRuntime.iOS-\(osVersion.replacingOccurrences(of: ".", with: "-"))" + "com.apple.CoreSimulator.SimRuntime.iOS-\(runtime.replacingOccurrences(of: ".", with: "-"))" } func run() async throws { @@ -81,9 +85,9 @@ struct RunTests: AsyncParsableCommand { private func createSimulatorIfNecessary(name: String, type: String) async throws { logger.info("Checking for simulator '\(name)'…") - guard let simulators = try await CI.run(.path("/bin/zsh"), ["-cu", "xcrun simctl list devices \"iOS \(osVersion)\" available"], + guard let simulators = try await CI.run(.path("/bin/zsh"), ["-cu", "xcrun simctl list devices \"iOS \(runtime)\" available"], output: .string(limit: 4096)).standardOutput else { - logger.info("No simulators found for iOS \(osVersion). Creating '\(name)'…") + logger.info("No simulators found for iOS \(runtime). Creating '\(name)'…") try await createSimulator(name: name, type: type) return } diff --git a/Tools/Sources/Commands/CI/UnitTests.swift b/Tools/Sources/Commands/CI/UnitTests.swift index ef83ec783..a881394ee 100644 --- a/Tools/Sources/Commands/CI/UnitTests.swift +++ b/Tools/Sources/Commands/CI/UnitTests.swift @@ -4,16 +4,13 @@ import Foundation struct UnitTests: AsyncParsableCommand { static let configuration = CommandConfiguration(commandName: "unit-tests", abstract: "Runs the unit test CI workflow: lint, unit tests, preview tests, and result collection.") - - @Option(help: "Device name for unit tests.") - var device = "iPhone 17" - - @Option(help: "iOS version for the simulator.") - var osVersion = "26.4.1" - + @Flag(help: "Skip preview tests") var skipPreviews = false + private static let osVersion = "26.4.1" + private static let device = "iPhone 17" + func run() async throws { try await CI.lint() @@ -24,8 +21,8 @@ struct UnitTests: AsyncParsableCommand { logger.info("\n🧪 Running unit tests…\n") try await RunTests.parse([ "--scheme", "UnitTests", - "--device", device, - "--os-version", osVersion, + "--device", Self.device, + "--os-version", Self.osVersion, "--retries", "3" ]).run() } catch {