Convert more fastlane tools to swift commands (#5163)

* Upload dSYMs to sentry using swift and the sentry-cli instead of fastlane.

* Replace the fastlane `config_production` lane with a swift tools `ConfigureProduction` command.

* Replace Zsh with CI.run in the new ConfigureNightly command

* Replace the fastlane `tag_nightly` lane with a swift tools `TagNightly` command.

* Print out all the commands going through CI.Run and their arguments

* Address PR comments
This commit is contained in:
Stefan Ceriu
2026-03-05 16:14:09 +02:00
committed by GitHub
parent 51194c09e2
commit e23959a201
10 changed files with 133 additions and 85 deletions
-77
View File
@@ -9,40 +9,6 @@ before_all do
ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = "180"
ENV["FASTLANE_XCODE_LIST_TIMEOUT"] = "180"
ENV["SENTRY_LOG_LEVEL"] = "DEBUG"
end
lane :config_production do
sh("(cd .. && swift run pipeline update-foss-secrets)")
xcodegen(spec: "project.yml")
end
$sentry_retry=0
lane :upload_dsyms_to_sentry do |options|
auth_token = ENV["SENTRY_AUTH_TOKEN"]
UI.user_error!("Invalid Sentry Auth token.") unless !auth_token.to_s.empty?
dsym_path = options[:dsym_path]
UI.user_error!("Invalid DSYM path.") unless !dsym_path.to_s.empty?
begin
sentry_debug_files_upload(
auth_token: auth_token,
org_slug: 'element',
project_slug: 'element-x-ios',
url: 'https://sentry.tools.element.io/',
path: dsym_path,
)
rescue => exception
$sentry_retry += 1
if $sentry_retry <= 5
UI.message "Sentry failed, retrying."
upload_dsyms_to_sentry options
else
raise exception
end
end
end
lane :release_to_github do
@@ -126,22 +92,6 @@ def rebase_main_onto_current_branch
UI.success("Successfully rebased main onto #{current_branch}")
end
lane :tag_nightly do |options|
build_number = options[:build_number]
UI.user_error!("Invalid build number.") unless !build_number.to_s.empty?
xcodegen_project_file_path = "../project.yml"
data = YAML.load_file xcodegen_project_file_path
current_version = data["settings"]["MARKETING_VERSION"]
setup_git()
tag_name = "nightly/#{current_version}.#{build_number}"
sh("git tag #{tag_name}")
git_push(tag_name: tag_name)
end
private_lane :setup_git do
sh("git config --global user.name 'Element CI'")
sh("git config --global user.email 'ci@element.io'")
@@ -171,30 +121,3 @@ private_lane :bump_build_number do
build_number = Time.now.strftime("%Y%m%d%H%M")
increment_build_number(build_number: build_number)
end
private_lane :create_simulator_if_necessary do |options|
simulator_name = options[:name]
UI.user_error!("Invalid simulator name") unless !simulator_name.to_s.empty?
simulator_type = options[:type]
UI.user_error!("Invalid simulator type") unless !simulator_type.to_s.empty?
simulator_runtime = "com.apple.CoreSimulator.SimRuntime.iOS-#{simulator_version.gsub('.', '-')}"
simulators = sh("xcrun simctl list devices \"iOS #{simulator_version}\" available")
# Use a `(` here to avoid matching `iPhone 14 Pro` on `iPhone 14 Pro Max` for example
existing_simulator = simulators.lines.find { |line| line.include?("#{simulator_name} (") }
if existing_simulator
UI.message("Found simulator: #{existing_simulator.inspect}")
device_id = existing_simulator.match(/\(([A-F0-9-]+)\)/)[1] # Extract the device ID for the existing simulator
else
UI.message "Simulator #{simulator_name} not found. Creating new simulator…"
create_command = "xcrun simctl create '#{simulator_name}\' #{simulator_type} #{simulator_runtime}"
device_id = sh(create_command).strip # Create a new simulator and get its device ID.
UI.message "Created new simulator: #{simulator_name} (#{device_id})"
end
# device_id is unused right now but is useful to check e.g. the boot status of a simulator.
end
-1
View File
@@ -3,7 +3,6 @@
# Ensure this file is checked in to source control!
gem 'fastlane-plugin-xcodegen'
gem 'fastlane-plugin-sentry'
gem 'fastlane-plugin-xcconfig'
# Until Fastlane includes them directly.