Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ runs:
args="$args --ostag ${{ inputs.ostag }}"
fi

# work around broken/incomplete local CA trust stores on some runners by pointing
# Python's default SSL context at certifi's CA bundle, regardless of which install
# path below ends up running
python3 -m pip install --quiet --disable-pip-version-check certifi || true
cert_file="$(python3 -m certifi 2>/dev/null || true)"
if [[ -n "$cert_file" ]]; then
export SSL_CERT_FILE="$cert_file"
fi

# download the installation script if necessary
if command -v get-modflow &> /dev/null
then
Expand Down
22 changes: 19 additions & 3 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
'crt',
'mt3dms',
'mf2005dbl',
'zonbud3',
'zonbud',
'gridgen',
'mflgrdbl',
'mfnwt',
Expand Down Expand Up @@ -59,6 +59,12 @@
"modflow6-nightly-build": ["libmf6"]
}

# executables that have been renamed upstream at some point; accept the old
# name too, so tests pass against both latest and older pinned release tags
exe_aliases = {
'zonbud': ['zonbud3'],
}

# apply subset filter, if provided
if subset:
expected_exes = {k: [vv for vv in v if vv in subset] for k, v in expected_exes.items()}
Expand Down Expand Up @@ -98,6 +104,14 @@ def get_expected_files(repository) -> Tuple[List[str], List[str]]:
return exes, libs


def alt_names(exe) -> List[str]:
"""Given an (possibly suffixed) expected exe name, return itself plus any
known former/alternate names it may appear as, with the same suffix."""
base, _, suffix = exe.partition('.')
suffix = f".{suffix}" if suffix else ""
return [exe] + [f"{alias}{suffix}" for alias in exe_aliases.get(base, [])]


# check install location exists
assert path.is_dir(), f"Install location {path} doesn't exist"
print(f"Found install location: {path}")
Expand All @@ -109,15 +123,17 @@ def get_expected_files(repository) -> Tuple[List[str], List[str]]:

# check executables exist
found = sorted([p.name for p in path.glob("*")])
found_set = set(found)
exp_exes, exp_libs = get_expected_files(repo)
expected = exp_exes + exp_libs
assert set(found) >= set(exp_exes), f"Executables/libraries missing:\n Found {set(found)}\n Expected {set(exp_exes)}"
missing = [exe for exe in exp_exes if not (set(alt_names(exe)) & found_set)]
assert not missing, f"Executables/libraries missing:\n Found {found_set}\n Expected {set(exp_exes)}"
print(f"Found all expected executables/libraries:")
pprint(expected)

# check executables are on the PATH
for exe in exp_exes:
assert which(exe), f"Executable {exe} not found on path"
assert any(which(name) for name in alt_names(exe)), f"Executable {exe} not found on path"
print(f"Verified executables are on system path")