Skip to content

Commit

Permalink
🎨🧪 Wire linters into the main CI workflow
Browse files Browse the repository at this point in the history
This patch makes the quality workflow definition into reusable. It
doesn't need to track the same triggers and conditions as the main
one. Additionally, the `alls-green` check can now take into account
the outcome of linting making it possible to only have one job in
the branch protection.
  • Loading branch information
webknjaz committed Jul 12, 2023
1 parent 7a32450 commit 61a4226
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
name: "Quality"

on:
push:
branches:
- master
- nedbat/*
pull_request:
workflow_dispatch:
workflow_call:

defaults:
run:
Expand All @@ -21,10 +16,6 @@ env:
permissions:
contents: read

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
lint:
name: "Pylint etc"
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/testsuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

name: "Tests"

if: >- # Don't run pipeline if the branch name includes "-notests"
!contains(github.ref, '-notests')
on:
push:
branches:
Expand All @@ -28,11 +31,13 @@ concurrency:
cancel-in-progress: true

jobs:
linters:
name: Quality
uses: ./.github/workflows/reusable-quality.yml

tests:
name: "${{ matrix.python-version }} on ${{ matrix.os }}"
runs-on: "${{ matrix.os }}-latest"
# Don't run tests if the branch name includes "-notests"
if: "!contains(github.ref, '-notests')"
strategy:
matrix:
os:
Expand Down Expand Up @@ -91,9 +96,8 @@ jobs:
# https://github.com/orgs/community/discussions/33579
success:
name: Tests successful
# The tests didn't run if the branch name includes "-notests"
if: "!contains(github.ref, '-notests')"
needs:
- linters
- tests
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 61a4226

Please sign in to comment.