From 14dc1a8906230747ce8f3edcb88641ac587be968 Mon Sep 17 00:00:00 2001 From: Ludovico Bianchi Date: Fri, 25 Aug 2023 14:23:01 -0500 Subject: [PATCH] Add concurrency group for GHA workflows to avoid redundant runs for PRs (#1115) * Add concurrency group for GHA workflows to avoid redundant runs for PRs * Move globally used pip config flag to env var --- .github/workflows/checks.yml | 22 ++++++++++++++++------ .github/workflows/mpi4py-test.yml | 14 ++++++++++++-- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 68ec3e6530..5e1294a7aa 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -9,6 +9,15 @@ on: pull_request: branches: [main] +concurrency: + # NOTE: the value of `group` should be chosen carefully, + # otherwise we might end up over- or under-canceling workflow runs + # github.head_ref is only defined for pull request events + # so, if it's not present (i.e. event was triggered by push) + # we use github.ref instead + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + defaults: run: # important to make sure that all commands on Windows are run using Bash @@ -19,6 +28,7 @@ env: # --color=yes needed for colorized output to be shown in GHA logs # --pyargs watertap is needed to be able to define CLI options in watertap/conftest.py PYTEST_ADDOPTS: "--color=yes" + PIP_PROGRESS_BAR: "off" jobs: @@ -37,7 +47,7 @@ jobs: # so we extract the relevant line and pass it to a simple `pip install` run: | black_requirement="$(grep '^black==' requirements-dev.txt)" - pip --no-cache-dir install --progress-bar off "$black_requirement" + pip --no-cache-dir install "$black_requirement" - name: Run Black to verify that the committed code is formatted run: | black --check . @@ -53,7 +63,7 @@ jobs: python-version: '3.8' - name: Install dev dependencies run: | - pip install --progress-bar off -r requirements-dev.txt + pip install -r requirements-dev.txt pip list - name: Run pylint run: | @@ -104,7 +114,7 @@ jobs: conda install --quiet --yes pip setuptools wheel pandoc echo '::endgroup::' echo '::group::Output of "pip install" commands' - pip install --progress-bar off -r requirements-dev.txt + pip install -r requirements-dev.txt echo '::endgroup::' echo '::group::Output of "pip install -U ray" command' pip install -U ray @@ -207,7 +217,7 @@ jobs: - name: Install watertap and testing dependencies run: | echo '::group::Output of "pip install" commands' - pip install --progress-bar off "watertap @ ${_install_url}" pytest + pip install "watertap @ ${_install_url}" pytest echo '::endgroup::' echo '::group::Display installed packages' conda list @@ -251,7 +261,7 @@ jobs: conda install --quiet --yes pip setuptools wheel pandoc echo '::endgroup::' echo '::group::Output of "pip install" commands' - pip install --progress-bar off -r requirements-dev.txt + pip install -r requirements-dev.txt echo '::endgroup::' echo '::group::Display installed packages' conda list @@ -286,7 +296,7 @@ jobs: conda install --quiet --yes pip=21.1 wheel setuptools pandoc echo '::endgroup::' echo '::group::Output of "pip install" commands' - pip install --progress-bar off -r requirements-dev.txt + pip install -r requirements-dev.txt echo '::endgroup::' echo '::group::Display installed packages' conda list diff --git a/.github/workflows/mpi4py-test.yml b/.github/workflows/mpi4py-test.yml index 03e1532a6c..cad372cc3c 100644 --- a/.github/workflows/mpi4py-test.yml +++ b/.github/workflows/mpi4py-test.yml @@ -9,10 +9,20 @@ on: pull_request: branches: [main] +concurrency: + # NOTE: the value of `group` should be chosen carefully, + # otherwise we might end up over- or under-canceling workflow runs + # github.head_ref is only defined for pull request events + # so, if it's not present (i.e. event was triggered by push) + # we use github.ref instead + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + env: # --color=yes needed for colorized output to be shown in GHA logs # --pyargs watertap is needed to be able to define CLI options in watertap/conftest.py PYTEST_ADDOPTS: "--color=yes" + PIP_PROGRESS_BAR: "off" jobs: build: @@ -47,8 +57,8 @@ jobs: - name: Install dependencies run: | conda install --quiet --yes -c conda-forge mpi4py - python -m pip install --progress-bar off --upgrade pip - pip install --progress-bar off -r requirements-dev.txt + python -m pip install --upgrade pip + pip install -r requirements-dev.txt idaes get-extensions --verbose - name: Conda info run: conda info