splitting runtime sim version from the os version
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -5,15 +5,12 @@ 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 {
|
||||
|
||||
Reference in New Issue
Block a user