CI: use concurrency (#11351)

This commit is contained in:
Jirka Borovec 2022-02-02 20:48:15 +01:00 committed by GitHub
parent 77a9253b04
commit 92c22aedb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 42 additions and 21 deletions

View File

@ -17,6 +17,10 @@ on: # Trigger the workflow on push or pull request, but only for the master bran
- ".github/workflows/events-nightly.yml"
- "setup.py"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
jobs:
build-PL:
runs-on: ubuntu-20.04

View File

@ -7,6 +7,10 @@ on: # Trigger the workflow on push or pull request, but only for the master bra
pull_request:
branches: [master, "release/*"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
jobs:
install:

View File

@ -1,6 +1,6 @@
# this jobs runs `pytest` over the source directory. It does not install any extra dependencies.
# this is useful to catch errors where an import has been added which is not part of the basic dependencies.
name: Test
name: Test simple
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the master branch
@ -9,6 +9,10 @@ on: # Trigger the workflow on push or pull request, but only for the master bra
pull_request:
branches: [master, "release/*"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
jobs:
source:
runs-on: ${{ matrix.os }}
@ -36,16 +40,14 @@ jobs:
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Get pip cache
id: pip-cache
run: |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
run: python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
- name: Cache pip
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-py${{ matrix.python-version }}-${{ matrix.requires }}-
restore-keys: ${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-py${{ matrix.python-version }}-${{ matrix.requires }}-
- name: Install dependencies
run: |
@ -59,14 +61,7 @@ jobs:
- name: Test Package [only]
run: |
coverage run --source pytorch_lightning -m pytest pytorch_lightning -v --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml
- name: Upload pytest test results
uses: actions/upload-artifact@v2
with:
name: pytest-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}
path: junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml
if: failure()
coverage run --source pytorch_lightning -m pytest pytorch_lightning -v
- name: Statistics
if: success()

View File

@ -1,4 +1,4 @@
name: Test
name: Test with Conda
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the master branch
@ -7,6 +7,10 @@ on: # Trigger the workflow on push or pull request, but only for the master bra
pull_request:
branches: [master, "release/*"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
jobs:
conda:
runs-on: ubuntu-20.04

View File

@ -1,4 +1,4 @@
name: Test
name: Test full
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the master branch
@ -8,10 +8,13 @@ on: # Trigger the workflow on push or pull request, but only for the master bra
branches: [master, "release/*"]
types: [opened, reopened, ready_for_review, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
jobs:
cpu:
runs-on: ${{ matrix.os }}
if: github.event.pull_request.draft == false
strategy:
@ -68,8 +71,7 @@ jobs:
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
run: echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v2

View File

@ -1,4 +1,4 @@
name: Test
name: Test slow
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the master branch
@ -7,6 +7,10 @@ on: # Trigger the workflow on push or pull request, but only for the master bra
pull_request:
branches: [master, "release/*"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
jobs:
slow:
runs-on: ${{ matrix.os }}

View File

@ -1,4 +1,4 @@
name: Test
name: Code check
on: # Trigger the workflow on push or pull request, but only for the master branch
push:
@ -6,6 +6,10 @@ on: # Trigger the workflow on push or pull request, but only for the master bra
pull_request:
branches: [master, "release/*"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
jobs:
mypy:
runs-on: ubuntu-20.04

View File

@ -1,4 +1,4 @@
name: Test
name: Check Docs
# https://github.com/marketplace/actions/sphinx-build
on: # Trigger the workflow on push or pull request, but only for the master branch
@ -7,6 +7,10 @@ on: # Trigger the workflow on push or pull request, but only for the master bra
pull_request:
branches: [master, "release/*"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
jobs:
doctest:
runs-on: ubuntu-20.04