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

Add concurrency control to run-tests and run-crt-test workflows #3413

Merged

Conversation

arandito
Copy link
Contributor

@arandito arandito commented Mar 3, 2025

This PR adds concurrency control to the run-tests and run-crt-test GitHub Actions workflows.

Problem Description

Currently, when multiple commits are pushed to the same branch in succession, the run-tests and run-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 and run-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 the develop and master branches, where all pushed commits should continue triggering run-tests and run-crt-test.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@@ -8,6 +8,10 @@ on:
permissions:
contents: read

concurrency:
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@jonathan343 jonathan343 Mar 4, 2025

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') }}

Copy link
Contributor Author

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-commenter
Copy link

codecov-commenter commented Mar 4, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.99%. Comparing base (6300f6b) to head (b55f840).
Report is 46 commits behind head on develop.

❗ 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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@jonathan343 jonathan343 left a comment

Choose a reason for hiding this comment

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

🚢

@jonathan343 jonathan343 merged commit 262d682 into boto:develop Mar 7, 2025
40 checks passed
aws-sdk-python-automation added a commit that referenced this pull request Mar 7, 2025
* 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)
hswong3i pushed a commit to alvistack/boto-botocore that referenced this pull request Mar 9, 2025
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