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

Introduce a gate/check GHA job #97533

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

webknjaz
Copy link
Contributor

@webknjaz webknjaz commented Sep 24, 2022

This adds a GHA job that reliably determines if all the required dependencies have succeeded or not.

It also allows to reduce the list of required branch protection CI statuses to just one — check. This reduces the maintenance burden by a lot and have been battle-tested across a small bunch of projects in its action form and in-house implementations of other people.

This action is now in use in aiohttp (and other aio-libs projects), CherryPy, some of the Ansible repositories, all of the jaraco's projects (like setuptools, importlib_metadata), some PyCQA, PyCA and pytest projects, a few AWS Labs projects. Admittedly, I maintain a few of these but it seems to address some of the pain folks have: jaraco/skeleton#55 (comment).

I saw a few attempts to reduce the maintenance burden for GHA and figured
this might be useful for CPython too, which is why I'm submitting this patch.
Looking forward to hearing what you think!

The story behind this is explained in more detail at https://github.com/marketplace/actions/alls-green#why.

This adds a GHA job that reliably determines if all the required
dependencies have succeeded or not.

It also allows to reduce the list of required branch protection CI
statuses to just one — `check`. This reduces the maintenance burden
by a lot and have been battle-tested across a small bunch of projects
in its action form and in-house implementations of other people.

This action is now in use in aiohttp (and other aio-libs projects),
CherryPy, some of the Ansible repositories, all of the jaraco's
projects (like `setuptools`, `importlib_metadata`), some PyCQA, PyCA
and pytest projects, a few AWS Labs projects. Admittedly, I maintain
a few of these but it seems to address some of the pain folks have:
jaraco/skeleton#55 (comment).

I figured, this might be useful for CPython too, which is why I'm
submitting this patch.

The story behind this is explained in more detail at
https://github.com/marketplace/actions/alls-green#why.
@@ -116,6 +116,7 @@ jobs:
runs-on: windows-latest
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
continue-on-error: true
Copy link
Contributor Author

@webknjaz webknjaz Sep 24, 2022

Choose a reason for hiding this comment

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

By default, all the jobs listed in the check job's needs section are required to succeed in terms of branch protection. This setting emulates having the job non-required (in combination with the check job below being the only thing required in branch protection).

@@ -317,3 +320,44 @@ jobs:
run: make pythoninfo
- name: Tests
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"

check: # This job does nothing and is only used for the branch protection
if: always()
Copy link
Contributor Author

@webknjaz webknjaz Sep 24, 2022

Choose a reason for hiding this comment

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

This is necessary because otherwise it'll get a skipped status in some cases and the branch protection sees that as skipped == success which is undesired.

- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@198badcb65a1a44528f27d5da555c4be9f12eac6
with:
allowed-skips: >-
Copy link
Contributor Author

@webknjaz webknjaz Sep 24, 2022

Choose a reason for hiding this comment

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

This setting tells the action that if the listed jobs (comma-separated) got skipped, that's okay. But the jobs are allowed to be skipped based on the same condition they've got set. If the first job requests test runs, this list will compute as empty and none of the jobs will be allowed to be skipped (meaning that skips would turn into failures).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants