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

infrastructure: add concurrency cancellation for test/build GitHub Actions #2710

Merged
merged 3 commits into from
Jan 30, 2023

Conversation

aSemy
Copy link
Contributor

@aSemy aSemy commented Oct 13, 2022

I see that in the GitHub Actions the build queue can get 'stacked up' if there are a few smaller commits in quick succession. Since the actions take some time, some small commits can cause the GHA build queue to get congested.

This PR adds a 'concurrency' check for GitHub actions. It means that if a newer trigger comes in (for example, I make two commits in a row on a PR), then the first job will be cancelled, allowing for the new job to run.

This helps save energy, and for faster feedback in PRs.

Docs: https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run

@aSemy aSemy changed the title GitHub Actions: add concurrency cancellation for test/build actions infrastructure: add concurrency cancellation for test/build GitHub Actions Nov 4, 2022
@IgnatBeresnev IgnatBeresnev self-requested a review January 25, 2023 20:10
@@ -2,6 +2,10 @@ name: Check

on: pull_request

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
Copy link
Member

Choose a reason for hiding this comment

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

Having @ and spaces around it is a bit confusing, makes me think it's also some special expression syntax that does something.

In the linked documentation example they don't use spaces and use - instead to connect context variables, which looks more familiar to me

Is there any specific reason to using @?

Copy link
Contributor Author

@aSemy aSemy Jan 30, 2023

Choose a reason for hiding this comment

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

No, there's no specific reason. I copied the format from this example: https://docs.github.com/en/actions/examples/using-concurrency-expressions-and-a-test-matrix

It just makes the string a little prettier

For example:

Canceling since a higher priority waiting request for 'Tests @ aSemy:feat/embedded_static_libs' exists

image

But in practice I never ever look at the computed value. The action gets cancelled, and a new one is triggered. So if you want a different format, then go ahead.

Copy link
Member

Choose a reason for hiding this comment

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

It does indeed make the log messages look more readable 👍 For some reason I thought the group string was an internal thing only

Copy link
Member

@IgnatBeresnev IgnatBeresnev left a comment

Choose a reason for hiding this comment

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

Thank you once again!

@IgnatBeresnev IgnatBeresnev merged commit 6ddd978 into Kotlin:master Jan 30, 2023
atyrin pushed a commit that referenced this pull request Feb 6, 2023
The GitHub Actions build queue can get 'stacked up' if there are a few smaller commits in quick succession. Since the actions take some time, some small commits can cause the GHA build queue to get congested.

This adds a 'concurrency' check for GitHub actions. It means that if a newer trigger comes in (for example, if you make two commits in a row on a PR), then the first job will be cancelled, allowing for the new job to run.

This helps save energy, and for faster feedback in PRs.

Reference docs: https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
@aSemy aSemy deleted the feat/gha_concurrency branch March 4, 2023 13:03
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