-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add concurrency control to run-tests and run-crt-test workflows #3413
Add concurrency control to run-tests and run-crt-test workflows #3413
Conversation
@@ -8,6 +8,10 @@ on: | |||
permissions: | |||
contents: read | |||
|
|||
concurrency: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why not use something like in this example from GitHub?
https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/control-the-concurrency-of-workflows-and-jobs#example-only-cancel-in-progress-jobs-on-specific-branches
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine something like the following would work?
cancel-in-progress: ${{ !contains(github.ref, 'develop') && !contains(github.ref, 'master') }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially implemented it that way, but during testing, I found that cancel-in-progress
does not fully prevent all job cancellations. By default, the concurrency
feature allows for at most one running job and one pending job per concurrency group (see GitHub docs).
For example, if two pushes occur in quick succession, one job runs while the other remains pending. A third push cancels the pending job and replaces it. Enabling cancel-in-progress
changes this behavior by allowing only one running job at a time, with no pending jobs. If set to false
, concurrency
behaves as expected by default.
To fully prevent job cancellations in develop
and master
, each run needs a unique concurrency group based on github.run_id
. This ensures that every run is isolated and does not cancel in-progress jobs regardless of the value of cancel-in-progress
. For other branches, the group remains branch-specific, limiting concurrency to one running job per branch at a time.
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## develop #3413 +/- ##
===========================================
+ Coverage 92.94% 92.99% +0.04%
===========================================
Files 66 67 +1
Lines 14956 15036 +80
===========================================
+ Hits 13901 13982 +81
+ Misses 1055 1054 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
* release-1.37.9: Bumping version to 1.37.9 Update endpoints model Update to latest models Add concurrency control to run-tests and run-crt-test workflows (#3413)
This PR adds concurrency control to the
run-tests
andrun-crt-test
GitHub Actions workflows.Problem Description
Currently, when multiple commits are pushed to the same branch in succession, the
run-tests
andrun-crt-test
workflows are triggered for each push. This results in excessive use of GitHub Actions minutes as it's only necessary to run the workflows for the most recent push within a pull request.Solution in This PR
This PR adds concurrency control to the
run-tests
andrun-crt-test
runners to cancel in-progress jobs when new commits are pushed to the same branch. Only the latest push will now trigger the workflows. However, this behavior does not apply to thedevelop
andmaster
branches, where all pushed commits should continue triggeringrun-tests
andrun-crt-test
.