|
| 1 | +--- |
| 2 | +date: 2025-04-24 |
| 3 | +decision-makers: ["@thomass-dev"] |
| 4 | +--- |
| 5 | + |
| 6 | +# Use merge queue in CI |
| 7 | + |
| 8 | +## Context and Problem Statement |
| 9 | + |
| 10 | +With external contributions related to ESOC, the number of pull-request is growing fast. |
| 11 | +The `main` branch has a particular restriction `Require branches to be up to date before |
| 12 | +merging`. It ensures that pull requests have been tested with the latest code. |
| 13 | + |
| 14 | +Even if it is a good practice, it begins to have an impact on maintainers velocity. It |
| 15 | +implies updating each pull request after any modification to the `main` branch. |
| 16 | + |
| 17 | +## Decision Outcome |
| 18 | + |
| 19 | +We decide to add a merge queue to the `main` branch. |
| 20 | + |
| 21 | +https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue |
| 22 | + |
| 23 | +> A merge queue helps increase velocity by automating pull request merges into a busy |
| 24 | +> branch and ensuring the branch is never broken by incompatible changes. |
| 25 | +> |
| 26 | +> The merge queue provides the same benefits as the *Require branches to be up to date* |
| 27 | +> before merging branch protection, but does not require a pull request author to update |
| 28 | +> their pull request branch and wait for status checks to finish before trying to merge. |
| 29 | +> |
| 30 | +> Using a merge queue is particularly useful on branches that have a relatively high |
| 31 | +> number of pull requests merging each day from many different users. |
| 32 | +> |
| 33 | +> Once a pull request has passed all required branch protection checks, a user with |
| 34 | +> write access to the repository can add the pull request to the queue. The merge queue |
| 35 | +> will ensure the pull request's changes pass all required status checks when applied to |
| 36 | +> the latest version of the target branch and any pull requests already in the queue. |
| 37 | +
|
| 38 | +### Consequences |
| 39 | + |
| 40 | +We have to made some changes to prepare the setup of the GH merge queue, for which we |
| 41 | +need to specify the jobs required to succeed (and not global workflows unfortunately). |
| 42 | + |
| 43 | +For a job to be required, its workflow must be executed and not skipped. Currently, we |
| 44 | +skip entire workflow via path filtering to avoid unnecessary calculations, which is |
| 45 | +incompatible with "required jobs". Thus, we have to change this behaviour to always |
| 46 | +execute workflows, but skip jobs individually based on modified files. |
| 47 | + |
| 48 | +https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks |
| 49 | + |
| 50 | +To avoid specifying every required job individually, we have to implement "all-green" |
| 51 | +jobs that centralize the results of entire workflows, success or fail. Only these jobs |
| 52 | +will be marked as required. Thus, they must combine the results of backend linting, |
| 53 | +backend testing, PR title linting, documentation building etc. |
| 54 | + |
| 55 | +Please note that a previous experience (before forks) with a master "ci-all-green" can't |
| 56 | +be reproduced: the chain `workflow -> workflow_call -> workflow_run` is not triggered. |
| 57 | + |
| 58 | +## More Information |
| 59 | + |
| 60 | +Implementation in pull-request [#1514](https://github.com/probabl-ai/skore/pull/1514). |
0 commit comments