default_platform(:ios) deliverfile_path = File.expand_path("Deliverfile", __dir__) load(deliverfile_path) if File.exist?(deliverfile_path) platform :ios do private_lane :release_context do { project: "velocity.xcodeproj", scheme: ENV.fetch("VELOCITY_IOS_SCHEME", "velocity"), app_identifier: "com.desineuron.velocity.ipad", configuration: ENV.fetch("VELOCITY_IOS_CONFIGURATION", "Release"), output_directory: ENV.fetch("VELOCITY_IOS_OUTPUT_DIR", "build/fastlane"), derived_data_path: ENV.fetch("VELOCITY_IOS_DERIVED_DATA", "build/DerivedData"), device: ENV.fetch("VELOCITY_IOS_TEST_DEVICE", "iPad Pro (12.9-inch) (6th generation)") } end private_lane :testflight_metadata do metadata = defined?(VelocityAppStoreConnectMetadata) ? VelocityAppStoreConnectMetadata : nil UI.user_error!("fastlane/Deliverfile must define VelocityAppStoreConnectMetadata.") unless metadata { groups: metadata.testflight_groups, beta_app_review_info: metadata.beta_app_review_info, localized_build_info: metadata.localized_build_info, localized_app_info: metadata.localized_app_info } end desc "Fetch or create Apple Distribution certificate through fastlane cert" lane :certificates do cert( development: false, force: ENV["FASTLANE_FORCE_CERT"] == "1", output_path: "fastlane/certs" ) end desc "Fetch or create App Store provisioning profile through fastlane sigh" lane :profiles do ctx = release_context sigh( app_identifier: ctx[:app_identifier], adhoc: false, skip_install: false, force: ENV["FASTLANE_FORCE_PROFILE"] == "1", filename: "Velocity_iPad_AppStore.mobileprovision", output_path: "fastlane/profiles" ) end desc "Run unit and UI tests for the iPad app" lane :tests do ctx = release_context scan( project: ctx[:project], scheme: ctx[:scheme], devices: [ctx[:device]], clean: true, derived_data_path: ctx[:derived_data_path], result_bundle: true, output_directory: "#{ctx[:output_directory]}/test-results", output_types: "html,junit", include_simulator_logs: true, fail_build: true ) end desc "Build the iPad app and upload it to TestFlight" lane :beta do ctx = release_context metadata = testflight_metadata certificates profiles tests build_app( project: ctx[:project], scheme: ctx[:scheme], configuration: ctx[:configuration], clean: true, export_method: "app-store", output_directory: ctx[:output_directory], output_name: "Velocity-iPad.ipa", derived_data_path: ctx[:derived_data_path], include_symbols: true, include_bitcode: false, xcargs: [ "DEVELOPMENT_TEAM=#{ENV.fetch("FASTLANE_TEAM_ID", "L29922NHD9")}", "PRODUCT_BUNDLE_IDENTIFIER=#{ctx[:app_identifier]}" ].join(" ") ) pilot( ipa: "#{ctx[:output_directory]}/Velocity-iPad.ipa", app_identifier: ctx[:app_identifier], skip_waiting_for_build_processing: ENV.fetch("FASTLANE_SKIP_WAITING", "false") == "true", distribute_external: ENV.fetch("FASTLANE_DISTRIBUTE_EXTERNAL", "1") == "1", notify_external_testers: ENV["FASTLANE_NOTIFY_EXTERNAL_TESTERS"] == "1", groups: metadata[:groups], beta_app_review_info: metadata[:beta_app_review_info], localized_app_info: metadata[:localized_app_info], localized_build_info: metadata[:localized_build_info], beta_app_feedback_email: metadata[:localized_app_info]["default"][:feedback_email], beta_app_description: metadata[:localized_app_info]["default"][:description], demo_account_required: true, uses_non_exempt_encryption: false, changelog: metadata[:localized_build_info]["default"][:whats_new] ) end end