Skip to content

Integration testing #416

Integration testing

Integration testing #416

Workflow file for this run

name: Integration testing
on:
workflow_dispatch:
jobs:
test_modflow:
name: MODFLOW 6 integration tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, macos-13, macos-14, windows-2019 ]
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
path: executables
- name: Checkout modflow6
uses: actions/checkout@v4
with:
repository: MODFLOW-USGS/modflow6
path: modflow6
- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: modflow6/environment.yml
cache-environment: true
cache-downloads: true
init-shell: bash
- name: Setup ${{ contains(fromJSON('["macos-14"]'), matrix.os) && 'gcc' || 'intel-classic' }} ${{ contains(fromJSON('["macos-14"]'), matrix.os) && 12 || 2021.7 }}
uses: fortran-lang/setup-fortran@v1
with:
compiler: ${{ contains(fromJSON('["macos-14"]'), matrix.os) && 'gcc' || 'intel-classic' }}
version: ${{ contains(fromJSON('["macos-14"]'), matrix.os) && 12 || 2021.7 }}
- name: Set LDFLAGS (macOS)
if: matrix.os == 'macos-14'
run: |
os_ver=$(sw_vers -productVersion | cut -d'.' -f1)
if (( "$os_ver" > 12 )); then
ldflags="$LDFLAGS -Wl,-ld_classic"
echo "LDFLAGS=$ldflags" >> $GITHUB_ENV
fi
- name: Hide dylibs (macOS)
if: matrix.os == 'macos-14'
run: |
version="12"
libpath="/opt/homebrew/opt/gcc@$version/lib/gcc/$version"
mv $libpath/libgfortran.5.dylib $libpath/libgfortran.5.dylib.bak
mv $libpath/libquadmath.0.dylib $libpath/libquadmath.0.dylib.bak
mv $libpath/libstdc++.6.dylib $libpath/libstdc++.6.dylib.bak
# only necessary because we need mf5to6 for mf6 autotests
- name: Build modflow6
working-directory: modflow6
run: |
setupargs="--prefix=$(pwd) --libdir=bin -Ddebug=false"
if [[ "${{ matrix.os }}" == "macos-14" ]]; then
setupargs="$setupargs -Doptimization=1"
fi
meson setup builddir $setupargs
meson install -C builddir
- name: Get OS tag
id: ostag
run: |
ostag=$(python -c "from modflow_devtools.ostags import get_ostag; print(get_ostag())")
echo "ostag=$ostag" >> $GITHUB_OUTPUT
- name: Build programs
uses: nick-fields/retry@v3
with:
shell: bash
timeout_minutes: 40
command: |
ostag="${{ steps.ostag.outputs.ostag }}"
mkdir $ostag
make-program : --appdir $ostag --zip $ostag.zip --verbose
make-program mf2005,mflgr,mfnwt,mfusg --appdir $ostag --double --keep --zip $ostag.zip --verbose
if [[ "${{ matrix.os }}" == "macos-14" ]]; then
make-program mf6 --appdir $ostag --keep --zip $ostag.zip --verbose --fflags='-O1'
fi
make-code-json --appdir $ostag --zip $ostag.zip --verbose
- name: Move programs
run: |
# build programs
ostag="${{ steps.ostag.outputs.ostag }}"
# move programs where mf6 autotests expect them
mkdir modflow6/bin/downloaded
cp $ostag/* modflow6/bin/downloaded
# move mf6 binaries to top-level bindir in mf6 repo
if [[ "$RUNNER_OS" == "Windows" ]]; then
eext=".exe"
oext=".dll"
elif [[ "$RUNNER_OS" == "Linux" ]]; then
eext=""
oext=".so"
else
eext=""
oext=".dylib"
fi
cp "$ostag/mf6$eext" modflow6/bin
cp "$ostag/libmf6$oext" modflow6/bin
cp "$ostag/zbud6$eext" modflow6/bin
# set execute permissions
if [[ "$RUNNER_OS" != "Windows" ]]; then
sudo chmod +x modflow6/bin/*
sudo chmod +x modflow6/bin/downloaded/*
fi
- name: Check linked libs (macOS)
if: matrix.os == 'macos-14'
run: |
ostag="${{ steps.ostag.outputs.ostag }}"
find $ostag -perm +111 -type f | xargs -I{} sh -c "otool -L {}"
- name: Upload programs
uses: actions/upload-artifact@v3
with:
name: ${{ steps.ostag.outputs.ostag }}
path: ${{ steps.ostag.outputs.ostag }}.zip
- name: Upload metadata
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: ${{ steps.ostag.outputs.ostag }}
path: |
./code.json
./code.md
- name: Test modflow6
working-directory: modflow6/autotest
run: |
python update_flopy.py
# when mf6.5.0 is released with new models and exes dist is updatd, remove filters below
pytest -v -n auto -k "not gwe and not swf and not prt" -m "not developmode" --durations 0