Skip to content

add swf notebook to exercises (#74) #288

add swf notebook to exercises (#74)

add swf notebook to exercises (#74) #288

Workflow file for this run

name: GW3099 continuous integration
on:
# run at 6 AM UTC every day
schedule:
- cron: '0 6 * * *'
push:
branches:
- main
- ci
paths-ignore:
- '**.md'
- '.gitignore'
pull_request:
branches:
- main
paths-ignore:
- '**.md'
- '.gitignore'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install ruff
run: pip install ruff
- name: Lint
run: ruff check .
- name: Check format
run: ruff format . --check
install_env:
name: Install gw3099 environment
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-latest", "windows-latest", "ubuntu-latest"]
python-version: ["3.9", "3.10", "3.11"]
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Update environment file
working-directory: .scripts
run: |
python update_env_file.py --conda
cat ../environment.yml
- name: Install miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
environment-file: "environment.yml"
activate-environment: "gw3099"
auto-activate-base: false
- name: Update flopy mf6 classes
run: |
python -m flopy.mf6.utils.generate_classes --ref 'develop'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: netcdf-fortran settings
if: runner.os != 'Windows'
run: |
pkg-config --libs-only-L netcdf-fortran
pkg-config --cflags-only-I netcdf-fortran
nf-config --help
- name: Update package config files
if: (runner.os != 'Windows')
working-directory: .scripts
run: |
python update_pc_files.py
- name: Clone MODFLOW repo
run: |
git clone --depth 1 --branch develop https://github.com/MODFLOW-USGS/modflow6.git
- name: Build extended version of MODFLOW
if: runner.os != 'Windows'
working-directory: modflow6
run: |
meson setup builddir -Ddebug=false -Dextended=true --prefix=$CONDA_PREFIX --libdir=bin
meson install -C builddir
meson test --verbose --no-rebuild -C builddir
- name: Get and test parallel MODFLOW on Windows
if: runner.os == 'Windows'
working-directory: modflow6/.mf6minsim
run: |
get-modflow --repo modflow6-nightly-build --ostag win64par :python
mpiexec -n 1 mf6 -p
mpiexec -n 2 mf6 -p
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v2
- name: Test notebooks
working-directory: .scripts
run: |
python test_notebooks.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
install_vizenv:
name: Install viz environment
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"]
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
environment-file: 'environment-viz.yml'
activate-environment: 'gw3099viz'
auto-activate-base: false
pywatershed:
name: test pywatershed notebooks
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-latest", "windows-latest", "ubuntu-latest"]
python-version: ["3.10", "3.11"]
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout repo
uses: actions/checkout@v4
# - name: Setup gfortran
# uses: fortran-lang/setup-fortran@v1
# with:
# compiler: gcc
# version: 11
- name: Setup micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment-pywatershed.yml
cache-environment: true
cache-downloads: true
# - name: Install miniconda
# uses: conda-incubator/setup-miniconda@v3
# with:
# python-version: ${{ matrix.python-version }}
# environment-file: "environment-pywatershed.yml"
# activate-environment: "gw3099pws"
# auto-activate-base: false
- name: Install pywatershed
working-directory: exercises/pywatershed
run: |
git clone https://github.com/EC-USGS/pywatershed.git
cd pywatershed
git checkout feat_gw3099
pip install -e .
- name: Import pywatershed
run: |
python -c "import pywatershed"
# - name: Get GIS files for tests
# run: |
# python pywatershed/utils/gis_files.py
# - name: Get additional domain files for notebooks
# run: |
# python pywatershed/utils/addtl_domain_files.py
- name: Test notebooks
working-directory: .scripts
run: |
python test_notebooks.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}