Skip to content

Instantly share code, notes, and snippets.

@Lutzifer
Created May 15, 2023 13:31
Show Gist options
  • Save Lutzifer/359b970cf9809554bb4dec1f1fa71bdb to your computer and use it in GitHub Desktop.
Save Lutzifer/359b970cf9809554bb4dec1f1fa71bdb to your computer and use it in GitHub Desktop.
Fastlane Lane to run tests on spm packages
desc "Run Package Tests"
lane :package_tests do
Dir.chdir("..") do
# iterate over packages folder
Dir.glob("packages/*").each do |package|
Dir.chdir(package) do
UI.message("Running tests for #{package}")
begin
%x(xcodebuild -list -quiet -json 2>/dev/null | jq -r '.workspace.schemes[]').split("\n").each do |scheme|
# Use Mac Catalyst to speed up running by an order of magnitude
sh %Q(xcodebuild -scheme #{scheme} test -destination 'platform=macOS,variant=Mac Catalyst')
end
UI.success("Tests for #{package} passed")
rescue
UI.error("Tests for #{package} failed")
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment