Skip to content

Commit

Permalink
Introduce a gate/check GHA job (#4615)
Browse files Browse the repository at this point in the history
* 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.

It is now in use in aiohttp (and other aio-libs projects), CherryPy,
attrs, coveragepy, some of the Ansible repositories, pip-tools,
spaceship-prompt, all of the jaraco's projects (like `setuptools`,
`importlib_metadata`), some PyCQA, PyCA, PyPA and pytest projects, a
few AWS Labs projects.

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

* Stop allowing `test-old-mypy` to fail

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* Fix a typo in "commend"

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
  • Loading branch information
webknjaz and samuelcolvin committed Oct 20, 2022
1 parent 02d4e18 commit da7e6f8
Showing 1 changed file with 49 additions and 20 deletions.
69 changes: 49 additions & 20 deletions .github/workflows/ci.yml
Expand Up @@ -100,6 +100,10 @@ jobs:
DEPS: yes

runs-on: ${{ matrix.os }}-latest

continue-on-error: >-
${{ startsWith(matrix.python-version, '3.11') && true || false }}
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -219,29 +223,54 @@ jobs:
name: coverage-html
path: htmlcov

# FastAPI has a version constraint of pydantic<2.0.0, so we can't run tests, we expect them to break for now anyway
# test-fastapi:
# name: test fastAPI
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
#
# - name: set up python
# uses: actions/setup-python@v4
# with:
# python-version: '3.10'
#
# - name: install
# run: |
# pip install -r requirements/pyproject-all.txt
# pip install .
#
# - name: test
# run: make test-fastapi
test-fastapi:
# FastAPI has a version constraint of pydantic<2.0.0,
# so we can't run tests, we expect them to break for now anyway
# FIXME: drop this comment and the if-clause once that's fixed
if: false
name: test fastAPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: set up python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: install
run: |
pip install -r requirements/pyproject-all.txt
pip install .
- name: test
run: make test-fastapi

# https://github.com/marketplace/actions/alls-green#why
check: # This job does nothing and is only used for the branch protection

if: always()

needs:
- lint
- docs-build
- test
- test-old-mypy
- test-fastapi

runs-on: ubuntu-latest

steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
allowed-skips: test-fastapi # TODO: drop once re-enabled
jobs: ${{ toJSON(needs) }}

deploy:
name: Deploy
needs: [lint, docs-build, test, test-old-mypy] # TODO re-add test-fastapi once fixed
needs:
- check
if: "success() && startsWith(github.ref, 'refs/tags/')"
runs-on: ubuntu-latest

Expand Down

0 comments on commit da7e6f8

Please sign in to comment.