From 8db182af9c82441db838c84314cc8417ff0348ce Mon Sep 17 00:00:00 2001 From: Daniel Saidi Date: Tue, 5 Mar 2024 23:28:44 +0100 Subject: [PATCH] Simplify fastfile --- Fastlane/Fastfile | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/Fastlane/Fastfile b/Fastlane/Fastfile index 43ec1207e..38b8abedc 100644 --- a/Fastlane/Fastfile +++ b/Fastlane/Fastfile @@ -4,21 +4,33 @@ default_platform :ios platform :ios do - library_name = "RichTextKit" + name = "RichTextKit" main_branch = "main" + # Build ================== + + lane :build do |options| + platform = options[:platform] + sh("cd .. && xcodebuild -scheme " + name + " -derivedDataPath .build -destination 'generic/platform=" + platform + "';") + end + + + # Test ================== + + lane :test_ios do + sh("cd .. && xcodebuild test -scheme " + name + " -derivedDataPath .build -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' -enableCodeCoverage YES;") + end + + # Version ================ desc "Create a new version" lane :version do |options| version_validate - bump_type = options[:type] - version = version_bump_podspec( - path: 'Version', - bump_type: bump_type) - + type = options[:type] + version = version_bump_podspec(path: 'Version', bump_type: type) git_commit(path: "*", message: "Bump to #{version}") add_git_tag(tag: version) push_git_tags() @@ -30,12 +42,11 @@ platform :ios do ensure_git_status_clean ensure_git_branch(branch: main_branch) swiftlint(strict: true) - - sh("xcodebuild -scheme " + library_name + " -derivedDataPath .build -destination 'generic/platform=iOS';") - sh("xcodebuild -scheme " + library_name + " -derivedDataPath .build -destination 'generic/platform=OS X';") - sh("xcodebuild -scheme " + library_name + " -derivedDataPath .build -destination 'generic/platform=tvOS';") - sh("xcodebuild -scheme " + library_name + " -derivedDataPath .build -destination 'generic/platform=watchOS';") - sh("xcodebuild test -scheme " + library_name + " -derivedDataPath .build -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' -enableCodeCoverage YES;") + build(platform: "iOS") + build(platform: "OS X") + build(platform: "tvOS") + build(platform: "watchOS") + test_ios end end