From 92c22aedb91806378ceb371a3bdeb6fa2ae54605 Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Wed, 2 Feb 2022 20:48:15 +0100 Subject: [PATCH] CI: use concurrency (#11351) --- .github/workflows/ci_dockers.yml | 4 ++++ .github/workflows/ci_pkg-install.yml | 4 ++++ .github/workflows/ci_test-base.yml | 21 ++++++++------------- .github/workflows/ci_test-conda.yml | 6 +++++- .github/workflows/ci_test-full.yml | 10 ++++++---- .github/workflows/ci_test-slow.yml | 6 +++++- .github/workflows/code-checks.yml | 6 +++++- .github/workflows/docs-checks.yml | 6 +++++- 8 files changed, 42 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci_dockers.yml b/.github/workflows/ci_dockers.yml index bd45247e15..13f3148054 100644 --- a/.github/workflows/ci_dockers.yml +++ b/.github/workflows/ci_dockers.yml @@ -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 diff --git a/.github/workflows/ci_pkg-install.yml b/.github/workflows/ci_pkg-install.yml index 0be8b37188..9937a0eb73 100644 --- a/.github/workflows/ci_pkg-install.yml +++ b/.github/workflows/ci_pkg-install.yml @@ -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: diff --git a/.github/workflows/ci_test-base.yml b/.github/workflows/ci_test-base.yml index c2f1d370e2..5a9a2b6666 100644 --- a/.github/workflows/ci_test-base.yml +++ b/.github/workflows/ci_test-base.yml @@ -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() diff --git a/.github/workflows/ci_test-conda.yml b/.github/workflows/ci_test-conda.yml index fa366e645f..0146a90337 100644 --- a/.github/workflows/ci_test-conda.yml +++ b/.github/workflows/ci_test-conda.yml @@ -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 diff --git a/.github/workflows/ci_test-full.yml b/.github/workflows/ci_test-full.yml index a4c4312777..6595c5e7b4 100644 --- a/.github/workflows/ci_test-full.yml +++ b/.github/workflows/ci_test-full.yml @@ -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 diff --git a/.github/workflows/ci_test-slow.yml b/.github/workflows/ci_test-slow.yml index b9a07c4b6a..dcdd16a254 100644 --- a/.github/workflows/ci_test-slow.yml +++ b/.github/workflows/ci_test-slow.yml @@ -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 }} diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml index 8cd4206ab6..a783bdc386 100644 --- a/.github/workflows/code-checks.yml +++ b/.github/workflows/code-checks.yml @@ -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 diff --git a/.github/workflows/docs-checks.yml b/.github/workflows/docs-checks.yml index 841f9128da..29ecd2a358 100644 --- a/.github/workflows/docs-checks.yml +++ b/.github/workflows/docs-checks.yml @@ -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