Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[action][spm] add parallel option #21665

Merged
merged 3 commits into from Dec 13, 2023

Conversation

bramschulting
Copy link
Contributor

@bramschulting bramschulting commented Nov 24, 2023

I think something is wrong with my local setup, because if I run bundle exec rspec on a clean clone of the fastlane repo on the master branch, I still get some failures: This is resolved. I was using ruby 3.2.2 and with that the tests fail. But I noticed the CI uses 3.1 so I tried again locally with 3.1.2 and now they pass.

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I see several green ci/circleci builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.
  • I've added or updated relevant unit tests.

Motivation and Context

swift test allows parallel testing by passing the --parallel option. This reduces the time it takes to run the tests in a project. (In my case the time drops from 822 seconds to 133 seconds)

Description

A parallel option has been added to the SpmAction action. If this options is set to true and the command is "test", the --parallel flag will be added to the command.

This functionality has been tested by using my local fastlane setup in a real project.

There is one small issue: when the tests are run in parallel, there seems to be no output to fastlane while the tests are running. When the tests complete (either successfully or as a failure), the output is shown. I don't know how to resolve this, so if anyone has an idea, feel free to let me know! But otherwise I think it's a tradeoff users of the parallel flag can make. I suspect the issue is that when running the tests with the --parallel option, output is not 'appended', but there's only one line that's constantly being removed and rewritten. You can see this happening when running swift test --parallel directly.

Testing Steps

Create a lane that uses the spm(command: 'test', parallel: true) action.

@lacostej
Copy link
Collaborator

lacostej commented Dec 1, 2023

Support for ruby 3.2 was just added in CI. It should be resolved now.

Thanks for the contribution!

Copy link
Collaborator

@lacostej lacostej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@bramschulting
Copy link
Contributor Author

@lacostej Happy to contribute after using fastlane for a long time! Is there anything left for me to do to get this merged?

@lacostej
Copy link
Collaborator

@bramschulting one last idea: maybe we could add

spm(command: 'test', parallel: true)

in the example section.

@lacostej lacostej changed the title Add parallel option to spm action [action][spm] add parallel option Dec 11, 2023
@bramschulting
Copy link
Contributor Author

@bramschulting one last idea: maybe we could add

spm(command: 'test', parallel: true)

in the example section.

Good one, done!

Copy link
Member

@rogerluan rogerluan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perrrfect test cases!! Thank you! ❤️

I just made a minor suggestion regarding the action options 😊 I'll go ahead and apply them, and if the tests pass, this should be good to go!

Great contribution! 🙌

fastlane/lib/fastlane/actions/spm.rb Outdated Show resolved Hide resolved
Copy link
Member

@rogerluan rogerluan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

(Just waiting for tests to pass)

@rogerluan rogerluan merged commit 38572a5 into fastlane:master Dec 13, 2023
2 checks passed
@bramschulting
Copy link
Contributor Author

Thanks @lacostej and @rogerluan!

SubhrajyotiSen pushed a commit to KeepTruckin/fastlane that referenced this pull request Jan 17, 2024
* Add parallel option to spm action

* Add parallel test example

* Change boolean option from optional to default false.

---------

Co-authored-by: Roger Oba <rogerluan.oba@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants