Consolidate test CI and add concurrency limits (#3189)

This commit is contained in:
Richard Si 2022-07-28 16:55:36 -04:00 committed by GitHub
parent 411ed778d5
commit ef8deb6d4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 74 deletions

View File

@ -1,4 +1,4 @@
name: Documentation Build name: Documentation
on: [push, pull_request] on: [push, pull_request]

View File

@ -2,6 +2,10 @@ name: Fuzz
on: [push, pull_request] on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions: permissions:
contents: read contents: read

View File

@ -16,7 +16,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up Python - name: Set up latest Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "*" python-version: "*"
@ -27,9 +27,9 @@ jobs:
python -m pip install -e '.[d]' python -m pip install -e '.[d]'
python -m pip install tox python -m pip install tox
- name: Lint - name: Run pre-commit hooks
uses: pre-commit/action@v3.0.0 uses: pre-commit/action@v3.0.0
- name: Run On Self - name: Format ourselves
run: | run: |
tox -e run_self tox -e run_self

View File

@ -11,8 +11,15 @@ on:
- "docs/**" - "docs/**"
- "*.md" - "*.md"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs: jobs:
build: main:
# We want to run on external PRs, but not on our own internal PRs as they'll be run # We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. Without this if check, checks are duplicated since # by the push to the branch. Without this if check, checks are duplicated since
# internal PRs match both the push and pull_request events. # internal PRs match both the push and pull_request events.
@ -35,29 +42,23 @@ jobs:
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install dependencies - name: Install tox
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
python -m pip install --upgrade tox python -m pip install --upgrade tox
- name: Unit tests - name: Unit tests
if: "!startsWith(matrix.python-version, 'pypy')" if: "!startsWith(matrix.python-version, 'pypy')"
run: | run: tox -e ci-py -- -v --color=yes
tox -e ci-py -- -v --color=yes
- name: Unit tests pypy - name: Unit tests (pypy)
if: "startsWith(matrix.python-version, 'pypy')" if: "startsWith(matrix.python-version, 'pypy')"
run: | run: tox -e ci-pypy3 -- -v --color=yes
tox -e ci-pypy3 -- -v --color=yes
- name: Publish coverage to Coveralls - name: Upload coverage to Coveralls
# If pushed / is a pull request against main repo AND # Upload coverage if we are on the main repository and
# we're running on Linux (this action only supports Linux) # we're running on Linux (this action only supports Linux)
if: if: github.repository == 'psf/black' && matrix.os == 'ubuntu-latest'
((github.event_name == 'push' && github.repository == 'psf/black') ||
github.event.pull_request.base.repo.full_name == 'psf/black') && matrix.os ==
'ubuntu-latest'
uses: AndreMiras/coveralls-python-action@v20201129 uses: AndreMiras/coveralls-python-action@v20201129
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
@ -66,17 +67,40 @@ jobs:
debug: true debug: true
coveralls-finish: coveralls-finish:
needs: build needs: main
# If pushed / is a pull request against main repo if: github.repository == 'psf/black'
if:
(github.event_name == 'push' && github.repository == 'psf/black') ||
github.event.pull_request.base.repo.full_name == 'psf/black'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Coveralls finished - name: Send finished signal to Coveralls
uses: AndreMiras/coveralls-python-action@v20201129 uses: AndreMiras/coveralls-python-action@v20201129
with: with:
parallel-finished: true parallel-finished: true
debug: true debug: true
uvloop:
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v3
- name: Set up latest Python
uses: actions/setup-python@v4
with:
python-version: "*"
- name: Install black with uvloop
run: |
python -m pip install pip --upgrade --disable-pip-version-check
python -m pip install -e ".[uvloop]"
- name: Format ourselves
run: python -m black --check src/

View File

@ -1,50 +0,0 @@
name: test uvloop
on:
push:
paths-ignore:
- "docs/**"
- "*.md"
pull_request:
paths-ignore:
- "docs/**"
- "*.md"
permissions:
contents: read
jobs:
build:
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. Without this if check, checks are duplicated since
# internal PRs match both the push and pull_request events.
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: "*"
- name: Install latest pip
run: |
python -m pip install --upgrade pip
- name: Test uvloop Extra Install
run: |
python -m pip install -e ".[uvloop]"
- name: Format ourselves
run: |
python -m black --check src/