Skip to content

Commit 46d97b5

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 9ffbc58 commit 46d97b5

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/build.yml

+38
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ jobs:
117117
runs-on: windows-latest
118118
needs: check_source
119119
if: needs.check_source.outputs.run_tests == 'true'
120+
continue-on-error: true
120121
env:
121122
IncludeUwp: 'true'
122123
steps:
@@ -153,6 +154,7 @@ jobs:
153154
runs-on: macos-latest
154155
needs: check_source
155156
if: needs.check_source.outputs.run_tests == 'true'
157+
continue-on-error: true
156158
env:
157159
PYTHONSTRICTEXTENSIONBUILD: 1
158160
steps:
@@ -232,6 +234,7 @@ jobs:
232234
runs-on: ubuntu-20.04
233235
needs: check_source
234236
if: needs.check_source.outputs.run_tests == 'true'
237+
continue-on-error: true
235238
strategy:
236239
fail-fast: false
237240
matrix:
@@ -318,3 +321,38 @@ jobs:
318321
run: make pythoninfo
319322
- name: Tests
320323
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
324+
325+
check: # This job does nothing and is only used for the branch protection
326+
if: always()
327+
328+
needs:
329+
- check_source # Transitive dependency, needed to access `run_tests` value
330+
- check_generated_files
331+
- build_win32
332+
- build_win_amd64
333+
- build_macos
334+
- build_ubuntu
335+
- build_ubuntu_ssltests
336+
- build_asan
337+
338+
runs-on: ubuntu-latest
339+
340+
steps:
341+
- name: Decide whether the needed jobs succeeded or failed
342+
uses: re-actors/alls-green@13b4244b312e8a314951e03958a2f91519a6a3c9
343+
with:
344+
allowed-skips: >-
345+
${{
346+
needs.check_source.outputs.run_tests == 'true'
347+
&& '
348+
check_generated_files,
349+
build_win32,
350+
build_win_amd64,
351+
build_macos,
352+
build_ubuntu,
353+
build_ubuntu_ssltests,
354+
build_asan,
355+
'
356+
|| ''
357+
}}
358+
jobs: ${{ toJSON(needs) }}

0 commit comments

Comments
 (0)