Skip to content

Commit

Permalink
per #1980, added logic to use the main_vX.Y branches from METplotpy/M…
Browse files Browse the repository at this point in the history
…ETcalcpy/METdataio when running tests on official versions of METplus (X.Y.Z, no -beta/-rc/-dev)
  • Loading branch information
georgemccabe committed Dec 9, 2022
1 parent 16ff8d2 commit c53f4cb
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
22 changes: 17 additions & 5 deletions .github/jobs/get_use_case_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from internal.tests.use_cases.metplus_use_case_suite import METplusUseCaseSuite
from metplus.util.string_manip import expand_int_string_to_list
from docker_utils import VERSION_EXT

from metplus import get_metplus_version

# path to METplus install location in Docker
METPLUS_DOCKER_LOC = '/metplus/METplus'
Expand All @@ -38,6 +38,7 @@
'gempak',
]


def handle_automation_env(host_name, reqs, work_dir):
# if no env is specified, use metplus base environment
conda_env = METPLUS_BASE_ENV
Expand Down Expand Up @@ -74,24 +75,32 @@ def handle_automation_env(host_name, reqs, work_dir):
else:
py_embed_arg = ''

# get METplus version to determine Externals file to use
# to get METplotpy/METcalcpy/METdataio
# If stable release, get main branch, otherwise get develop
is_stable_release = len(get_metplus_version().split('-')) == 1
externals_ext = '_stable.cfg' if is_stable_release else '.cfg'

# if any metplotpy/metcalcpy keywords are in requirements list,
# add command to obtain and install METplotpy and METcalcpy
if any([item for item in PLOTCALC_KEYWORDS if item in str(reqs).lower()]):
ce_file = os.path.join(work_dir, '.github', 'parm',
f'Externals_metplotcalcpy{externals_ext}')
setup_env += (
f'cd {METPLUS_DOCKER_LOC};'
f'{work_dir}/manage_externals/checkout_externals'
f' -e {work_dir}/.github/parm/Externals_metplotcalcpy.cfg;'
f'{work_dir}/manage_externals/checkout_externals -e {ce_file};'
f'{python_path} -m pip install {METPLUS_DOCKER_LOC}/../METplotpy;'
f'{python_path} -m pip install {METPLUS_DOCKER_LOC}/../METcalcpy;'
'cd -;'
)

# if metdataio is in requirements list, add command to obtain METdataio
if 'metdataio' in str(reqs).lower():
ce_file = os.path.join(work_dir, '.github', 'parm',
f'Externals_metdataio{externals_ext}')
setup_env += (
f'cd {METPLUS_DOCKER_LOC};'
f'{work_dir}/manage_externals/checkout_externals'
f' -e {work_dir}/.github/parm/Externals_metdataio.cfg;'
f'{work_dir}/manage_externals/checkout_externals -e {ce_file};'
f'{python_path} -m pip install {METPLUS_DOCKER_LOC}/../METdataio;'
'cd -;'
)
Expand All @@ -117,6 +126,7 @@ def handle_automation_env(host_name, reqs, work_dir):

return setup_env, py_embed_arg


def main(categories, subset_list, work_dir=None,
host_name=os.environ.get('HOST_NAME')):
all_commands = []
Expand Down Expand Up @@ -174,6 +184,7 @@ def main(categories, subset_list, work_dir=None,

return all_commands


def handle_command_line_args():
# read command line arguments to determine which use cases to run
if len(sys.argv) < 2:
Expand Down Expand Up @@ -201,6 +212,7 @@ def handle_command_line_args():

return categories, subset_list, do_comparison


if __name__ == '__main__':
categories, subset_list, _ = handle_command_line_args()
all_commands = main(categories, subset_list)
Expand Down
9 changes: 9 additions & 0 deletions .github/parm/Externals_metdataio_stable.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[METdataio]
local_path = ../METdataio
protocol = git
required = True
repo_url = https://github.com/dtcenter/METdataio
branch = main_v2.0

[externals_description]
schema_version = 1.0.0
16 changes: 16 additions & 0 deletions .github/parm/Externals_metplotcalcpy_stable.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[METcalcpy]
local_path = ../METcalcpy
protocol = git
required = True
repo_url = https://github.com/dtcenter/METcalcpy
branch = main_v2.0

[METplotpy]
local_path = ../METplotpy
protocol = git
required = True
repo_url = https://github.com/dtcenter/METplotpy
branch = main_v2.0

[externals_description]
schema_version = 1.0.0

0 comments on commit c53f4cb

Please sign in to comment.