modflowapi continuous integration #800
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: Upgrade pip | |
run: | | |
python -m pip install --upgrade pip | |
- 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@v3 | |
# 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 Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Print python version | |
run: | | |
python --version | |
- name: Install Python packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e .[lint] | |
- name: Lint | |
run: ruff check . | |
- name: Check format | |
run: ruff format . --check | |
- name: Check spelling | |
run: 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.9, "3.10", "3.11", "3.12" ] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: pyproject.toml | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install git+https://git@github.com/Deltares/xmipy@develop | |
pip install git+https://git@github.com/MODFLOW-USGS/modflow-devtools@develop | |
pip install .[test] | |
- 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: 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.9, "3.10", "3.11", "3.12" ] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: pyproject.toml | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install git+https://git@github.com/Deltares/xmipy@develop | |
pip install git+https://git@github.com/MODFLOW-USGS/modflow-devtools@develop | |
pip install .[test] | |
- 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.9, "3.10", "3.11", "3.12" ] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Checkout mf6-examples | |
uses: actions/checkout@v4 | |
with: | |
repository: MODFLOW-USGS/modflow6-examples | |
path: modflow6-examples | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: pyproject.toml | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install git+https://git@github.com/Deltares/xmipy@develop | |
pip install git+https://git@github.com/MODFLOW-USGS/modflow-devtools@develop | |
pip install git+https://git@github.com/modflowpy/flopy@develop | |
pip install .[test] | |
- name: update flopy for mf6-examples | |
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: | | |
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: pytest -v -n=auto test_mf6_examples.py --mf6-examples-path=../modflow6-examples/examples |