From 45714eb62ca8e1b776c7a4f74e65109de2223a57 Mon Sep 17 00:00:00 2001 From: mjreno Date: Fri, 17 Nov 2023 10:55:33 -0500 Subject: [PATCH 1/3] ci(netcdf): add netcdf-fortran dependency to extended (parallel) test --- .github/workflows/ci.yml | 29 ++++++++++++++++++++++++++++- meson.build | 12 +++++------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86edea78f9f..e848bcd5bee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -494,16 +494,29 @@ jobs: uses: mamba-org/setup-micromamba@v1 with: environment-file: modflow6/environment.yml + create-args: >- + netcdf-fortran init-shell: >- bash powershell cache-environment: true cache-downloads: true + - name: Fix pc file and set PKG_CONFIG_PATH + working-directory: modflow6 + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + sed -i "s|libdir=/home/runner/micromamba/envs/modflow6//home/runner/micromamba/envs/modflow6/lib|libdir=/home/runner/micromamba/envs/modflow6/lib|g" /home/runner/micromamba/envs/modflow6/lib/pkgconfig/netcdf-fortran.pc + echo "PKG_CONFIG_PATH=/home/runner/micromamba/envs/modflow6/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV + elif [ "$RUNNER_OS" == "macOS" ]; then + sed -i '' -e "s|libdir=/Users/runner/micromamba/envs/modflow6//Users/runner/micromamba/envs/modflow6/lib|libdir=/Users/runner/micromamba/envs/modflow6/lib|g" /Users/runner/micromamba/envs/modflow6/lib/pkgconfig/netcdf-fortran.pc + echo "PKG_CONFIG_PATH=/Users/runner/micromamba/envs/modflow6/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV + fi + - name: Build modflow6 working-directory: modflow6 run: | - meson setup builddir -Ddebug=false -Dparallel=true --prefix=$(pwd) --libdir=bin + meson setup builddir -Ddebug=false -Dextended=true --prefix=$(pwd) --libdir=bin meson install -C builddir meson test --verbose --no-rebuild -C builddir @@ -522,6 +535,20 @@ jobs: GITHUB_TOKEN: ${{ github.token }} run: pytest -v --durations 0 get_exes.py + - name: Confirm netcdf build + working-directory: modflow6/autotest + env: + REPOS_PATH: ${{ github.workspace }} + run: | + pytest test_gwf_chd01.py --keep temp + if grep -Fx " NetCDF, network Common Data Form software library" temp/test_mf6model[chd01]0/mfsim.lst + then + echo "NetCDF dependency confirmed." + else + echo "NetCDF dependency not found." + exit 1 + fi + - name: Test programs (parallel) working-directory: modflow6/autotest env: diff --git a/meson.build b/meson.build index 211bdc3921c..416be2eaf2a 100644 --- a/meson.build +++ b/meson.build @@ -169,18 +169,16 @@ if is_extended_build # find netcdf if build_machine.system() != 'windows' - netcdf = dependency('netcdf', language : 'fortran', required : false) + netcdf = dependency('netcdf', language : 'fortran', required : true) else # For CI testing only; Windows not yet supported nc_dir = meson.project_source_root() / '..' / 'ncf' / 'netcdf-fortran-4.6.1' / 'fortran' - netcdf = fc.find_library('netcdff', dirs: [ nc_dir ], required : false, static : false) + netcdf = fc.find_library('netcdff', dirs: [ nc_dir ], required : true, static : false) #nc_incdir = include_directories([ nc_dir ]) endif - if netcdf.found() - with_netcdf = true - extra_cmp_args += [ '-D__WITH_NETCDF__' ] - dependencies += [ netcdf ] - endif + extra_cmp_args += [ '-D__WITH_NETCDF__' ] + dependencies += [ netcdf ] + with_netcdf = true else with_netcdf = false with_petsc = false From 23090a9401ff8cc0938d8d8be79e0fe887f29f34 Mon Sep 17 00:00:00 2001 From: mjreno Date: Sun, 19 Nov 2023 15:20:46 -0500 Subject: [PATCH 2/3] remove fix for netcdf-fortran pkg-config libdir issue --- .github/workflows/ci.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e848bcd5bee..c19a18058ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -502,14 +502,12 @@ jobs: cache-environment: true cache-downloads: true - - name: Fix pc file and set PKG_CONFIG_PATH + - name: Update PKG_CONFIG_PATH working-directory: modflow6 run: | if [ "$RUNNER_OS" == "Linux" ]; then - sed -i "s|libdir=/home/runner/micromamba/envs/modflow6//home/runner/micromamba/envs/modflow6/lib|libdir=/home/runner/micromamba/envs/modflow6/lib|g" /home/runner/micromamba/envs/modflow6/lib/pkgconfig/netcdf-fortran.pc echo "PKG_CONFIG_PATH=/home/runner/micromamba/envs/modflow6/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV elif [ "$RUNNER_OS" == "macOS" ]; then - sed -i '' -e "s|libdir=/Users/runner/micromamba/envs/modflow6//Users/runner/micromamba/envs/modflow6/lib|libdir=/Users/runner/micromamba/envs/modflow6/lib|g" /Users/runner/micromamba/envs/modflow6/lib/pkgconfig/netcdf-fortran.pc echo "PKG_CONFIG_PATH=/Users/runner/micromamba/envs/modflow6/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV fi @@ -535,7 +533,7 @@ jobs: GITHUB_TOKEN: ${{ github.token }} run: pytest -v --durations 0 get_exes.py - - name: Confirm netcdf build + - name: Confirm netcdf license logged working-directory: modflow6/autotest env: REPOS_PATH: ${{ github.workspace }} @@ -543,9 +541,9 @@ jobs: pytest test_gwf_chd01.py --keep temp if grep -Fx " NetCDF, network Common Data Form software library" temp/test_mf6model[chd01]0/mfsim.lst then - echo "NetCDF dependency confirmed." + echo "NetCDF license logging confirmed." else - echo "NetCDF dependency not found." + echo "NetCDF license logging not found." exit 1 fi From 3ceb583c03b2b0940ed240a6ee84d10fcf293214 Mon Sep 17 00:00:00 2001 From: mjreno Date: Mon, 4 Dec 2023 13:00:39 -0500 Subject: [PATCH 3/3] replace platform specific checks with CONDA_PREFIX --- .github/workflows/ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c19a18058ac..276795c252d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -505,11 +505,7 @@ jobs: - name: Update PKG_CONFIG_PATH working-directory: modflow6 run: | - if [ "$RUNNER_OS" == "Linux" ]; then - echo "PKG_CONFIG_PATH=/home/runner/micromamba/envs/modflow6/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV - elif [ "$RUNNER_OS" == "macOS" ]; then - echo "PKG_CONFIG_PATH=/Users/runner/micromamba/envs/modflow6/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV - fi + echo "PKG_CONFIG_PATH=$CONDA_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV - name: Build modflow6 working-directory: modflow6