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

Enable testing merge queues @ GitHub Actions CI/CD #1195

Merged
merged 2 commits into from
Oct 27, 2023

Conversation

webknjaz
Copy link
Member

This allows org-hosted projects to start enabling merge queues in the repository settings. With that, GitHub would trigger a separate event against a merge commit derived from merging several pull requests with the target branch.

Summary

$sbj. This is preparatory work for the possibility to enable the merge queues feature, but enabling it can be done through the branch protection settings. I'm starting to roll this out across my repos and I like it so far. If you decide to go ahead and enable it, merge this PR first. Also, uncheck the box saying “don't allow queuing failed PRs” ­— it's useful for cases, when several PRs fix CI failures if only merged together.

Pull Request Check List

  • Added tests for changed code.
    Our CI fails if coverage is not 100%.
  • New features have been added to our Hypothesis testing strategy.
  • Changes or additions to public APIs are reflected in our type stubs (files ending in “.pyi`“.
    • ...and used in the stub test file tests/typing_example.py.
    • If they've been added to attr/__init__.pyi, they've also been re-imported in attrs/__init__.pyi.
  • Updated documentation for changed code.
    • New functions/classes have to be added to docs/api.rst by hand.
    • Changes to the signature of @attr.s() have to be added by hand too.
    • Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives.
      The next version is the second number in the current release + 1.
      The first number represents the current year.
      So if the current version on PyPI is 22.2.0, the next version is gonna be 22.3.0.
      If the next version is the first in the new year, it'll be 23.1.0.
  • Documentation in .rst files is written using semantic newlines.
  • Changes (and possible deprecations) have news fragments in changelog.d.
  • Consider granting push permissions to the PR branch, so maintainers can fix minor issues themselves without pestering you.

This allows org-hosted projects to start enabling merge queues in the
repository settings. With that, GitHub would trigger a separate event
against a merge commit derived from merging several pull requests with
the target branch.
@webknjaz webknjaz added the Meta Issues regarding building, packaging, shipping, ... label Oct 26, 2023
@webknjaz webknjaz requested a review from hynek October 26, 2023 09:46
Copy link
Member

@hynek hynek left a comment

Choose a reason for hiding this comment

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

why not

@hynek hynek merged commit 996672d into python-attrs:main Oct 27, 2023
18 checks passed
@hynek
Copy link
Member

hynek commented Oct 27, 2023

Also, uncheck the box saying “don't allow queuing failed PRs” ­— it's useful for cases, when several PRs fix CI failures if only merged together.

there is no such checkbox
CleanShot 2023-10-27 at 11 05 35@2x

@webknjaz
Copy link
Member Author

@hynek I didn't remember the exact words when I was writing that, but it's this one:
278594323-2c9c5111-3b6b-4983-99d5-3d44755d6436~2.png

@webknjaz
Copy link
Member Author

@hynek I also noticed the RTD integration being required. It does not yet support merge queues. Document your interest here: readthedocs/readthedocs.org#10021.

For now, though, I think it's okay to remove RTD from required checks given that the strict docs build is happening in GHA too.

Let's try merging something soon to test if there's any other blockers. I detected a few in aiohttp, for example: https://github.com/orgs/aio-libs/discussions/27#discussioncomment-7396866. If there's a deal-breaker, you'll need to temporarily disable the feature.

@hynek
Copy link
Member

hynek commented Oct 28, 2023

I have removed RTD but why would I allow merges of failing PRs?

@webknjaz
Copy link
Member Author

Sometimes, there's situations when the CI is broken in several places. Fixing each is a separate PR, but since part of the fixes are in different PRs, each of individual fixes wouldn't be mergeable. Though, when combined, it would result in a green CI. That checkbox stands in the way of achieving this, though.

The ideas behind this are coming from the concept of gating and are essential to having an evergreen main branch: https://gating.dev.

Adding a broken PR to the queue doesn't mean, it'll inevitably end up on the main branch. If the checks for the combined commit fail, GH will drop the PR from the queue.

@hynek
Copy link
Member

hynek commented Oct 28, 2023

I'm sorry but I don't get it (as in: lack imagination for the mechanics in practice). Can you point me to an example of that in practice? That gating.dev page is not very useful unless my ad blocker is hiding something – I knew that computers are good at running tests before. ;)

@webknjaz
Copy link
Member Author

I'll try to come up with a better explanation. But have you seen this illustration
https://bors.tech/essay/2017/02/02/pitch/? Any maybe heard of https://zuul-ci.org? The latter implements this on the huge scale, coming from the OpenStack ecosystem.

@webknjaz
Copy link
Member Author

The gating-based CIs (which the Merge Queues implement) make speculative merges of a bunch of changes into a temporary branch, test it, and if that ends up being green, they fast-forward the main branch to the same commit. This way, main gets exactly what was tested.
But individual PRs run CI at the time of creation/updates so their green or red status indicates the PR state as of time when the main branch might've looked different. With gating, you're guaranteed not to rely on the outdated check reports.

@hynek
Copy link
Member

hynek commented Oct 29, 2023

But have you seen this illustration
https://bors.tech/essay/2017/02/02/pitch/?

That sounds like stacked diffs? 🤔

@webknjaz
Copy link
Member Author

Might be. But the main idea is that this is the workflow to prevent cases of untested code combos from being merged, causing unexpected CI statuses.

@hynek
Copy link
Member

hynek commented Oct 29, 2023

This is a concern I’ve never understood. I’ve set all my projects to that branches have to be up to date before merged. So this is basically a practical simplification of that?

@webknjaz
Copy link
Member Author

Yep. You don't have to force rebasing/merging-in each PR with merge queues. So said setting doesn't make sense anymore, in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Meta Issues regarding building, packaging, shipping, ...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants