diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 0390663..0c35de1 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -1,13 +1,62 @@ skip_docs +devices = { + "ios" => { + 13 => ["iPhone 11 (13.7)", "iPad Pro (9.7-inch) (13.7)"], + 14 => ["iPhone 12 (14.5)", "iPad Pro (9.7-inch) (14.5)"], + 15 => ["iPhone SE (3rd generation) (15.5)", "iPad Air (5th generation) (15.5)",], + 16 => ["iPhone 14 (16.4)", "iPad Pro (11-inch) (4th generation) (16.4)"], + }, + "tvos" => { + 13 => ["Apple TV (13.4)"], + 14 => ["Apple TV (14.5)"], + 15 => ["Apple TV (15.4)"], + 16 => ["Apple TV (16.4)"], + }, +} + +lane :build do |options| + platform = options[:platform].to_s + version = options[:version].to_i + scheme = options[:scheme].to_s + + unless scheme == "Showcase" + raise "Unsupported scheme: #{scheme}" + next + end + + if platform == "macos" + for destination in ["platform=macOS", "platform=macOS,variant=Mac Catalyst"] + build_app( + scheme: scheme, + destination: destination, + skip_archive: true, + skip_codesigning: true, + skip_package_ipa: true, + skip_profile_detection: true, + ) + end + else + run_tests( + configuration: "Debug", + build_for_testing: true, + scheme: scheme, + devices: devices[platform][version], + prelaunch_simulator: false, + ensure_devices_found: true, + force_quit_simulator: true, + disable_concurrent_testing: true, + ) + end +end + lane :test do |options| configuration = (options[:configuration] || "Debug").to_s platform = options[:platform].to_s version = options[:version].to_i scheme = options[:scheme].to_s - case platform - when "macos" + if platform == "macos" case scheme when "Introspect" spm( @@ -33,64 +82,15 @@ lane :test do |options| else raise "Unsupported scheme: #{scheme}" end - next # skip the rest of the lane - when "ios" - devices = case version - when 13 - [ - "iPhone 11 (13.7)", - "iPad Pro (9.7-inch) (13.7)", - ] - when 14 - [ - "iPhone 12 (14.5)", - "iPad Pro (9.7-inch) (14.5)", - ] - when 15 - [ - "iPhone SE (3rd generation) (15.5)", - "iPad Air (5th generation) (15.5)", - ] - when 16 - [ - "iPhone 14 (16.4)", - "iPad Pro (11-inch) (4th generation) (16.4)", - ] - else - raise "Unsupported iOS version: #{version}" - end - when "tvos" - devices = case version - when 13 - [ - "Apple TV (13.4)", - ] - when 14 - [ - "Apple TV (14.5)", - ] - when 15 - [ - "Apple TV (15.4)", - ] - when 16 - [ - "Apple TV (16.4)", - ] - else - raise "Unsupported tvOS version: #{version}" - end else - raise "Unsupported platform: #{platform}" + run_tests( + configuration: configuration, + scheme: scheme, + devices: devices[platform][version], + prelaunch_simulator: true, + ensure_devices_found: true, + force_quit_simulator: true, + disable_concurrent_testing: true, + ) end - - run_tests( - configuration: configuration, - scheme: scheme, - devices: devices, - prelaunch_simulator: true, - ensure_devices_found: true, - force_quit_simulator: true, - disable_concurrent_testing: true, - ) end