Skip to content

Commit

Permalink
CI: add CI concurrency (#2868)
Browse files Browse the repository at this point in the history
Cancels jobs in process in pull requests only.
  • Loading branch information
nilason committed Mar 4, 2023
1 parent 1a96f69 commit 2161b01
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/additional_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
- main
- releasebranch_*

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
additional-checks:
name: Additional checks
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
- main
- releasebranch_*

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
run-black:
name: Black
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/centos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
- main
- releasebranch_*

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
build:
name: ${{ matrix.os }} build
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
branches:
- main
- releasebranch_*
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
formatting-check:
name: Formatting Check
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
- main
- releasebranch_*

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
flake8:
runs-on: ubuntu-22.04
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
build:
name: ${{ matrix.c }} & ${{ matrix.cpp }}

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}-${{ matrix.c }}-${{ matrix.cpp }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

runs-on: ubuntu-22.04
strategy:
matrix:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
- releasebranch_*
env:
CACHE_NUMBER: 0
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
macos_build:
name: macOS build
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/osgeo4w.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
build:
name: ${{ matrix.os }} build and tests

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}-${{ matrix.os }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
pylint:
name: Pylint ${{ matrix.pylint-version }}

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}-${{ matrix.pylint-version }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

# Using matrix just to get variables which are not environmental variables
# and also to sync with other workflows which use matrix.
strategy:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:

jobs:
pytest:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}-${{ matrix.os }}-${{ matrix.python-version }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

strategy:
matrix:
os:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
- main
- releasebranch_*

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
super-linter:
name: GitHub Super Linter
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jobs:
build-and-test:
name: ${{ matrix.name }} tests

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}-${{ matrix.name }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down

0 comments on commit 2161b01

Please sign in to comment.