Skip to content

Commit

Permalink
add IPRN value in example input files, refactor generate_classes test…
Browse files Browse the repository at this point in the history
…s without pytest-virtualenv (fall back to virtualenv directly), remove scripts/pull_request_prepare.py (prep for ruff to replace other linting/formatting tools in subsequent PR)
  • Loading branch information
wpbonelli committed Nov 13, 2023
1 parent 77369b1 commit 7631f4b
Show file tree
Hide file tree
Showing 19 changed files with 224 additions and 817 deletions.
40 changes: 3 additions & 37 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ 3.8, 3.9, "3.10", "3.11" ]
python-version: [ 3.8, 3.9, "3.10", "3.11", "3.12" ]
exclude:
# avoid shutil.copytree infinite recursion bug
# https://github.com/python/cpython/pull/17098
Expand All @@ -27,56 +27,23 @@ jobs:
uses: actions/checkout@v4

- name: Setup Python
if: runner.os != 'Windows'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install Python dependencies
if: runner.os != 'Windows'
run: |
pip install --upgrade pip
pip install .
pip install ".[test, optional]"
- name: Setup Micromamba
if: runner.os == 'Windows'
uses: mamba-org/setup-micromamba@v1
with:
environment-file: etc/environment.yml
cache-environment: true
cache-downloads: true
create-args: >-
python=${{ matrix.python-version }}
init-shell: >-
bash
powershell
- name: Install extra Python dependencies
if: runner.os == 'Windows'
shell: bash -l {0}
run: |
pip install xmipy
pip install .
- name: Install Modflow executables
uses: modflowpy/install-modflow-action@v1

- name: Run benchmarks
if: runner.os != 'Windows'
working-directory: ./autotest
run: |
mkdir -p .benchmarks
pytest -v --durations=0 --benchmark-only --benchmark-json .benchmarks/${{ matrix.os }}_python${{ matrix.python-version }}.json --keep-failed=.failed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run benchmarks
if: runner.os == 'Windows'
shell: bash -l {0}
working-directory: ./autotest
working-directory: autotest
run: |
mkdir -p .benchmarks
pytest -v --durations=0 --benchmark-only --benchmark-json .benchmarks/${{ matrix.os }}_python${{ matrix.python-version }}.json --keep-failed=.failed
Expand Down Expand Up @@ -115,7 +82,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.12
cache: 'pip'
cache-dependency-path: pyproject.toml

Expand Down Expand Up @@ -151,7 +118,6 @@ jobs:
fi
python ./scripts/process_benchmarks.py ./autotest/.benchmarks ./autotest/.benchmarks
env:
ARTIFACTS: ${{steps.run_tests.outputs.artifact_ids}}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload benchmark results
Expand Down
64 changes: 17 additions & 47 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ jobs:
python -c "import flopy; print(f'{flopy.__version__}')"
- name: Build package
run: |
python -m build
run: python -m build

- name: Check package
run: |
twine check --strict dist/*
run: twine check --strict dist/*

lint:
name: Lint
Expand Down Expand Up @@ -135,13 +134,13 @@ jobs:
if: failure()
with:
name: failed-smoke-${{ runner.os }}-${{ env.PYTHON_VERSION }}
path: ./autotest/.failed/**
path: autotest/.failed/**

- name: Upload coverage
if: github.repository_owner == 'modflowpy' && (github.event_name == 'push' || github.event_name == 'pull_request')
uses: codecov/codecov-action@v3
with:
files: ./autotest/coverage.xml
files: autotest/coverage.xml

test:
name: Test
Expand All @@ -158,40 +157,25 @@ jobs:
- python-version: '3.8.0'
defaults:
run:
shell: bash
shell: bash -l {0}
timeout-minutes: 45
steps:

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

- name: Setup Python
if: runner.os != 'Windows'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install Python dependencies
if: runner.os != 'Windows'
run: |
pip install --upgrade pip
pip install .
pip install ".[test, optional]"
- name: Setup Micromamba
if: runner.os == 'Windows'
uses: mamba-org/setup-micromamba@v1
with:
environment-file: etc/environment.yml
cache-environment: true
cache-downloads: true
create-args: >-
python=${{ matrix.python-version }}
init-shell: >-
bash
powershell
pip install ".[test,optional]"
- name: Install Modflow-related executables
uses: modflowpy/install-modflow-action@v1
Expand All @@ -201,30 +185,17 @@ jobs:
with:
repo: modflow6-nightly-build

- name: Update FloPy packages
if: runner.os != 'Windows'
- name: Update package classes
run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup

- name: Update FloPy packages
if: runner.os == 'Windows'
shell: bash -l {0}
run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup

- name: Run tests
if: runner.os != 'Windows'
working-directory: ./autotest
run: |
pytest -v -m="not example and not regression" -n=auto --cov=flopy --cov-append --cov-report=xml --durations=0 --keep-failed=.failed --dist loadfile
coverage report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests
if: runner.os == 'Windows'
shell: bash -l {0}
working-directory: ./autotest
working-directory: autotest
run: |
pytest -v -m="not example and not regression" -n=auto --cov=flopy --cov-append --cov-report=xml --durations=0 --keep-failed=.failed --dist loadfile
m="not example and not regression"
if [[ "${{ matrix.python-version}}" == "3.12" ]]; then
m="$m and not generation"
fi
pytest -v -m="$m" -n=auto --cov=flopy --cov-append --cov-report=xml --durations=0 --keep-failed=.failed --dist loadfile
coverage report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -234,11 +205,10 @@ jobs:
if: failure()
with:
name: failed-${{ matrix.os }}-${{ matrix.python-version }}
path: |
./autotest/.failed/**
path: autotest/.failed/**

- name: Upload coverage
if: github.repository_owner == 'modflowpy' && (github.event_name == 'push' || github.event_name == 'pull_request')
uses: codecov/codecov-action@v3
with:
files: ./autotest/coverage.xml
files: autotest/coverage.xml
52 changes: 7 additions & 45 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ 3.8, 3.9, "3.10", "3.11" ]
python-version: [ 3.8, 3.9, "3.10", "3.11", "3.12" ]
exclude:
# avoid shutil.copytree infinite recursion bug
# https://github.com/python/cpython/pull/17098
Expand All @@ -25,23 +25,7 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Python
if: runner.os != 'Windows'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install Python dependencies
if: runner.os != 'Windows'
run: |
pip install --upgrade pip
pip install .
pip install ".[test, optional]"
- name: Setup Micromamba
if: runner.os == 'Windows'
uses: mamba-org/setup-micromamba@v1
with:
environment-file: etc/environment.yml
Expand All @@ -53,14 +37,10 @@ jobs:
bash
powershell
- name: Install extra Python dependencies
if: runner.os == 'Windows'
shell: bash -l {0}
run: |
pip install xmipy
pip install .
- name: Install FloPy
run: pip install .

- name: Workaround OpenGL issue on Linux
- name: OpenGL workaround on Linux
if: runner.os == 'Linux'
run: |
# referenced from https://github.com/pyvista/pyvista/blob/main/.github/workflows/vtk-pre-test.yml#L53
Expand All @@ -85,28 +65,11 @@ jobs:
repo: modflow6-nightly-build

- name: Update FloPy packages
if: runner.os != 'Windows'
run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup

- name: Update FloPy packages
if: runner.os == 'Windows'
shell: bash -l {0}
run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup

- name: Run example tests
if: runner.os != 'Windows'
working-directory: ./autotest
run: |
pytest -v -m="example" -n=auto -s --durations=0 --keep-failed=.failed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run example tests
if: runner.os == 'Windows'
shell: bash -l {0}
working-directory: ./autotest
run: |
pytest -v -m="example" -n=auto -s --durations=0 --keep-failed=.failed
working-directory: autotest
run: pytest -v -m="example" -n=auto -s --durations=0 --keep-failed=.failed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -115,5 +78,4 @@ jobs:
if: failure()
with:
name: failed-example-${{ matrix.os }}-${{ matrix.python-version }}
path: |
./autotest/.failed/**
path: autotest/.failed/**
47 changes: 6 additions & 41 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,19 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ 3.8, 3.9, "3.10", "3.11" ]
python-version: [ 3.8, 3.9, "3.10", "3.11", "3.12" ]
exclude:
# avoid shutil.copytree infinite recursion bug
# https://github.com/python/cpython/pull/17098
- python-version: '3.8.0'
defaults:
run:
shell: bash
shell: bash -l {0}
timeout-minutes: 90
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Python
if: runner.os != 'Windows'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install Python dependencies
if: runner.os != 'Windows'
run: |
pip install --upgrade pip
pip install .
pip install ".[test, optional]"
- name: Setup Micromamba
if: runner.os == 'Windows'
uses: mamba-org/setup-micromamba@v1
Expand All @@ -53,12 +38,8 @@ jobs:
bash
powershell
- name: Install extra Python dependencies
if: runner.os == 'Windows'
shell: bash -l {0}
run: |
pip install xmipy
pip install .
- name: Install FloPy
run: pip install .

- name: Install Modflow-related executables
uses: modflowpy/install-modflow-action@v1
Expand All @@ -69,25 +50,10 @@ jobs:
repo: modflow6-nightly-build

- name: Update FloPy packages
if: runner.os != 'Windows'
run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup

- name: Update FloPy packages
if: runner.os == 'Windows'
shell: bash -l {0}
run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup

- name: Run regression tests
if: runner.os != 'Windows'
working-directory: ./autotest
run: pytest -v -m="regression" -n=auto --durations=0 --keep-failed=.failed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run regression tests
if: runner.os == 'Windows'
shell: bash -l {0}
working-directory: ./autotest
working-directory: autotest
run: pytest -v -m="regression" -n=auto --durations=0 --keep-failed=.failed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -97,5 +63,4 @@ jobs:
if: failure()
with:
name: failed-regression-${{ matrix.os }}-${{ matrix.python-version }}
path: |
./autotest/.failed/**
path: autotest/.failed/**
Loading

0 comments on commit 7631f4b

Please sign in to comment.