Skip to content

Commit

Permalink
Introduce a gate/check GHA job
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
webknjaz committed Jan 6, 2023
1 parent 1d4d677 commit b436563
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ jobs:
runs-on: windows-latest
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
continue-on-error: true
env:
IncludeUwp: 'true'
steps:
Expand Down Expand Up @@ -153,6 +154,7 @@ jobs:
runs-on: macos-latest
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
continue-on-error: true
env:
PYTHONSTRICTEXTENSIONBUILD: 1
steps:
Expand Down Expand Up @@ -232,6 +234,7 @@ jobs:
runs-on: ubuntu-20.04
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
continue-on-error: true
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -318,3 +321,38 @@ 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()

needs:
- check_source # Transitive dependency, needed to access `run_tests` value
- check_generated_files
- build_win32
- build_win_amd64
- build_macos
- build_ubuntu
- build_ubuntu_ssltests
- build_asan

runs-on: ubuntu-latest

steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@13b4244b312e8a314951e03958a2f91519a6a3c9
with:
allowed-skips: >-
${{
needs.check_source.outputs.run_tests == 'true'
&& '
check_generated_files,
build_win32,
build_win_amd64,
build_macos,
build_ubuntu,
build_ubuntu_ssltests,
build_asan,
'
|| ''
}}
jobs: ${{ toJSON(needs) }}

0 comments on commit b436563

Please sign in to comment.