Skip to content

Commit 46004d0

Browse files
committed
✅ 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.
1 parent a136163 commit 46004d0

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/build.yml

+48
Original file line numberDiff line numberDiff line change
@@ -362,3 +362,51 @@ jobs:
362362
run: make pythoninfo
363363
- name: Tests
364364
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
365+
366+
all-required-green: # This job does nothing and is only used for the branch protection
367+
name: ✅ All required checks pass
368+
if: always()
369+
370+
needs:
371+
- check_source # Transitive dependency, needed to access `run_tests` value
372+
- check-docs
373+
- check_generated_files
374+
- build_win32
375+
- build_win_amd64
376+
- build_macos
377+
- build_ubuntu
378+
- build_ubuntu_ssltests
379+
- build_asan
380+
381+
runs-on: ubuntu-latest
382+
383+
steps:
384+
- name: Decide whether the needed jobs succeeded or failed
385+
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
386+
with:
387+
allowed-failures: >-
388+
build_macos,
389+
build_ubuntu_ssltests,
390+
build_win32,
391+
allowed-skips: >-
392+
${{
393+
fromJSON(needs.check_source.outputs.run-docs)
394+
&& '
395+
check-docs,
396+
'
397+
|| ''
398+
}}
399+
${{
400+
needs.check_source.outputs.run_tests == 'true'
401+
&& '
402+
check_generated_files,
403+
build_win32,
404+
build_win_amd64,
405+
build_macos,
406+
build_ubuntu,
407+
build_ubuntu_ssltests,
408+
build_asan,
409+
'
410+
|| ''
411+
}}
412+
jobs: ${{ toJSON(needs) }}

0 commit comments

Comments
 (0)