chore: drop py3.9, fix conftest.py, use uv in ci #907
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: modflowapi continuous integration | |
on: | |
schedule: | |
- cron: '0 8 * * *' # run at 8 AM UTC (12 am PST) | |
push: | |
branches: | |
- main | |
- develop | |
- 'release*' | |
pull_request: | |
branches: [main, develop] | |
jobs: | |
std_setup: | |
name: standard installation | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Base installation | |
run: pip install -e . | |
- name: Print version | |
run: python -c "import modflowapi; print(modflowapi.__version__)" | |
lint: | |
name: lint | |
runs-on: ubuntu-latest | |
if: github.event_name != 'schedule' | |
strategy: | |
fail-fast: false | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
# Standard python fails on Windows without GDAL installation. Using | |
# standard python here since only linting on linux. | |
# Use standard bash shell with standard python | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
cache-dependency-glob: "**/pyproject.toml" | |
- name: Install | |
run: uv sync --group lint | |
- name: Lint | |
run: uvx ruff check . | |
- name: Format | |
run: uvx ruff format . --check | |
- name: Spelling | |
run: uvx codespell | |
autotest_extensions: | |
name: modflowapi extensions autotests | |
needs: lint | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
python-version: [ "3.10", "3.11", "3.12", "3.13" ] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
cache-dependency-glob: "**/pyproject.toml" | |
python-version: ${{ matrix.python-version }} | |
- name: Install | |
run: uv sync --group test | |
- name: Install Python dependencies | |
run: | | |
uv pip install git+https://[email protected]/Deltares/xmipy@develop | |
uv pip install git+https://[email protected]/MODFLOW-ORG/modflow-devtools@develop | |
- name: Install modflow executables | |
uses: modflowpy/install-modflow-action@v1 | |
with: | |
path: ${{ github.workspace }}/autotest | |
repo: modflow6-nightly-build | |
- name: Run autotests | |
working-directory: ./autotest | |
shell: bash -l {0} | |
run: uv run pytest -v -n auto -m "not mf6" | |
autotest_preidm_extensions: | |
name: modflowapi pre-idm extensions autotests | |
needs: lint | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-13, windows-latest ] | |
python-version: [ "3.10", "3.11", "3.12", "3.13" ] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
cache-dependency-glob: "**/pyproject.toml" | |
python-version: ${{ matrix.python-version }} | |
- name: Install | |
run: uv sync --group test | |
- name: Install Python dependencies | |
run: | | |
uv pip install git+https://[email protected]/Deltares/xmipy@develop | |
uv pip install git+https://[email protected]/MODFLOW-ORG/modflow-devtools@develop | |
- name: Install modflow executables | |
uses: modflowpy/install-modflow-action@v1 | |
with: | |
path: ${{ github.workspace }}/autotest | |
repo: executables | |
tag: "14.0" | |
- name: Run autotests | |
working-directory: ./autotest | |
shell: bash -l {0} | |
run: pytest -v -n auto -m "not mf6" | |
autotest_mf6_examples: | |
name: modflowapi mf6 examples autotests | |
needs: lint | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
python-version: [ "3.10", "3.11", "3.12", "3.13" ] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Checkout mf6-examples | |
uses: actions/checkout@v4 | |
with: | |
repository: MODFLOW-ORG/modflow6-examples | |
path: modflow6-examples | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
cache-dependency-glob: "**/pyproject.toml" | |
python-version: ${{ matrix.python-version }} | |
- name: Install | |
run: uv sync --group test | |
- name: Install Python dependencies | |
run: | | |
uv pip install git+https://[email protected]/Deltares/xmipy@develop | |
uv pip install git+https://[email protected]/MODFLOW-ORG/modflow-devtools@develop | |
uv pip install git+https://[email protected]/modflowpy/flopy@develop | |
- name: update flopy for mf6-examples | |
run: uv run python -m flopy.mf6.utils.generate_classes --ref develop --no-backup | |
- name: Install modflow6 for modflow6-examples | |
uses: modflowpy/install-modflow-action@v1 | |
with: | |
path: ${{ github.workspace }}/modflow6-examples/autotest | |
- name: Build mf6-examples | |
working-directory: modflow6-examples/autotest | |
run: | | |
uv run pytest -v -n=auto --init test_scripts.py -k "not synthetic-valley" | |
- name: Install modflow6 nightly build | |
uses: modflowpy/install-modflow-action@v1 | |
with: | |
path: ${{ github.workspace }}/autotest | |
repo: modflow6-nightly-build | |
- name: Run autotests | |
working-directory: ./autotest | |
shell: bash -l {0} | |
run: uv run pytest -v -n=auto test_mf6_examples.py --mf6-examples-path=../modflow6-examples/examples |