Skip to content

Commit

Permalink
Merge branch 'main' into 352_inflow_properties_additon
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrost-mo committed Jan 15, 2024
2 parents 55536c5 + f4c9b8d commit 3c60533
Show file tree
Hide file tree
Showing 13 changed files with 347 additions and 178 deletions.
121 changes: 0 additions & 121 deletions .github/workflows/pr_ci.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/pre-commit-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git switch -c "pre-commit-$(sha256sum ${{ runner.temp }}/config_file_hashes | head -c 8)"
git switch -c "pre-commit-update"
pre-commit autoupdate --freeze
- name: Create pull requests
Expand All @@ -42,7 +42,7 @@ jobs:
fi
git add .pre-commit-config.yaml
git commit -m "[CI] Update .pre-commit-config.yaml"
git push --set-upstream origin "pre-commit-$(sha256sum ${{ runner.temp }}/config_file_hashes | head -c 8)"
git push --set-upstream origin "pre-commit-update:pre-commit-$(sha256sum .pre-commit-config.yaml | head -c 8)"
# Create PR on GitHub using GitHub CLI.
gh pr create --base main --title "[CI] Update .pre-commit-config.yaml" \
--body "Created automatically by GitHub Actions."
136 changes: 136 additions & 0 deletions .github/workflows/pull_request_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: Pull request checks

on:
pull_request:
push:
branches:
- "main"
workflow_dispatch:

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
py-ver: ["py39", "py310", "py311", "py312"]
steps:
- uses: actions/checkout@v4
- name: Cache conda environment
id: conda-env-cache
uses: actions/cache@v3
with:
key: conda|${{runner.os}}-${{runner.arch}}|${{ hashFiles(format('requirements/locks/{0}-lock-linux-64.txt', matrix.py-ver)) }}
path: ~/conda-env
- name: Create conda environment
if: steps.conda-env-cache.outputs.cache-hit != 'true'
run: |
# Check cache hasn't pulled a partial key match.
test ! -e "${HOME}/conda-env"
conda create --prefix="${HOME}/conda-env" --file=requirements/locks/${{ matrix.py-ver }}-lock-linux-64.txt
- name: Add conda environment to PATH
run: echo "${HOME}/conda-env/bin" >> $GITHUB_PATH
- name: Run tests
env:
PY_COLORS: "1"
run: |
python3 -m pip install -e .
pytest --verbose --cov --cov-append
mv .coverage ".coverage.${{ matrix.py-ver }}"
- uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ matrix.py-ver }}
path: .coverage.*
retention-days: 1

coverage-report:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs: tests
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Get week number for cache
id: week
run: echo "week=$(date '+W%V')" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
key: coverage-report|${{ env.pythonLocation }}|${{ steps.week.outputs.week }}
path: ~/.cache/pip
- name: Install coverage
run: python3 -m pip install coverage
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: coverage-data-*
merge-multiple: true
- name: Generate coverage report
run: |
coverage combine
coverage html
- name: Add report to PR
env:
GH_TOKEN: ${{ github.token }}
run: |
# This links to a hosted version of the HTML report.
tar -czf coverage-report.tar.gz htmlcov/
report_url="$(curl -sSf --data-binary @coverage-report.tar.gz https://tmpweb.net)"
badge_options="$(coverage json --fail-under=0 -qo - | jq -r .totals.percent_covered_display)%25-blue?style=for-the-badge"
echo "[![Coverage](https://img.shields.io/badge/coverage-${badge_options})](${report_url})" >> ${{ runner.temp }}/cov-report.md
# Edit last comment if it exists, else create new one.
if ! gh pr comment --edit-last ${{ github.head_ref }} --body-file ${{ runner.temp }}/cov-report.md ; then
gh pr comment ${{ github.head_ref }} --body-file ${{ runner.temp }}/cov-report.md
fi
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: actions/cache@v3
with:
key: pre-commit|${{runner.os}}-${{runner.arch}}|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
path: ~/.cache/pre-commit
- name: Set up pre-commit
run: python3 -m pip install pre-commit
- uses: actions/checkout@v4
- name: Run pre-commit
run: pre-commit run --show-diff-on-failure --color=always --all-files

build-docs:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache conda environment
id: conda-env-cache
uses: actions/cache@v3
with:
key: conda|${{runner.os}}-${{runner.arch}}|${{hashFiles('requirements/locks/py312-lock-linux-64.txt')}}
path: ~/conda-env
- name: Create conda environment
if: steps.conda-env-cache.outputs.cache-hit != 'true'
run: |
# Check cache hasn't pulled a partial key match.
test ! -e "${HOME}/conda-env"
conda create --prefix="${HOME}/conda-env" --file=requirements/locks/py312-lock-linux-64.txt
- name: Add conda environment to PATH
run: echo "${HOME}/conda-env/bin" >> $GITHUB_PATH
- name: Build documentation with Sphinx
run: |
# Install module so it can be imported during docs generation.
python3 -m pip install .
# Generate the documentation
sphinx-build -d "docs/build/doctree" "docs/source" "docs/build/html" --color -W -bhtml
- name: Upload documentation artifact
uses: actions/upload-artifact@v4
with:
name: html-docs
path: docs/build/html/
retention-days: 10
if-no-files-found: error
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ci:
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: fbe77be689d01fea5a7b64d3c495d4d1ed646852 # frozen: v0.1.11
rev: abe8946973726245279f972c708ebcd6ae0ec272 # frozen: v0.1.13
hooks:
- id: ruff
args: [ --fix, --show-fixes, --exit-non-zero-on-fix ]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
addopts = ["--import-mode=importlib", "--verbose", "--cov", "--cov-append"]
addopts = ["--import-mode=importlib"]
filterwarnings = ['ignore::DeprecationWarning:pytest']
minversion = "7"
pythonpath = ["src"]
Expand Down
24 changes: 12 additions & 12 deletions requirements/locks/py310-lock-linux-64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-2_gnu.tar.bz2#
https://conda.anaconda.org/conda-forge/noarch/fonts-conda-ecosystem-1-0.tar.bz2#fee5683a3f04bd15cbd8318b096a27ab
https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-13.2.0-h807b86a_3.conda#23fdf1fef05baeb7eadc2aed5fb0011f
https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hd590300_5.conda#69b8b6202a07720f448be700e300ccf4
https://conda.anaconda.org/conda-forge/linux-64/c-ares-1.24.0-hd590300_0.conda#f5842b88e9cbfa177abfaeacd457a45d
https://conda.anaconda.org/conda-forge/linux-64/c-ares-1.25.0-hd590300_0.conda#89e40af02dd3a0846c0c1131c5126706
https://conda.anaconda.org/conda-forge/linux-64/fribidi-1.0.10-h36c2ea0_0.tar.bz2#ac7bc6a654f8f41b352b38f4051135f8
https://conda.anaconda.org/conda-forge/linux-64/geos-3.12.1-h59595ed_0.conda#8c0f4f71f5a59ceb0c6fa9f51501066d
https://conda.anaconda.org/conda-forge/linux-64/gettext-0.21.1-h27087fc_0.tar.bz2#14947d8770185e5153fdd04d4673ed37
Expand Down Expand Up @@ -89,7 +89,7 @@ https://conda.anaconda.org/conda-forge/linux-64/python-3.10.13-hd12c33a_1_cpytho
https://conda.anaconda.org/conda-forge/linux-64/sqlite-3.44.2-h2c6b66d_0.conda#4f2892c672829693fd978d065db4e8be
https://conda.anaconda.org/conda-forge/linux-64/udunits2-2.2.28-h40f5838_3.conda#6bb8deb138f87c9d48320ac21b87e7a1
https://conda.anaconda.org/conda-forge/linux-64/xorg-libx11-1.8.7-h8ee46fc_0.conda#49e482d882669206653b095f5206c05b
https://conda.anaconda.org/conda-forge/noarch/alabaster-0.7.13-pyhd8ed1ab_0.conda#06006184e203b61d3525f90de394471e
https://conda.anaconda.org/conda-forge/noarch/alabaster-0.7.16-pyhd8ed1ab_0.conda#def531a3ac77b7fb8c21d17bb5d0badb
https://conda.anaconda.org/conda-forge/noarch/antlr-python-runtime-4.11.1-pyhd8ed1ab_0.tar.bz2#15109c4977d39ad7aa3423f57243e286
https://conda.anaconda.org/conda-forge/linux-64/atk-1.0-2.38.0-hd4edc92_1.tar.bz2#6c72ec3e660a51736913ef6ea68c454b
https://conda.anaconda.org/conda-forge/linux-64/brotli-1.1.0-hd590300_1.conda#f27a24d46e3ea7b70a1f98e50c62508f
Expand All @@ -103,7 +103,7 @@ https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_0.tar.bz
https://conda.anaconda.org/conda-forge/noarch/cycler-0.12.1-pyhd8ed1ab_0.conda#5cd86562580f274031ede6aa6aa24441
https://conda.anaconda.org/conda-forge/noarch/distlib-0.3.8-pyhd8ed1ab_0.conda#db16c66b759a64dc5183d69cc3745a52
https://conda.anaconda.org/conda-forge/linux-64/docutils-0.20.1-py310hff52083_3.conda#c159dcd29bbd80b187b1c5d5f73cc971
https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.2.0-pyhd8ed1ab_0.conda#f6c211fee3c98229652b60a9a42ef363
https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.2.0-pyhd8ed1ab_2.conda#8d652ea2ee8eaee02ed8dc820bc794aa
https://conda.anaconda.org/conda-forge/noarch/filelock-3.13.1-pyhd8ed1ab_0.conda#0c1729b74a8152fde6a38ba0a2ab9f45
https://conda.anaconda.org/conda-forge/linux-64/fontconfig-2.14.2-h14ed4e7_0.conda#0f69b688f52ff6da70bccb7ff7001d1d
https://conda.anaconda.org/conda-forge/noarch/fsspec-2023.12.2-pyhca7485f_0.conda#bf40f2a8835b78b1f91083d306b493d2
Expand Down Expand Up @@ -137,7 +137,7 @@ https://conda.anaconda.org/conda-forge/linux-64/python-xxhash-3.4.1-py310h2372a7
https://conda.anaconda.org/conda-forge/noarch/pytz-2023.3.post1-pyhd8ed1ab_0.conda#c93346b446cd08c169d843ae5fc0da97
https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.1-py310h2372a71_1.conda#bb010e368de4940771368bc3dc4c63e7
https://conda.anaconda.org/conda-forge/linux-64/ruamel.yaml.clib-0.2.7-py310h2372a71_2.conda#7c9da9721ee545d57ad759f020172853
https://conda.anaconda.org/conda-forge/linux-64/ruff-0.1.11-py310h3d77a66_0.conda#7d4a3bee3aa558b54c20c1255c09944b
https://conda.anaconda.org/conda-forge/linux-64/ruff-0.1.13-py310h3d77a66_0.conda#b6c62214a2a02e8e7f132c236c0431a2
https://conda.anaconda.org/conda-forge/noarch/setuptools-69.0.3-pyhd8ed1ab_0.conda#40695fdfd15a92121ed2922900d0308b
https://conda.anaconda.org/conda-forge/noarch/six-1.16.0-pyh6c4a22f_0.tar.bz2#e5f25f8dbc060e9a8d912e432202afc2
https://conda.anaconda.org/conda-forge/noarch/snowballstemmer-2.2.0-pyhd8ed1ab_0.tar.bz2#4d22a9315e78c6827f806065957d566e
Expand All @@ -158,11 +158,11 @@ https://conda.anaconda.org/conda-forge/linux-64/black-23.12.1-py310hff52083_0.co
https://conda.anaconda.org/conda-forge/linux-64/cairo-1.18.0-h3faef2a_0.conda#f907bb958910dc404647326ca80c263e
https://conda.anaconda.org/conda-forge/linux-64/cffi-1.16.0-py310h2fee648_0.conda#45846a970e71ac98fd327da5d40a0a2c
https://conda.anaconda.org/conda-forge/linux-64/coverage-7.4.0-py310h2372a71_0.conda#a7b8039677f4c7d07924a715172acc27
https://conda.anaconda.org/conda-forge/linux-64/fonttools-4.47.0-py310h2372a71_0.conda#27df6604157a2a9e782cbe720f752cf5
https://conda.anaconda.org/conda-forge/linux-64/fonttools-4.47.2-py310h2372a71_0.conda#0688fca50c84de6ff0df1c6440941e0e
https://conda.anaconda.org/conda-forge/linux-64/hdf5-1.14.3-nompi_h4f84152_100.conda#d471a5c3abc984b662d9bae3bb7fd8a5
https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-7.0.1-pyha770c72_0.conda#746623a787e06191d80a2133e5daff17
https://conda.anaconda.org/conda-forge/noarch/isodate-0.6.1-pyhd8ed1ab_0.tar.bz2#4a62c93c1b5c0b920508ae3fd285eaf5
https://conda.anaconda.org/conda-forge/noarch/jinja2-3.1.2-pyhd8ed1ab_1.tar.bz2#c8490ed5c70966d232fdd389d0dbed37
https://conda.anaconda.org/conda-forge/noarch/jinja2-3.1.3-pyhd8ed1ab_0.conda#e7d8df6509ba635247ff9aea31134262
https://conda.anaconda.org/conda-forge/linux-64/libcblas-3.9.0-20_linux64_openblas.conda#36d486d72ab64ffea932329a1d3729a3
https://conda.anaconda.org/conda-forge/linux-64/libgd-2.3.3-h119a65a_9.conda#cfebc557e54905dadc355c0e9f003004
https://conda.anaconda.org/conda-forge/linux-64/liblapack-3.9.0-20_linux64_openblas.conda#6fabc51f5e647d09cc010c40061557e0
Expand All @@ -188,7 +188,7 @@ https://conda.anaconda.org/conda-forge/noarch/tox-3.27.1-pyhd8ed1ab_0.tar.bz2#62
https://conda.anaconda.org/conda-forge/linux-64/ukkonen-1.0.1-py310hd41b1e2_4.conda#35e87277fba9944b8a975113538bb5df
https://conda.anaconda.org/conda-forge/linux-64/cftime-1.6.3-py310h1f7b6fc_0.conda#31beda75384647959d5792a1a7dc571a
https://conda.anaconda.org/conda-forge/linux-64/contourpy-1.2.0-py310hd41b1e2_0.conda#85d2aaa7af046528d339da1e813c3a9f
https://conda.anaconda.org/conda-forge/noarch/dask-core-2023.12.1-pyhd8ed1ab_0.conda#bf6ad72d882bc3f04e6a0fb50fd2cce8
https://conda.anaconda.org/conda-forge/noarch/dask-core-2024.1.0-pyhd8ed1ab_0.conda#cab4cec272dc1e30086f7d32faa4f130
https://conda.anaconda.org/conda-forge/noarch/identify-2.5.33-pyhd8ed1ab_0.conda#93c8f8ceb83827d88deeba796f07fba7
https://conda.anaconda.org/conda-forge/linux-64/mo_pack-0.3.0-py310h2372a71_1.conda#dfcf64f67961eb9686676f96fdb4b4d1
https://conda.anaconda.org/conda-forge/linux-64/pango-1.50.14-ha41ecd1_2.conda#1a66c10f6a0da3dbd2f3a68127e7f6a0
Expand All @@ -207,9 +207,9 @@ https://conda.anaconda.org/conda-forge/noarch/iris-3.7.0-pyha770c72_0.conda#dccc
https://conda.anaconda.org/conda-forge/linux-64/pygraphviz-1.11-py310h31db22a_2.conda#9cb14eb945de9ffe216b547f90d08f64
https://conda.anaconda.org/conda-forge/noarch/sphinx-basic-ng-1.0.0b2-pyhd8ed1ab_1.conda#a631f5c7b7f5045448f966ad71aa2881
https://conda.anaconda.org/conda-forge/noarch/furo-2023.9.10-pyhd8ed1ab_0.conda#0dcfacf6d3e49f2957c69c81356cf892
https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-applehelp-1.0.7-pyhd8ed1ab_0.conda#aebfabcb60c33a89c1f9290cab49bc93
https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-devhelp-1.0.5-pyhd8ed1ab_0.conda#ebf08f5184d8eaa486697bc060031953
https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-htmlhelp-2.0.4-pyhd8ed1ab_0.conda#a9a89000dfd19656ad004b937eeb6828
https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-qthelp-1.0.6-pyhd8ed1ab_0.conda#cf5c9649272c677a964a7313279e3a9b
https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-applehelp-1.0.8-pyhd8ed1ab_0.conda#611a35a27914fac3aa37611a6fe40bb5
https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-devhelp-1.0.6-pyhd8ed1ab_0.conda#d7e4954df0d3aea2eacc7835ad12671d
https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-htmlhelp-2.0.5-pyhd8ed1ab_0.conda#7e1e7437273682ada2ed5e9e9714b140
https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-qthelp-1.0.7-pyhd8ed1ab_0.conda#26acae54b06f178681bfb551760f5dd1
https://conda.anaconda.org/conda-forge/noarch/sphinx-7.2.6-pyhd8ed1ab_0.conda#bbfd1120d1824d2d073bc65935f0e4c0
https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-serializinghtml-1.1.9-pyhd8ed1ab_0.conda#0612e497d7860728f2cda421ea2aec09
https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-serializinghtml-1.1.10-pyhd8ed1ab_0.conda#e507335cb4ca9cff4c3d0fa9cdab255e
Loading

0 comments on commit 3c60533

Please sign in to comment.