stripe-ios/fastlane/Fastfile

209 lines
7.3 KiB
Ruby

# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
default_platform(:ios)
DEFAULT_TEST_DEVICE = 'iPhone 12 mini'.freeze
DEFAULT_TEST_VERSION = '16.1'.freeze
# SPM-using .xcodeproj files can take a while to respond to `showBuildSettings`,
# set Fastlane's timeout to a more reasonable value.
ENV['FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT'] = '60'
platform :ios do
use_cache = false
desc 'Generate new localized screenshots'
lane :screenshots do
capture_screenshots(workspace: 'Stripe.xcworkspace', scheme: 'LocalizationTester')
end
lane :preflight do
Dir.chdir('..') do
sh('./ci_scripts/check_version.rb')
sh('./ci_scripts/check_for_new_localized_strings.sh')
sh('./ci_scripts/check_for_missing_custom_string_convertible.sh')
sh('./ci_scripts/check_spm_warnings.rb')
end
end
lane :build_extras do
Dir.chdir('..') do
sh('rm -rf build-ci-tests')
sh("./ci_scripts/test.rb --build-only --scheme 'Basic Integration'")
sh("./ci_scripts/test.rb --build-only --scheme 'CardImageVerification Example'")
sh("./ci_scripts/test.rb --build-only --scheme 'UI Examples'")
sh("./ci_scripts/test.rb --build-only --scheme 'Non-Card Payment Examples'")
sh("./ci_scripts/test.rb --build-only --scheme 'IntegrationTester'")
sh("./ci_scripts/test.rb --build-only --scheme 'LocalizationTester'")
sh("./ci_scripts/test.rb --build-only --scheme 'PaymentSheet Example'")
sh("./ci_scripts/test.rb --build-only --scheme 'AppClipExample'")
end
end
lane :threeds2_tests do
Dir.chdir('..') do
sh('./stripe3ds2-support/ci_scripts/check_for_new_localized_strings.sh')
sh('./stripe3ds2-support/ci_scripts/run_tests.sh')
sh('./stripe3ds2-support/ci_scripts/run_builds.sh')
sh('./stripe3ds2-support/ci_scripts/run_analyzer.sh')
end
end
lane :stripeios_tests do
Dir.chdir('..') do
sh("./ci_scripts/test.rb --scheme StripeiOS --device '#{DEFAULT_TEST_DEVICE}' --version #{DEFAULT_TEST_VERSION} --retry-on-failure")
end
end
lane :integration_all do
Dir.chdir('..') do
sh("./ci_scripts/test.rb --scheme 'IntegrationTester' --device '#{DEFAULT_TEST_DEVICE}' --version #{DEFAULT_TEST_VERSION} --retry-on-failure")
end
end
private_lane :legacy_tests do |options|
# TODO(bmelts): would be nice to read these from modules.yaml
schemes = %w[StripeiOS StripePayments StripePaymentsUI StripePaymentSheet StripeCameraCore StripeCore StripeUICore StripeApplePay StripeCardScan StripeLinkCore]
Dir.chdir('..') do
schemes.each do |scheme|
sh("./ci_scripts/test.rb --scheme '#{scheme}' --device '#{options[:device]}' --version #{options[:version]} --skip-snapshot-tests --retry-on-failure")
end
end
end
lane :legacy_tests_13 do
legacy_tests(device: 'iPhone 11', version: '13.7')
end
lane :legacy_tests_14 do
legacy_tests(device: 'iPhone 11', version: '14.5')
end
lane :e2e_only do
Dir.chdir('..') do
sh("./ci_scripts/test.rb --scheme 'StripeiOS' --device '#{DEFAULT_TEST_DEVICE}' --version #{DEFAULT_TEST_VERSION} --only-test 'StripeiOS Tests/STPE2ETest' --retry-on-failure")
end
end
lane :analyze do
Dir.chdir('..') do
sh('./ci_scripts/run_analyzer.sh')
end
end
lane :export_builds do
Dir.chdir('..') do
sh('./ci_scripts/export_builds.rb')
end
end
lane :size_report do
Dir.chdir('..') do
sh("bundle exec ruby Tests/installation_tests/size_test/size_report.rb #{ENV['BITRISE_GIT_BRANCH']} master")
unless ENV['EMERGE_API_TOKEN'].nil?
archive_path = Dir.pwd + '/build/size_tests/'
arguments = { repo_name: "#{ENV['BITRISEIO_GIT_REPOSITORY_OWNER']}/#{ENV['BITRISEIO_GIT_REPOSITORY_SLUG']}",
sha: ENV['BITRISE_GIT_COMMIT'].to_s,
build_type: 'release' }
unless ENV['BITRISE_PULL_REQUEST'].nil?
arguments[:pr_number] = ENV['BITRISE_PULL_REQUEST']
arguments[:base_sha] = `git rev-parse master`.to_s
end
emerge(file_path: archive_path + 'Stripe.xcarchive', **arguments)
emerge(file_path: archive_path + 'StripeApplePay.xcarchive', **arguments)
emerge(file_path: archive_path + 'StripeFinancialConnections.xcarchive', **arguments)
emerge(file_path: archive_path + 'StripeIdentity.xcarchive', **arguments)
emerge(file_path: archive_path + 'StripePayments.xcarchive', **arguments)
emerge(file_path: archive_path + 'StripePaymentsUI.xcarchive', **arguments)
emerge(file_path: archive_path + 'StripePaymentSheet.xcarchive', **arguments)
end
end
end
lane :installation_cocoapods_without_frameworks_objc do
Dir.chdir('..') do
sh('./Tests/installation_tests/cocoapods/setup.sh without_frameworks_objc')
end
run_tests(
workspace: './Tests/installation_tests/cocoapods/without_frameworks_objc/CocoapodsTest.xcworkspace',
destination: "platform=iOS Simulator,name=#{DEFAULT_TEST_DEVICE},OS=#{DEFAULT_TEST_VERSION}"
)
end
lane :installation_cocoapods_frameworks_objc do
Dir.chdir('..') do
sh('./Tests/installation_tests/cocoapods/setup.sh with_frameworks_objc')
end
run_tests(
workspace: './Tests/installation_tests/cocoapods/with_frameworks_objc/CocoapodsTest.xcworkspace',
destination: "platform=iOS Simulator,name=#{DEFAULT_TEST_DEVICE},OS=#{DEFAULT_TEST_VERSION}"
)
end
lane :installation_cocoapods_frameworks_swift do
Dir.chdir('..') do
sh('./Tests/installation_tests/cocoapods/setup.sh with_frameworks_swift')
end
run_tests(
workspace: './Tests/installation_tests/cocoapods/with_frameworks_swift/CocoapodsTest.xcworkspace',
destination: "platform=iOS Simulator,name=#{DEFAULT_TEST_DEVICE},OS=#{DEFAULT_TEST_VERSION}"
)
end
lane :installation_carthage do
Dir.chdir('..') do
sh('./Tests/installation_tests/carthage/setup.sh')
end
run_tests(
project: './Tests/installation_tests/carthage/CarthageTest.xcodeproj',
destination: "platform=iOS Simulator,name=#{DEFAULT_TEST_DEVICE},OS=#{DEFAULT_TEST_VERSION}"
)
end
lane :installation_spm_objc do
run_tests(
workspace: './Tests/installation_tests/swift_package_manager/with_objc/SPMTest.xcworkspace',
destination: "platform=iOS Simulator,name=#{DEFAULT_TEST_DEVICE},OS=#{DEFAULT_TEST_VERSION}",
scheme: 'SPMTest'
)
end
lane :installation_spm_swift do
run_tests(
workspace: './Tests/installation_tests/swift_package_manager/with_swift/SPMTest.xcworkspace',
destination: "platform=iOS Simulator,name=#{DEFAULT_TEST_DEVICE},OS=#{DEFAULT_TEST_VERSION}",
scheme: 'SPMTest'
)
end
lane :check_docs do
Dir.chdir('..') do
sh('./ci_scripts/check_documentation.sh')
end
end
lane :objc_symbol_check do
Dir.chdir('..') do
sh('./ci_scripts/objc_bridging_checker.rb')
end
end
lane :check_changelog do
Dir.chdir('..') do
sh('./ci_scripts/check_changelog.rb')
end
end
end