Skip to content

Commit

Permalink
Add concurrency group for GHA workflows to avoid redundant runs for P…
Browse files Browse the repository at this point in the history
…Rs (watertap-org#1115)

* Add concurrency group for GHA workflows to avoid redundant runs for PRs

* Move globally used pip config flag to env var
  • Loading branch information
lbianchi-lbl authored Aug 25, 2023
1 parent f26c13b commit 14dc1a8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:

Expand All @@ -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 .
Expand All @@ -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: |
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/mpi4py-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 14dc1a8

Please sign in to comment.