Skip to content

Commit

Permalink
refactor: accommodate recent pymake changes (#26)
Browse files Browse the repository at this point in the history
* include double precision entries in code.json/md
* remove unneeded -f arg for make-code-json
* use new -ad option for make-code-json
* skip tests for gwe, swf, prt until released
* name test distributions by os tag
* run black/isort
  • Loading branch information
wpbonelli committed Feb 18, 2024
1 parent 1771ace commit fc412e5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 23 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,22 @@ jobs:
meson setup builddir --prefix=$(pwd) --libdir=bin -Ddebug=false
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
run: |
# build programs
mkdir programs
python executables/scripts/build_programs.py -p programs
ostag="${{ steps.ostag.outputs.ostag }}"
mkdir $ostag
python executables/scripts/build_programs.py -p $ostag
# move programs where mf6 autotests expect them
mkdir modflow6/bin/downloaded
cp programs/* modflow6/bin/downloaded
cp $ostag/* modflow6/bin/downloaded
# move mf6 binaries to top-level bindir in mf6 repo
if [[ "$RUNNER_OS" == "Windows" ]]; then
Expand All @@ -77,9 +84,9 @@ jobs:
eext=""
oext=".dylib"
fi
cp "programs/mf6$eext" modflow6/bin
cp "programs/libmf6$oext" modflow6/bin
cp "programs/zbud6$eext" modflow6/bin
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
Expand All @@ -90,8 +97,8 @@ jobs:
- name: Upload programs
uses: actions/upload-artifact@v3
with:
name: programs
path: programs.zip
name: ${{ steps.ostag.outputs.ostag }}
path: ${{ steps.ostag.outputs.ostag }}.zip

- name: Upload metadata
if: runner.os == 'Linux'
Expand All @@ -106,4 +113,5 @@ jobs:
working-directory: modflow6/autotest
run: |
python update_flopy.py
pytest -v -n auto -k "not gwe" -m "not developmode" --durations 0
# 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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
pip install -r requirements.txt
pip list
- name: Build executables
- name: Build programs
run: python scripts/build_programs.py

- name: Upload distribution archive
Expand Down
27 changes: 14 additions & 13 deletions scripts/build_programs.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import argparse
import sys
import subprocess
import sys
import textwrap
from pathlib import Path

from modflow_devtools.ostags import get_modflow_ostag

DEFAULT_RETRIES = 3
DBL_PREC_PROGRAMS = ["mf2005", "mflgr", "mfnwt", "mfusg"]
DPRECISION_EXES = ["mf2005", "mflgr", "mfnwt", "mfusg"]


def get_fc() -> str:
Expand Down Expand Up @@ -73,19 +73,11 @@ def run_cmd(args) -> bool:
path = Path(args.path)
path.mkdir(parents=True, exist_ok=True)
zip_path = Path(path).with_suffix(".zip")
dp_programs = ",".join(DBL_PREC_PROGRAMS)
dp_exes = ",".join(DPRECISION_EXES)
retries = args.retries
fc = get_fc()
cc = get_cc()

assert run_cmd(
[
"make-code-json",
"-f",
str(path / "code.json"),
"--verbose",
]
), "could not make code.json"
assert run_cmd(
[
"make-program",
Expand All @@ -104,7 +96,7 @@ def run_cmd(args) -> bool:
assert run_cmd(
[
"make-program",
dp_programs,
dp_exes,
"--appdir",
path,
"--double",
Expand All @@ -116,5 +108,14 @@ def run_cmd(args) -> bool:
"--zip",
str(zip_path),
]
), f"could not build double precision binaries: {dp_programs}"
), f"could not build double precision binaries: {dp_exes}"
assert run_cmd(
[
"make-code-json",
"-ad",
str(path),
"--verbose",
]
), "could not make code.json"
assert zip_path.is_file(), "could not build distribution zipfile"
print(f"created distribution zipfile: {zip_path}")

0 comments on commit fc412e5

Please sign in to comment.