Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update workflow file to use modflowpy/install-intelfortran-action #15

Merged
merged 6 commits into from
Dec 10, 2022
Prev Previous commit
Next Next commit
ci: update workflow file to use modflowpy/install-intelfortran-action
Delete unnecessary intel scripts.
  • Loading branch information
jdhughes-usgs committed Dec 10, 2022
commit d04fdf647c81f2499b850501cbf09e5496127064
36 changes: 25 additions & 11 deletions .github/common/build_executables.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sys
import subprocess

RETRIES = 3


def get_ostag() -> str:
"""Determine operating system tag from sys.platform."""
Expand All @@ -24,8 +26,19 @@ def get_cctag() -> str:
raise ValueError(f"platform {sys.platform!r} not supported")


def mfpymake_run_command(args) -> bool:
success = False
for idx in range(RETRIES):
p = subprocess.run(args)
if p.returncode == 0:
success = True
break
print(f"{args[0]} run {idx + 1}/{RETRIES} failed...rerunning")
return success


if __name__ == "__main__":
cmds = [
cmd = [
"make-program",
":",
f"--appdir={get_ostag()}",
Expand All @@ -35,14 +48,15 @@ def get_cctag() -> str:
"--keep",
]

retries = 3
success = False
for idx in range(retries):
p = subprocess.run(cmds)
if p.returncode == 0:
success = True
break
print(f"run {idx + 1}/{retries} failed...rerunning")

if not success:
if not mfpymake_run_command(cmd):
raise RuntimeError("could not build the executables")

cmd = [
"make-code-json",
"-f",
f"code.json",
"--verbose",
]

if not mfpymake_run_command(cmd):
raise RuntimeError(f"could not run {cmd[0]}")