Skip to content

chore(ci): add in cancellations for concurrent builds of the same branch #17915

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

Merged
merged 2 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ on:
env:
DOTTY_CI_RUN: true

concurrency:
# Taken from scalameta/metals
# On main, we don't want any jobs cancelled so the sha is used to name the group
# On PR branches, we cancel the job if new commits are pushed
# You can also bypass that making sure [no cancel] is in your pull request body
group: ${{
((github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags'))
&& format('contributor-pr-base-{0}', github.sha)
|| format('contributor-pr-{0}', github.ref))
&& !contains(github.event.pull_request.body, '[no cancel]')
}}
cancel-in-progress: true

# In this file, we set `--cpu-shares 4096` on every job. This might seem useless
# since it means that every container has the same weight which should be
# equivalent to doing nothing, but it turns out that OpenJDK computes
Expand Down
9 changes: 9 additions & 0 deletions docs/_docs/contributing/sending-in-a-pr.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ Below are commonly used ones:
| `[skip community_build_a]`| Skip the "a" community build |
| `[skip docs]` | Skip the scaladoc tests |

#### Making sure every commit triggers a new run

By default the Dotty CI will cancel your previous runs if you push a new commit.
This helps make sure the CI keeps moving without getting stuck running a ton of
jobs if you push multiple times in a row. _However_, there are times you may
want to run every commit. To do this, make sure your PR body contains `[no
cancel]`. This will ensure that there are no cancellations of your previous
runs.

### 7: Create your PR!

When the feature or fix is completed you should open a [Pull
Expand Down