Skip to content

Commit

Permalink
Merge pull request #272 from EC-USGS/v1.0.0
Browse files Browse the repository at this point in the history
Release 1.0.0
  • Loading branch information
jmccreight authored Dec 18, 2023
2 parents 8503ca7 + f883c8d commit f773869
Show file tree
Hide file tree
Showing 267 changed files with 8,554 additions and 468,407 deletions.
38 changes: 2 additions & 36 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,10 @@ exclude =
build
dist
examples
# autotest
ignore =
# https://flake8.pycqa.org/en/latest/user/error-codes.html
# F401 # 'module' imported but unused
# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
# continuation line under-indented for hanging indent
E121,
# continuation line missing indentation or outdented
E122,
# continuation line over-indented for hanging indent
E126,
# continuation line over-indented for visual indent
E127,
# continuation line under-indented for visual indent
E128,
# whitespace before
E203,
# multiple spaces before operator
E221,
# multiple spaces after operator
E222,
# missing whitespace around arithmetic operator
E226,
# E231 # missing whitespace after ','
# E241 # multiple spaces after ','
# E402 # module level import not at top of file
# E501 # line too long (> 79 characters)
# E502 # backslash is redundant between brackets
# E722 # do not use bare 'except'
# ambiguous variable name
E741,
# W291 # trailing whitespace
# W292 # no newline at end of file
# W293 # blank line contains whitespace
# blank line at end of file
W391,
# line break before binary operator
W503,
# line break after binary operator
W504,
# space before colon
E203,
statistics = True
2 changes: 1 addition & 1 deletion .github/scripts/symlink_gfortran_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# get full gfortran version string
# assumes installed via brew as by
# https://github.com/awvwgk/setup-fortran
# https://github.com/fortran-lang/setup-fortran
#
# sed not head for first line, avoid ruby broken pipe issues
# (https://stackoverflow.com/a/2845541/6514033)
Expand Down
19 changes: 14 additions & 5 deletions .github/scripts/update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ def get_authors():


def update_version_py(timestamp: datetime, version: Version):
lines = open(_version_py_path, "r").readlines() if _version_py_path.exists() else []
lines = (
open(_version_py_path, "r").readlines()
if _version_py_path.exists()
else []
)
authors = get_authors()
with open(_version_py_path, "w") as f:
f.write(
Expand All @@ -39,13 +43,18 @@ def update_version_py(timestamp: datetime, version: Version):
f.write(f'__version__ = "{version}"\n')
f.writelines(
[
f"__pakname__ = \"{_project_name}\"\n",
f'__pakname__ = "{_project_name}"\n',
"\n",
"author_dict = {\n",
] + [f" \"{a['given-names']} {a['family-names']}\": \"{a['email']}\",\n" for a in authors] + [
]
+ [
f" \"{a['given-names']} {a['family-names']}\": \"{a['email']}\",\n"
for a in authors
]
+ [
"}\n",
"__author__ = \", \".join(author_dict.keys())\n",
"__author_email__ = \", \".join(s for _, s in author_dict.items())\n",
'__author__ = ", ".join(author_dict.keys())\n',
'__author_email__ = ", ".join(s for _, s in author_dict.items())\n',
]
)
f.close()
Expand Down
95 changes: 78 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ on:
- "*"
- "!v[0-9]+.[0-9]+.[0-9]+*"

workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false

jobs:

pyws_setup:
Expand Down Expand Up @@ -101,7 +109,7 @@ jobs:
pylint --jobs=2 --errors-only --exit-zero ./pywatershed ./autotest
test:
name: ${{ matrix.os}} py${{ matrix.python-version }}
name: ${{ matrix.os }} py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
defaults:
run:
Expand All @@ -112,9 +120,14 @@ jobs:
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
python-version: ["3.9", "3.10"]
steps:

- name: Checkout repo
uses: actions/checkout@v3

- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}

- name: Set environment variables
run: |
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
Expand All @@ -134,11 +147,11 @@ jobs:
if [[ "$MF6_REMOTE" != "$req_remote" ]]; then exit 1; fi
- name: Setup gfortran
uses: awvwgk/setup-fortran@main
uses: fortran-lang/setup-fortran@v1
with:
compiler: gcc
version: 11

- name: Link gfortran dylibs on Mac
if: runner.os == 'macOS'
run: .github/scripts/symlink_gfortran_mac.sh
Expand Down Expand Up @@ -174,39 +187,87 @@ jobs:
pip -V
pip list
- name: Run available domains with PRMS and convert csv output to NetCDF
working-directory: test_data/scripts
- name: hru_1 - generate and manage test data domain, run PRMS and convert csv output to NetCDF
working-directory: autotest
run: |
python generate_test_data.py \
-n=auto --domain=hru_1 --remove_prms_csvs --remove_prms_output_dirs
- name: hru_1 - list netcdf input files
working-directory: test_data
run: |
find hru_1/output/ -name '*.nc'
- name: hru_1 - pywatershed tests
working-directory: autotest
run: pytest
-vv
-n=auto
--domain_yaml=../test_data/hru_1/hru_1.yaml
--durations=0
--cov=pywatershed
--cov-report=xml
--junitxml=pytest_hru_1.xml


- name: drb_2yr - generate and manage test data
working-directory: autotest
run: |
python generate_test_data.py \
-n=auto --domain=drb_2yr --remove_prms_csvs --remove_prms_output_dirs
- name: drb_2yr - list netcdf input files
working-directory: test_data
run: |
find drb_2yr/output/ -name '*.nc'
- name: drb_2yr - pywatershed tests
working-directory: autotest
run: pytest
-vv
-n=auto
--domain_yaml=../test_data/drb_2yr/drb_2yr.yaml
--durations=0
--cov=pywatershed
--cov-report=xml
--junitxml=pytest_drb_2yr.xml

- name: ucb_2yr - generate and manage test data
working-directory: autotest
run: |
pytest -v -n=auto --durations=0 test_run_domains.py
pytest -v -n=auto --durations=0 test_nc_domains.py
python generate_test_data.py \
-n=auto --domain=ucb_2yr --remove_prms_csvs --remove_prms_output_dirs
- name: List all NetCDF files in test_data directory
- name: ucb_2yr - list netcdf input files
working-directory: test_data
run: |
find . -name "*.nc"
find ucb_2yr/output/ -name '*.nc'
- name: Run tests
- name: ucb_2yr - pywatershed tests
working-directory: autotest
run: pytest
-v
-vv
-n=auto
--domain_yaml=../test_data/ucb_2yr/ucb_2yr.yaml
--durations=0
--all_domains
--cov=pywatershed
--cov-report=xml
--junitxml=pytest.xml
--junitxml=pytest_ucb_2yr.xml

- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: Test results for ${{ runner.os }}-${{ matrix.python-version }}
path: ./autotest/pytest.xml
path: |
./autotest/pytest_hru_1.xml
./autotest/pytest_drb_2yr.xml
./autotest/pytest_ucb_2yr.xml
- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v2.1.0
uses: codecov/codecov-action@v3
with:
file: ./autotest/coverage.xml
file: ./autotest/coverage.xml # should be just the ucb result
# flags: unittests
env_vars: RUNNER_OS,PYTHON_VERSION
# name: codecov-umbrella
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/ci_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ jobs:
- name: Checkout repo
uses: actions/[email protected]

- name: Install gfortran
uses: modflowpy/install-gfortran-action@v1
- name: Setup gfortran
uses: fortran-lang/setup-fortran@v1
with:
compiler: gcc
version: 11

- name: Download GIS files
working-directory: examples
Expand Down
82 changes: 70 additions & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,41 @@ jobs:
with:
fetch-depth: 0

- name: Setup gfortran
uses: fortran-lang/setup-fortran@v1
with:
compiler: gcc
version: 11

- name: Install Dependencies via Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
cache-environment: true
cache-downloads: true
create-args: >-
python=3.9
python=3.10
conda
- name: Checkout MODFLOW 6
uses: actions/checkout@v3
with:
repository: MODFLOW-USGS/modflow6
ref: master
ref: develop
path: modflow6

- name: Update flopy MODFLOW 6 classes
working-directory: modflow6/autotest
run: |
python update_flopy.py
- name: Set environment variables
run: |
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
echo "PYWS_FORTRAN=true" >> $GITHUB_ENV
echo 'SETUPTOOLS_ENABLE_FEATURES="legacy-editable"' >> $GITHUB_ENV
cat .mf6_ci_ref_remote >> $GITHUB_ENV
- name: Install pywatershed
run: |
pip install .
Expand All @@ -56,27 +69,72 @@ jobs:
pip -V
pip list
- name: Run available domains with PRMS and convert csv output to NetCDF
working-directory: test_data/scripts
- name: hru_1 - generate and manage test data domain, run PRMS and convert csv output to NetCDF
working-directory: autotest
run: |
python generate_test_data.py \
-n=auto --domain=hru_1 --remove_prms_csvs --remove_prms_output_dirs
- name: hru_1 - list netcdf input files
working-directory: test_data
run: |
find hru_1/output/ -name '*.nc'
- name: hru_1 - pywatershed tests
working-directory: autotest
run: pytest
-vv
-n=auto
--domain_yaml=../test_data/hru_1/hru_1.yaml
--durations=0
--cov=pywatershed
--cov-report=xml
--junitxml=pytest_hru_1.xml


- name: drb_2yr - generate and manage test data
working-directory: autotest
run: |
python generate_test_data.py \
-n=auto --domain=drb_2yr --remove_prms_csvs --remove_prms_output_dirs
- name: drb_2yr - list netcdf input files
working-directory: test_data
run: |
find drb_2yr/output/ -name '*.nc'
- name: drb_2yr - pywatershed tests
working-directory: autotest
run: pytest
-vv
-n=auto
--domain_yaml=../test_data/drb_2yr/drb_2yr.yaml
--durations=0
--cov=pywatershed
--cov-report=xml
--junitxml=pytest_drb_2yr.xml

- name: ucb_2yr - generate and manage test data
working-directory: autotest
run: |
pytest -v -n=auto --durations=0 test_run_domains.py
pytest -v -n=auto --durations=0 test_nc_domains.py
python generate_test_data.py \
-n=auto --domain=ucb_2yr --remove_prms_csvs --remove_prms_output_dirs
- name: List all NetCDF files in test_data directory
- name: ucb_2yr - list netcdf input files
working-directory: test_data
run: |
find . -name "*.nc"
find ucb_2yr/output/ -name '*.nc'
- name: Run tests
- name: ucb_2yr - pywatershed tests
working-directory: autotest
run: pytest
-v
-vv
-n=auto
--domain_yaml=../test_data/ucb_2yr/ucb_2yr.yaml
--durations=0
--all_domains
--cov=pywatershed
--cov-report=xml
--junitxml=pytest.xml
--junitxml=pytest_ucb_2yr.xml

- name: Update version
id: version
Expand Down
Loading

0 comments on commit f773869

Please sign in to comment.