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" - ".github/workflows/events-nightly.yml"
- "setup.py" - "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: jobs:
build-PL: build-PL:
runs-on: ubuntu-20.04 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: pull_request:
branches: [master, "release/*"] 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: jobs:
install: install:

View File

@ -1,6 +1,6 @@
# this jobs runs `pytest` over the source directory. It does not install any extra dependencies. # 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. # 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 # 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 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: pull_request:
branches: [master, "release/*"] 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: jobs:
source: source:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -36,16 +40,14 @@ jobs:
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow # https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Get pip cache - name: Get pip cache
id: pip-cache id: pip-cache
run: | run: python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
- name: Cache pip - name: Cache pip
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ${{ steps.pip-cache.outputs.dir }} path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ hashFiles('requirements.txt') }} key: ${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ hashFiles('requirements.txt') }}
restore-keys: | restore-keys: ${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-py${{ matrix.python-version }}-${{ matrix.requires }}-
${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-py${{ matrix.python-version }}-${{ matrix.requires }}-
- name: Install dependencies - name: Install dependencies
run: | run: |
@ -59,14 +61,7 @@ jobs:
- name: Test Package [only] - name: Test Package [only]
run: | run: |
coverage run --source pytorch_lightning -m pytest pytorch_lightning -v --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml coverage run --source pytorch_lightning -m pytest pytorch_lightning -v
- 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()
- name: Statistics - name: Statistics
if: success() 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 # 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 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: pull_request:
branches: [master, "release/*"] 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: jobs:
conda: conda:
runs-on: ubuntu-20.04 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 # 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 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/*"] branches: [master, "release/*"]
types: [opened, reopened, ready_for_review, synchronize] 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: jobs:
cpu: cpu:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
if: github.event.pull_request.draft == false if: github.event.pull_request.draft == false
strategy: strategy:
@ -68,8 +71,7 @@ jobs:
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow # https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Get pip cache dir - name: Get pip cache dir
id: pip-cache id: pip-cache
run: | run: echo "::set-output name=dir::$(pip cache dir)"
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache - name: pip cache
uses: actions/cache@v2 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 # 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 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: pull_request:
branches: [master, "release/*"] 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: jobs:
slow: slow:
runs-on: ${{ matrix.os }} 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 on: # Trigger the workflow on push or pull request, but only for the master branch
push: push:
@ -6,6 +6,10 @@ on: # Trigger the workflow on push or pull request, but only for the master bra
pull_request: pull_request:
branches: [master, "release/*"] 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: jobs:
mypy: mypy:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04

View File

@ -1,4 +1,4 @@
name: Test name: Check Docs
# https://github.com/marketplace/actions/sphinx-build # https://github.com/marketplace/actions/sphinx-build
on: # Trigger the workflow on push or pull request, but only for the master branch 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: pull_request:
branches: [master, "release/*"] 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: jobs:
doctest: doctest:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04