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

ci: parellelize tests in CI #238

Merged
merged 14 commits into from
Jan 9, 2025
Merged

ci: parellelize tests in CI #238

merged 14 commits into from
Jan 9, 2025

Conversation

bolinocroustibat
Copy link
Contributor

@bolinocroustibat bolinocroustibat commented Dec 20, 2024

  • Add install step cache fallback

  • Parallelize the execution of tests among 4 CircleCI executors. This results in a gain of an average approx. ~40% on the total CI execution time (around 60% specifically on the tests job)

    • Note 1: For this, we need to deactivate the maximum coverage rule for test success, as each executor reach a different coverage. The gain makes it worth to deactivate this feature, as anyway we can monitor the coverage, and we can activate the minimum coverage threshold when running locally if necessary.
    • Note 2: it has also been tested with 2 executors, 3 executors and 10 executors, but 4 executors seems like a good balance for time gains

Before:
Screenshot 2024-12-20 at 20 32 49

After:
Screenshot 2024-12-20 at 20 32 38

@bolinocroustibat bolinocroustibat marked this pull request as ready for review December 20, 2024 07:48
@bolinocroustibat bolinocroustibat self-assigned this Dec 20, 2024
@bolinocroustibat bolinocroustibat changed the title ci: separate build into smaller steps ci: separate build job into smaller steps Dec 20, 2024
@bolinocroustibat bolinocroustibat force-pushed the simplify-ci branch 4 times, most recently from d3a2281 to 1e2fb0e Compare December 20, 2024 11:01
@bolinocroustibat bolinocroustibat changed the title ci: separate build job into smaller steps ci: parellelize tests in CI and separate build jobs into smaller steps Dec 20, 2024
@bolinocroustibat bolinocroustibat changed the title ci: parellelize tests in CI and separate build jobs into smaller steps ci: parellelize tests in CI Dec 21, 2024
# Conflicts:
#	CHANGELOG.md
Copy link
Contributor

@magopian magopian left a comment

Choose a reason for hiding this comment

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

Nice speedup, well done!

I guess the appropriate number of threads depends on the number of CPUs/cores that are available in a circleCI run?

Would using pytest-xdist make sense to "automate" the parallelization of tests instead of dealing with the executors "manually"?

.circleci/config.yml Outdated Show resolved Hide resolved
@bolinocroustibat
Copy link
Contributor Author

I guess the appropriate number of threads depends on the number of CPUs/cores that are available in a circleCI run?

No, I think each CircleCI executor is a separate execution environment, either a Docker container or a virtual machine. (https://circleci.com/docs/executor-intro/)
I have trouble to find documentation about the maximum number of executors we can use in free tier, but it seems to be at least 10 since I've been trying with 10 with no issue.

Would using pytest-xdist make sense to "automate" the parallelization of tests instead of dealing with the executors "manually"?

Yes, that would also good so that it would run in parallel also locally, but that would mean some tests and code refactoring. This way is easier for now. Also I wonder if CircleCI executors have several CPUs/cores?

@bolinocroustibat bolinocroustibat merged commit 749efeb into main Jan 9, 2025
1 check was pending
@bolinocroustibat bolinocroustibat deleted the simplify-ci branch January 9, 2025 09:01
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.

2 participants