Skip to content

Commit

Permalink
ci(get_exes): update get_exe to use updated pymake functionality (#1060)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhughes-usgs authored Feb 18, 2021
1 parent 25a6e97 commit f633012
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 37 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@ jobs:
python-version: 3.8
run-type: script
test-path: autotest_scripts.py
exclude:
- os: macos-latest
python-version: 3.6
- os: macos-latest
python-version: 3.7
# exclude:
# - os: macos-latest
# python-version: 3.6

steps:
# check out repo
Expand Down
54 changes: 22 additions & 32 deletions autotest/get_exes.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,27 @@ def get_branch():
if branch is None:
if is_CI:
github_ref = os.getenv("GITHUB_REF")
branch = os.path.basename(os.path.normpath(github_ref)).lower()
else:
try:
# determine current branch
b = subprocess.Popen(
("git", "status"),
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
).communicate()[0]
if isinstance(b, bytes):
b = b.decode("utf-8")

for line in b.splitlines():
if "On branch" in line:
branch = (
line.replace("On branch ", "").rstrip().lower()
)

except:
msg = "Could not determine current branch. Is git installed?"
raise ValueError(msg)
if github_ref is not None:
return os.path.basename(os.path.normpath(github_ref)).lower()
try:
# determine current branch
b = subprocess.Popen(
("git", "status"),
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
).communicate()[0]
if isinstance(b, bytes):
b = b.decode("utf-8")

for line in b.splitlines():
if "On branch" in line:
branch = (
line.replace("On branch ", "").rstrip().lower()
)

except:
msg = "Could not determine current branch. Is git installed?"
raise ValueError(msg)

return branch

Expand Down Expand Up @@ -135,17 +135,7 @@ def test_download_nightly_build():
# Replace MODFLOW 6 executables with the latest versions
else:
print("Updating MODFLOW 6 executables from the nightly-build repo")
platform = sys.platform.lower()
if "linux" in platform:
zip_file = "linux.zip"
elif "darwin" in platform:
zip_file = "mac.zip"
elif "win32" in platform:
zip_file = "win64.zip"
url = pymake.get_repo_assets("MODFLOW-USGS/modflow6-nightly-build")[
zip_file
]
pymake.download_and_unzip(url, exe_pth, verbose=True)
pymake.getmfnightly(pth=exe_pth, exes=["mf6", "libmf6"], verbose=True)

move_exe()

Expand Down

0 comments on commit f633012

Please sign in to comment.