Skip to content

Commit 0fa6164

Browse files
webknjazhugovk
andcommitted
✅ Introduce a gate/check GHA job
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, conda, coveragepy, Open edX, Towncrier some of the Ansible repositories, pip-tools, all of the jaraco's projects (like `setuptools`, `importlib_metadata`), some of hynek's projects (like `attrs`, `structlog`), some PyCQA, PyCA, PyPA 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. Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
1 parent d3af83b commit 0fa6164

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/build.yml

+57
Original file line numberDiff line numberDiff line change
@@ -519,3 +519,60 @@ jobs:
519519
run: make pythoninfo
520520
- name: Tests
521521
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
522+
523+
all-required-green: # This job does nothing and is only used for the branch protection
524+
name: All required checks pass
525+
if: always()
526+
527+
needs:
528+
- check_source # Transitive dependency, needed to access `run_tests` value
529+
- check-docs
530+
- check_generated_files
531+
- build_win32
532+
- build_win_amd64
533+
- build_macos
534+
- build_ubuntu
535+
- build_ubuntu_ssltests
536+
- test_hypothesis
537+
- build_asan
538+
539+
runs-on: ubuntu-latest
540+
541+
steps:
542+
- name: Check whether the needed jobs succeeded or failed
543+
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
544+
with:
545+
allowed-failures: >-
546+
build_macos,
547+
build_ubuntu_ssltests,
548+
build_win32,
549+
test_hypothesis,
550+
allowed-skips: >-
551+
${{
552+
!fromJSON(needs.check_source.outputs.run-docs)
553+
&& '
554+
check-docs,
555+
'
556+
|| ''
557+
}}
558+
${{
559+
needs.check_source.outputs.run_tests != 'true'
560+
&& '
561+
check_generated_files,
562+
build_win32,
563+
build_win_amd64,
564+
build_macos,
565+
build_ubuntu,
566+
build_ubuntu_ssltests,
567+
build_asan,
568+
'
569+
|| ''
570+
}}
571+
${{
572+
!fromJSON(needs.check_source.outputs.run_hypothesis)
573+
&& '
574+
test_hypothesis,
575+
'
576+
|| ''
577+
}}
578+
jobs: ${{ toJSON(needs) }}

0 commit comments

Comments
 (0)