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 maintenance updates and adding CI Unit Tests #2740

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
226 commits
Select commit Hold shift + click to select a range
a62a9f0
added development Jenkninsfile for dispatching from GitHub Actions
TerryMcGuinness-NOAA May 6, 2024
959edf5
Merge branch 'NOAA-EMC:develop' into feature/jenkins-dispatch
TerrenceMcGuinness-NOAA May 8, 2024
002c985
updated method for counting status cases from rocotostat
TerryMcGuinness-NOAA May 8, 2024
0243294
started a unit test for rocotostat
TerryMcGuinness-NOAA May 8, 2024
233c614
added more moc args
TerryMcGuinness-NOAA May 8, 2024
eb3589c
updated third arg to moc
TerryMcGuinness-NOAA May 8, 2024
060f2a8
removed moc stuff from test
TerryMcGuinness-NOAA May 8, 2024
2f9662d
added data for unit testing rocotostat
TerryMcGuinness-NOAA May 8, 2024
b01504d
moved tests dir for ci unit tests under scripts
TerryMcGuinness-NOAA May 8, 2024
a6508f5
added ci unit tests using pytest
TerryMcGuinness-NOAA May 8, 2024
ce9af99
chris H has install.h spelled INSTALL
TerryMcGuinness-NOAA May 8, 2024
060aed6
added path to rocotostat in GitHub runner
TerryMcGuinness-NOAA May 8, 2024
336cbc4
added path relative to sript for input data
TerryMcGuinness-NOAA May 8, 2024
0a3561d
did not put in path for artifacts on success to unittess
TerryMcGuinness-NOAA May 8, 2024
c36ef99
details for artifacts and new actions file
TerryMcGuinness-NOAA May 8, 2024
4e89645
syntax errors in ci unit tests actions yaml file
TerryMcGuinness-NOAA May 8, 2024
c59c997
added report in UI
TerryMcGuinness-NOAA May 8, 2024
cb3c3e5
trying another reportor
TerryMcGuinness-NOAA May 8, 2024
2dfe779
needed update permitions for report
TerryMcGuinness-NOAA May 8, 2024
ed29a28
added conclution to pytest ci
TerryMcGuinness-NOAA May 8, 2024
b22801a
indetation error in ci-pyunit acdtion file
TerryMcGuinness-NOAA May 8, 2024
f868628
removed conclution in messages
TerryMcGuinness-NOAA May 8, 2024
dfdcf7a
job_summary did not work
TerryMcGuinness-NOAA May 8, 2024
ca60b13
more publish and config report
TerryMcGuinness-NOAA May 8, 2024
c29acdf
more publish and config report path update
TerryMcGuinness-NOAA May 8, 2024
74fe7ee
added full path to xml output
TerryMcGuinness-NOAA May 8, 2024
10b0489
needed space for name
TerryMcGuinness-NOAA May 8, 2024
58ad853
needed space for name
TerryMcGuinness-NOAA May 8, 2024
ca985a2
had name wrong was file name up upload
TerryMcGuinness-NOAA May 8, 2024
316d2ee
took out upload
TerryMcGuinness-NOAA May 8, 2024
0cb4a6d
added docstrings to functions
TerryMcGuinness-NOAA May 8, 2024
2534fed
removing Jenkins dispatch file
TerryMcGuinness-NOAA May 8, 2024
89d6058
added verbose in the pytest argument to list each test
TerryMcGuinness-NOAA May 8, 2024
100c893
Merge branch 'NOAA-EMC:develop' into ci_unit-tests
TerrenceMcGuinness-NOAA May 9, 2024
d540011
Merge branch 'NOAA-EMC:develop' into ci_unit-tests
TerrenceMcGuinness-NOAA May 10, 2024
a53445b
moved test data specfic to rocotostat tests in test directory and neu…
TerryMcGuinness-NOAA May 10, 2024
6fc76b2
Merge branch 'ci_unit-tests' of github.com:TerrenceMcGuinness-NOAA/gl…
TerryMcGuinness-NOAA May 10, 2024
eafc6cc
cashed install of Rocoto in actions runner
TerryMcGuinness-NOAA May 10, 2024
6ed8e71
update cashe action to version 4
TerryMcGuinness-NOAA May 10, 2024
e81512b
added test data for rocotocheck stalled case
TerryMcGuinness-NOAA May 10, 2024
14b1622
added stalled and done as functions and added two more unit tests for…
TerryMcGuinness-NOAA May 10, 2024
5901d51
added doctrings to new functions in rocotstat
TerryMcGuinness-NOAA May 10, 2024
9fe4f62
updated pynorm spaces
TerryMcGuinness-NOAA May 10, 2024
2f3cd87
do not need to assert is set to true, it just is
TerryMcGuinness-NOAA May 10, 2024
9bb3b24
Merge pull request #286 from TerrenceMcGuinness-NOAA/ci_unit-tests_st…
TerrenceMcGuinness-NOAA May 10, 2024
7f7f705
cashe after intall or Rocoto silly
TerryMcGuinness-NOAA May 10, 2024
b201a6e
Merge branch 'ci_unit-tests' of github.com:TerrenceMcGuinness-NOAA/gl…
TerryMcGuinness-NOAA May 13, 2024
4566503
removded all rocoto test data and put them in S3 bucket and have them…
TerryMcGuinness-NOAA May 13, 2024
2ad0c1c
fix pynorms and install wget in runner to download test data
TerryMcGuinness-NOAA May 13, 2024
6659215
removed stub files and added .gitkeep and correspondingly update uint…
TerryMcGuinness-NOAA May 13, 2024
33de358
pycodestyle indenetation fix
TerryMcGuinness-NOAA May 13, 2024
2b4e774
cd into the ci test dir and run pytest there to resolve paths correctly
TerryMcGuinness-NOAA May 13, 2024
12ee2db
update path to test results for them to be published
TerryMcGuinness-NOAA May 13, 2024
73b0f11
put in full path to test resultes because the weill not read and move…
TerryMcGuinness-NOAA May 13, 2024
0fc0ec8
trying to debug output test results xml file
TerryMcGuinness-NOAA May 13, 2024
4ed0fa6
using relative path in Pub reslutes and updated test for cashed Rocot…
TerryMcGuinness-NOAA May 13, 2024
7282787
the cached section has to come before the install of Rocoto because i…
TerryMcGuinness-NOAA May 13, 2024
b63adea
moved Cache to before install of Rocoto because it had a duel purpose…
TerryMcGuinness-NOAA May 13, 2024
92971b0
Update .github/workflows/ci-unit_tests.yaml
TerrenceMcGuinness-NOAA May 14, 2024
8c5dbd6
Update .github/workflows/ci-unit_tests.yaml
TerrenceMcGuinness-NOAA May 14, 2024
0d68041
removed caps in docstrings and testing write permissions to pr in act…
TerryMcGuinness-NOAA May 14, 2024
6425410
made deep copies of objects in calls to --all and --summary are disti…
TerryMcGuinness-NOAA May 14, 2024
b5cbcda
Update .github/workflows/ci-unit_tests.yaml
TerrenceMcGuinness-NOAA May 15, 2024
4ae1854
Update .github/workflows/ci-unit_tests.yaml
TerrenceMcGuinness-NOAA May 20, 2024
fc7549e
added a attempt_multiple_times routine to the python rocotostat utili…
TerryMcGuinness-NOAA May 21, 2024
e6ad4fa
it is workflow_dispatch not dispatch
TerryMcGuinness-NOAA May 21, 2024
9581a14
merged develop
TerryMcGuinness-NOAA May 29, 2024
9ee2e6a
merged in changes to rocoto check from develop
TerryMcGuinness-NOAA May 29, 2024
656eb92
added docstring to attempt_multiple_times in the rocoso stat code
TerryMcGuinness-NOAA May 29, 2024
2adbcac
use wxflow on disk and added link_workflow and removed pip install wx…
TerryMcGuinness-NOAA May 29, 2024
d5f4103
misspelled link_workflow.sh
TerryMcGuinness-NOAA May 29, 2024
553404b
add link up wxflow because virt env was not current
TerryMcGuinness-NOAA May 29, 2024
05797cd
moved making of wxflow links into test section
TerryMcGuinness-NOAA May 29, 2024
2cc2fe2
removed pytest junit install
TerryMcGuinness-NOAA May 29, 2024
7407f4e
added PYTHONPATH for tests
TerryMcGuinness-NOAA May 29, 2024
a9de59d
added redundent wxflow as a pip install
TerryMcGuinness-NOAA May 29, 2024
1363144
no comma seperator in pip install
TerryMcGuinness-NOAA May 29, 2024
242f8b7
pip install wxflow from develop branch
TerryMcGuinness-NOAA May 29, 2024
bd7ca33
Merge branch 'develop' into ci_unit-tests
TerryMcGuinness-NOAA May 30, 2024
5dc1dc9
added unit test to test setup_expt and setup_xml
TerryMcGuinness-NOAA May 30, 2024
e81e260
added /work/noaa dir on running to make pass Host() as oroin
May 30, 2024
6fd980d
remove env from setup xml
TerryMcGuinness-NOAA May 30, 2024
62576d6
Merge branch 'ci_unit-tests' of github.com:TerrenceMcGuinness-NOAA/gl…
TerryMcGuinness-NOAA May 30, 2024
b3dff2c
pynorms and unset EXPDR in runner shell
TerryMcGuinness-NOAA May 30, 2024
c7809b4
added more pynorms
TerryMcGuinness-NOAA May 30, 2024
28278ba
shortend path to PSLOT
TerryMcGuinness-NOAA May 30, 2024
b20137b
removed push and made full paths to test data for tesgint setups
TerryMcGuinness-NOAA May 30, 2024
06ef59e
trying to remove EXPDIR from env
TerryMcGuinness-NOAA May 30, 2024
01d2295
trying to remove EXPDIR from runner env
TerryMcGuinness-NOAA May 30, 2024
848e220
added wxflow update to runner for test setups
TerryMcGuinness-NOAA May 30, 2024
2f7f1a2
Update ci/scripts/utils/rocotostat.py
TerrenceMcGuinness-NOAA May 30, 2024
f90eab1
Update ci/scripts/utils/rocotostat.py
TerrenceMcGuinness-NOAA May 30, 2024
f0c907a
use updated wxflow config in this test pr
TerryMcGuinness-NOAA May 30, 2024
c432eda
Merge branch 'ci_unit-tests' of github.com:TerrenceMcGuinness-NOAA/gl…
TerryMcGuinness-NOAA May 30, 2024
1aa135c
added ACCOUT to env for testing updates
TerryMcGuinness-NOAA May 30, 2024
cfc85d7
checklut output from setup exp in runner
TerryMcGuinness-NOAA May 30, 2024
d4d3933
echo EXPDIR and cat config.bas in runner
TerryMcGuinness-NOAA May 31, 2024
fc44f85
cleaned up path to RUNDIR data to PSLOT
TerryMcGuinness-NOAA May 31, 2024
bb76df3
made one function and added a pause just to see if it is ot on dixk y…
TerryMcGuinness-NOAA May 31, 2024
4132ee9
added debug outputs in setup xml
TerryMcGuinness-NOAA May 31, 2024
99f9ada
use develop wxflow
TerryMcGuinness-NOAA May 31, 2024
30b074d
narrowing in on issue that we are not getting base with my update
TerryMcGuinness-NOAA May 31, 2024
4100aad
more dubugging outputs
TerryMcGuinness-NOAA May 31, 2024
46d52bf
more dubugging outputs againZ
TerryMcGuinness-NOAA May 31, 2024
eba677e
test if EXPDIR is in base
TerryMcGuinness-NOAA May 31, 2024
e846040
added checkout of wxflow and running lit link on the runner
TerryMcGuinness-NOAA May 31, 2024
788ef8c
misspelled update in git command
TerryMcGuinness-NOAA May 31, 2024
b9cb187
needed ./ for runnign link in sorc
TerryMcGuinness-NOAA May 31, 2024
ada04dd
add checkout of gfs_utils for detect machine
TerryMcGuinness-NOAA May 31, 2024
2d01f6a
added extra ln for wxflow import in test dir
TerryMcGuinness-NOAA May 31, 2024
7ca0a7a
added the pip intall bit for wxflow from forked branch with updates f…
TerryMcGuinness-NOAA May 31, 2024
366c381
did a full init submodule in the runner
TerryMcGuinness-NOAA May 31, 2024
257c033
print config object in setup xml on running
TerryMcGuinness-NOAA May 31, 2024
3502963
revert to wxflow develop and pip install wxflow
TerryMcGuinness-NOAA May 31, 2024
205d367
mud hurling with python 3.7.16 and bash in runner
TerryMcGuinness-NOAA May 31, 2024
07f9c31
add directive to use bash in running tests in runner
TerryMcGuinness-NOAA May 31, 2024
8285280
comment out setup xml line
TerryMcGuinness-NOAA May 31, 2024
f45caca
remove extra clons and python leader to exp code
TerryMcGuinness-NOAA May 31, 2024
b457a9f
trying to submodule only wxflow and gsi_utils
TerryMcGuinness-NOAA May 31, 2024
e1b4907
added code for bash in config
TerryMcGuinness-NOAA May 31, 2024
a3ff0b6
updated pip clone from forked wxflow and removed some smack
TerryMcGuinness-NOAA May 31, 2024
5c726dd
restored setup xml
TerryMcGuinness-NOAA May 31, 2024
75f44b4
condenced the test themselfs
TerryMcGuinness-NOAA May 31, 2024
1cad3a2
just removed line for extra var to setup_expt
TerryMcGuinness-NOAA May 31, 2024
92d2208
updated HPC_ACCOUNT to ACCOUNT in bash config of ci platforms to test…
TerryMcGuinness-NOAA May 31, 2024
08b7b9f
Delete ci/scripts/tests/wxflow
TerrenceMcGuinness-NOAA May 31, 2024
e48fedd
Merge branch 'develop' into ci_unit-tests
TerryMcGuinness-NOAA Jun 3, 2024
65343f9
added addtional check to make sure the Configure object is getting po…
TerryMcGuinness-NOAA Jun 4, 2024
3c9bb58
added more details to testing Configuration updates and consolidation…
TerryMcGuinness-NOAA Jun 5, 2024
c7282dc
few shell norms
TerryMcGuinness-NOAA Jun 5, 2024
c1adce8
pynorm spaces in test codes
TerryMcGuinness-NOAA Jun 5, 2024
3e256dc
moved shell script that performs the export to the test code and adde…
TerryMcGuinness-NOAA Jun 5, 2024
55c28f4
single pynorm white space
TerryMcGuinness-NOAA Jun 5, 2024
d0bfa61
added HOMEgfs and checked for no UNKNOWN
TerryMcGuinness-NOAA Jun 5, 2024
df915d4
removed {} from script string
TerryMcGuinness-NOAA Jun 5, 2024
1387d78
removed gsi_utils from Runner
TerryMcGuinness-NOAA Jun 5, 2024
5da70e4
did not need detect machine in gsi utils
TerryMcGuinness-NOAA Jun 5, 2024
b7eeae8
udate wxflow updates to the PR
TerryMcGuinness-NOAA Jun 5, 2024
526e6f4
hardened the test to include the corner case when a user sets an envi…
TerryMcGuinness-NOAA Jun 6, 2024
494690d
update to latest update of configuration.py in wxflow (using grep for…
TerryMcGuinness-NOAA Jun 6, 2024
d30d11f
Merge branch 'NOAA-EMC:develop' into ci_unit-tests
TerrenceMcGuinness-NOAA Jun 11, 2024
4e882f7
Merge branch 'NOAA-EMC:develop' into ci_unit-tests
TerrenceMcGuinness-NOAA Jun 24, 2024
fc15469
added fix to rocotostat for stalled case and remove dependances to up…
TerryMcGuinness-NOAA Jun 24, 2024
892ece9
update to current gitmodules without wxflow updates
TerryMcGuinness-NOAA Jun 24, 2024
236e5f6
update to default wxflow
TerryMcGuinness-NOAA Jun 24, 2024
f553a33
needed pynorms space after :
TerryMcGuinness-NOAA Jun 24, 2024
9d329bb
still need to do the pip install of wxflow to get all the Jinja stuff…
TerryMcGuinness-NOAA Jun 24, 2024
371d532
Merge branch 'NOAA-EMC:develop' into ci_unit-tests
TerrenceMcGuinness-NOAA Jun 25, 2024
8b527c8
Update ci/scripts/tests/test_setup.py
TerrenceMcGuinness-NOAA Jun 25, 2024
acc8d3c
Update ci/scripts/tests/test_setup.py
TerrenceMcGuinness-NOAA Jun 25, 2024
6bcc3b5
updated to python wget and renamed github action control file
TerryMcGuinness-NOAA Jun 25, 2024
8d638ee
removed other yaml action file
TerryMcGuinness-NOAA Jun 25, 2024
fd4aa91
added mkdir -p to full path to testdata
TerryMcGuinness-NOAA Jun 25, 2024
fab6843
updated python install in runner to 3.13.0
TerryMcGuinness-NOAA Jun 25, 2024
c511207
updated python install in runner to 3.12.3 for x64 Ubu
TerryMcGuinness-NOAA Jun 25, 2024
c25dda8
updated pytest to version 8.2.2
TerryMcGuinness-NOAA Jun 25, 2024
6d3a462
removed verson of pytest got get latest for pythohn 3.13.3
TerryMcGuinness-NOAA Jun 25, 2024
c52bfc2
removed verson of wxflow
TerryMcGuinness-NOAA Jun 25, 2024
dd5e58c
downgraded to python 3.11.8 because distutils was depretiated from 3.12
TerryMcGuinness-NOAA Jun 25, 2024
01bc144
took out shell wrapper that was exporting env vars
TerryMcGuinness-NOAA Jun 25, 2024
f59819d
added extra subdir for pysdo hera file system
TerryMcGuinness-NOAA Jun 25, 2024
7102f0d
investigating EXPDIR
TerryMcGuinness-NOAA Jun 25, 2024
7c14d55
investigating EXPDIR
TerryMcGuinness-NOAA Jun 25, 2024
1f599e3
still trying to debug EXPDIR key error
TerryMcGuinness-NOAA Jun 25, 2024
d2db0be
still trying to debug EXPDIR key error still
TerryMcGuinness-NOAA Jun 25, 2024
7965a9b
adding in the other tests
TerryMcGuinness-NOAA Jun 25, 2024
e18ee96
adding in the other tests crap
TerryMcGuinness-NOAA Jun 25, 2024
8b8fe34
outputing EXPDIR before running Config in setup xml
TerryMcGuinness-NOAA Jun 25, 2024
2b3a122
outputing EXPDIR before running Config in setup xml 2
TerryMcGuinness-NOAA Jun 25, 2024
f6d5dd6
tring env unclaching wxflow repo to see if it is solving the EXPDIR p…
TerryMcGuinness-NOAA Jun 25, 2024
69b226e
try test with updated wxflow (if works then get to that fix)
TerryMcGuinness-NOAA Jun 25, 2024
5300dc2
added corner case for checking expected fail for when name snapces ar…
TerryMcGuinness-NOAA Jun 26, 2024
c5b6386
Merge branch 'NOAA-EMC:develop' into ci_unit-tests
TerrenceMcGuinness-NOAA Jun 26, 2024
0661d4c
no op for ci self test
TerryMcGuinness-NOAA Jun 26, 2024
f513eeb
Merge branch 'NOAA-EMC:develop' into ci_unit-tests
TerrenceMcGuinness-NOAA Jun 27, 2024
cf80b96
reverted wxflow to develop in github runner
TerryMcGuinness-NOAA Jun 27, 2024
f16c3eb
removed setting name clashes in create expt test
TerryMcGuinness-NOAA Jun 27, 2024
f447a7a
updated wxfow directly in runner
TerryMcGuinness-NOAA Jun 27, 2024
bc96a14
had a mistake in setting ACCOUNT in yaml defaults
TerryMcGuinness-NOAA Jun 27, 2024
7132896
had to checkout gfs_utils because link script uses detect machine in …
TerryMcGuinness-NOAA Jun 27, 2024
06f58dc
added bash update branch for Configure class in wxflow
TerryMcGuinness-NOAA Jun 27, 2024
cbda739
spelled WORKSPACE wrong
TerryMcGuinness-NOAA Jun 27, 2024
57d99b1
updated git wxflow module to use branch donfig_env_bash
TerryMcGuinness-NOAA Jun 27, 2024
281a5c9
removed wxflow branch designation and moved it to git modules file
TerryMcGuinness-NOAA Jun 27, 2024
cc56219
updated wxflow to config_env_bash branch
TerryMcGuinness-NOAA Jun 27, 2024
3df1ec7
updated gitmodules and added explicit checkout of config_env_bash
TerryMcGuinness-NOAA Jun 27, 2024
58e46fa
downgraded python3 to 3.6.8 because sourcing config.fcst is failing
TerryMcGuinness-NOAA Jun 27, 2024
66d7cf7
cloned config_env_xor to find a success path for this branches unit t…
TerryMcGuinness-NOAA Jun 27, 2024
df9d920
reverted back to python 3.11.8
TerryMcGuinness-NOAA Jun 27, 2024
9628308
changed -branch to -b in git clone wxflow
TerryMcGuinness-NOAA Jun 27, 2024
c4bc9ce
needed other repos for this case in the setup unit test
TerryMcGuinness-NOAA Jun 27, 2024
445658b
needed to pip install config_env_bash when resolving import wxflow in…
TerryMcGuinness-NOAA Jun 27, 2024
047a71b
restored pytest line with results specified
TerryMcGuinness-NOAA Jun 27, 2024
5f9c85e
reverting back to wxflow develop
TerryMcGuinness-NOAA Jun 28, 2024
8bad9d1
added soft link to wxflow for running in ci unit test dir
TerryMcGuinness-NOAA Jun 28, 2024
b86aa8c
updated publish to use laten-1 decoding for handeling color control c…
TerryMcGuinness-NOAA Jun 28, 2024
e99efcc
added test for creatig experment
TerryMcGuinness-NOAA Jun 28, 2024
47735e6
added EXPDIR that was missing in PR message ponting to where it is on…
TerryMcGuinness-NOAA Jun 28, 2024
0e82a70
fixed lingering HPC_ACCOUT and cleaned up old setup xml test
TerryMcGuinness-NOAA Jun 28, 2024
9bcf7e5
fixed pynorms spacing and git tab line in gitmoduels
TerryMcGuinness-NOAA Jun 28, 2024
d7fe0fd
Update ci/scripts/tests/test_create_experiment.py
TerrenceMcGuinness-NOAA Jul 1, 2024
33e03c2
Update ci/scripts/tests/test_setup.py
TerrenceMcGuinness-NOAA Jul 1, 2024
8582ea0
Update ci/scripts/tests/test_setup.py
TerrenceMcGuinness-NOAA Jul 1, 2024
8e2fc67
no op for ci self test
TerryMcGuinness-NOAA Jun 26, 2024
68447dc
Merge branch 'TerrenceMcGuinness-NOAA-ci_unit-tests_wxflow_develop' i…
TerryMcGuinness-NOAA Jul 1, 2024
594d4a3
the tripple sing quoting for srting output icludes the charage return…
TerryMcGuinness-NOAA Jul 1, 2024
a348065
Update ci/scripts/tests/test_setup.py
TerrenceMcGuinness-NOAA Jul 1, 2024
0a44a1b
corrected typo of unit test github control file
TerryMcGuinness-NOAA Jul 1, 2024
e111124
removed no-op line from driver
TerryMcGuinness-NOAA Jul 1, 2024
c3201a0
Merge branch 'develop' into ci_unit-tests_wxflow_develop
TerryMcGuinness-NOAA Jul 2, 2024
d9b8e2f
trying failFast false in build stage to see if we can get it to proce…
TerryMcGuinness-NOAA Jul 3, 2024
9b7f62b
tring to use catchError block over the buid stage instead
TerryMcGuinness-NOAA Jul 3, 2024
0ad6496
added fail flag and failFast true to gracious gracious build fails
TerryMcGuinness-NOAA Jul 3, 2024
f7095cb
force error on checkout too with update catch block
TerryMcGuinness-NOAA Jul 3, 2024
7aaf338
added parallelsAlwaysFailFast becsue failFast alone did not work, als…
TerryMcGuinness-NOAA Jul 3, 2024
c5664f5
options block with parallelsAlwaysFailFast was not valid for matrix
TerryMcGuinness-NOAA Jul 3, 2024
307b36d
Update ci/scripts/tests/test_create_experiment.py
TerrenceMcGuinness-NOAA Jul 4, 2024
ca198cf
Merge branch 'develop' into ci_unit-tests_wxflow_develop
aerorahul Jul 4, 2024
e3c9901
Merge branch 'NOAA-EMC:develop' into ci_unit-tests_wxflow_develop
TerrenceMcGuinness-NOAA Jul 8, 2024
d9a5cce
Merge branch 'NOAA-EMC:develop' into ci_unit-tests_wxflow_develop
TerrenceMcGuinness-NOAA Jul 10, 2024
c68e5be
added try block on create experment so message is set to user and lab…
TerryMcGuinness-NOAA Jul 10, 2024
0bcbab0
test creating of all ci pr experments
Jul 10, 2024
aff12e4
added all yaml cases for create experement that do not have IC to uni…
TerryMcGuinness-NOAA Jul 10, 2024
54c931c
fixed indent in create test and catch sytnax in pipeline
Jul 10, 2024
6c74ed7
added paralelsAlwaysFailFast in Jenkins Pipeline
Jul 11, 2024
6cd7fd8
Merge branch 'NOAA-EMC:develop' into ci_unit-tests_wxflow_develop
TerrenceMcGuinness-NOAA Jul 11, 2024
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
64 changes: 64 additions & 0 deletions .github/workflows/ci_unit_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI Unit Tests
on: [pull_request, push, workflow_dispatch]

jobs:

ci_pytest:
runs-on: ubuntu-latest
name: Run unit tests on CI system
permissions:
checks: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11.8

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y perl libxml-libxml-perl libxml-libxslt-perl libdatetime-perl
python -m pip install --upgrade pip
pip install pytest
pip install wxflow
pip install wget

- name: Cache Rocoto Install
uses: actions/cache@v4
with:
path: ~/rocoto
key: ${{ runner.os }}-rocoto-${{ hashFiles('**/ci-unit_tests.yaml') }}

- name: Install Rocoto
run: |
if [ ! -d "$HOME/rocoto/bin" ]; then
git clone https://github.com/christopherwharrop/rocoto.git $HOME/rocoto
cd $HOME/rocoto
./INSTALL
fi
echo "$HOME/rocoto/bin" >> $GITHUB_PATH

- name: Run tests
shell: bash
run: |
sudo mkdir -p /scratch1/NCEPDEV
cd $GITHUB_WORKSPACE/sorc
git submodule update --init --recursive
./link_workflow.sh
cd $GITHUB_WORKSPACE/ci/scripts/tests
ln -s ../wxflow

pytest -v --junitxml $GITHUB_WORKSPACE/ci/scripts/tests/test-results.xml


- name: Publish Test Results
if: always()
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: ci/scripts/tests/test-results.xml
job_summary: true
comment_mode: off
29 changes: 19 additions & 10 deletions ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pipeline {

options {
skipDefaultCheckout()
//parallelsAlwaysFailFast()
parallelsAlwaysFailFast()
}

stages { // This initial stage is used to get the Machine name from the GitHub labels on the PR
Expand Down Expand Up @@ -90,9 +90,6 @@ pipeline {
stage('3. Build System') {
matrix {
agent { label NodeName[machine].toLowerCase() }
//options {
// throttle(['global_matrix_build'])
//}
axes {
axis {
name 'system'
Expand All @@ -102,6 +99,7 @@ pipeline {
stages {
stage('build system') {
steps {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
script {
def HOMEgfs = "${CUSTOM_WORKSPACE}/${system}" // local HOMEgfs is used to build the system on per system basis under the custome workspace for each buile system
sh(script: "mkdir -p ${HOMEgfs}")
Expand All @@ -120,8 +118,8 @@ pipeline {
if (env.CHANGE_ID) {
sh(script: """${GH} pr comment ${env.CHANGE_ID} --repo ${repo_url} --body "Checkout **Failed** on ${Machine}: ${e.getMessage()}" """)
}
echo "Failed to checkout: ${e.getMessage()}"
STATUS = 'Failed'
error("Failed to checkout: ${e.getMessage()}")
}
def gist_url = ""
def error_logs = ""
Expand Down Expand Up @@ -155,6 +153,7 @@ pipeline {
} catch (Exception error_comment) {
echo "Failed to comment on PR: ${error_comment.getMessage()}"
}
STATUS = 'Failed'
error("Failed to build system on ${Machine}")
}
}
Expand All @@ -174,14 +173,17 @@ pipeline {
}
}
}
}
}
}
}
}
}

stage('4. Run Tests') {
failFast false
when {
expression { STATUS != 'Failed' }
}
matrix {
agent { label NodeName[machine].toLowerCase() }
axes {
Expand All @@ -198,22 +200,28 @@ pipeline {
expression { return caseList.contains(Case) }
}
steps {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
script {
sh(script: "sed -n '/{.*}/!p' ${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${Case}.yaml > ${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${Case}.yaml.tmp")
def yaml_case = readYaml file: "${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${Case}.yaml.tmp"
system = yaml_case.experiment.system
def HOMEgfs = "${CUSTOM_WORKSPACE}/${system}" // local HOMEgfs is used to populate the XML on per system basis
env.RUNTESTS = "${CUSTOM_WORKSPACE}/RUNTESTS"
sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh create_experiment ${HOMEgfs}/ci/cases/pr/${Case}.yaml")
try {
error_output = sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh create_experiment ${HOMEgfs}/ci/cases/pr/${Case}.yaml", returnStdout: true).trim()
} catch (Exception error_create) {
sh(script: """${GH} pr comment ${env.CHANGE_ID} --repo ${repo_url} --body "${Case} **FAILED** to create experment on ${Machine}\n with the error:\n\\`\\`\\`\n${error_output}\\`\\`\\`" """)
error("Case ${Case} failed to create experment directory")
}
}
}
}
}

stage('Run Experiments') {
when {
expression { return caseList.contains(Case) }
}
failFast false
steps {
script {
HOMEgfs = "${CUSTOM_WORKSPACE}/gfs" // common HOMEgfs is used to launch the scripts that run the experiments
Expand Down Expand Up @@ -255,11 +263,11 @@ pipeline {
STATUS = 'Failed'
try {
sh(script: """${GH} pr edit ${env.CHANGE_ID} --repo ${repo_url} --remove-label "CI-${Machine}-Running" --add-label "CI-${Machine}-${STATUS}" """, returnStatus: true)
sh(script: """${GH} pr comment ${env.CHANGE_ID} --repo ${repo_url} --body "Experiment ${Case} **FAILED** on ${Machine} in\n\\`${CUSTOM_WORKSPACE}/RUNTESTS/${pslot}\\`" """)
sh(script: """${GH} pr comment ${env.CHANGE_ID} --repo ${repo_url} --body "Experiment ${Case} **FAILED** on ${Machine} in\n\\`${CUSTOM_WORKSPACE}/RUNTESTS/EXPDIR/${pslot}\\`" """)
} catch (Exception e) {
echo "Failed to update label from Running to ${STATUS}: ${e.getMessage()}"
}
error("Failed to run experiments ${Case} on ${Machine}")
echo "Failed to run experiments ${Case} on ${Machine}"
}
}
}
Expand All @@ -268,6 +276,7 @@ pipeline {
}
}
}

stage( '5. FINALIZE' ) {
agent { label NodeName[machine].toLowerCase() }
steps {
Expand Down
2 changes: 1 addition & 1 deletion ci/cases/yamls/gefs_ci_defaults.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defaults:
!INC {{ HOMEgfs }}/parm/config/gefs/yaml/defaults.yaml
base:
HPC_ACCOUNT: {{ 'HPC_ACCOUNT' | getenv }}
ACCOUNT: {{ 'HPC_ACCOUNT' | getenv }}
TerrenceMcGuinness-NOAA marked this conversation as resolved.
Show resolved Hide resolved
29 changes: 29 additions & 0 deletions ci/scripts/tests/test_create_experiment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from wxflow import Executable
from shutil import rmtree
import os
import copy

_here = os.path.dirname(__file__)
HOMEgfs = os.sep.join(_here.split(os.sep)[:-3])
RUNDIR = os.path.join(_here, 'testdata/RUNDIR')


def test_create_experiment():

create_experiment_script = Executable(f'{HOMEgfs}/workflow/create_experiment.py')
yaml_dir = yaml_dir = os.path.join(HOMEgfs, 'ci/cases/pr')
env = os.environ.copy()
env['RUNTESTS'] = RUNDIR

for case in os.listdir(yaml_dir):
if case.endswith('.yaml'):
with open(os.path.join(yaml_dir, case), 'r') as file:
file_contents = file.read()
if 'ICSDIR_ROOT' not in file_contents:
create_experiment = copy.deepcopy(create_experiment_script)
create_experiment.add_default_arg(['-y', f'../../cases/pr/{case}', '--overwrite'])
env['pslot'] = os.path.splitext(case)[0]
create_experiment(env=env)
assert (create_experiment.returncode == 0)

rmtree(RUNDIR)
90 changes: 90 additions & 0 deletions ci/scripts/tests/test_rocotostat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import sys
import os
from shutil import rmtree
import wget

script_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(os.path.dirname(script_dir), 'utils'))

from rocotostat import rocoto_statcount, rocotostat_summary, is_done, is_stalled, CommandNotFoundError
from wxflow import which

test_data_url = 'https://noaa-nws-global-pds.s3.amazonaws.com/data/CI/'

testdata_path = 'testdata/rocotostat'
testdata_full_path = os.path.join(script_dir, testdata_path)


if not os.path.isfile(os.path.join(testdata_full_path, 'database.db')):
os.makedirs(testdata_full_path, exist_ok=True)
workflow_url = test_data_url + str(testdata_path) + '/workflow.xml'
workflow_destination = os.path.join(testdata_full_path, 'workflow.xml')
wget.download(workflow_url, workflow_destination)

database_url = test_data_url + str(testdata_path) + '/database.db'
database_destination = os.path.join(testdata_full_path, 'database.db')
wget.download(database_url, database_destination)

try:
rocotostat = which('rocotostat')
except CommandNotFoundError:
raise CommandNotFoundError("rocotostat not found in PATH")

rocotostat.add_default_arg(['-w', os.path.join(testdata_path, 'workflow.xml'), '-d', os.path.join(testdata_path, 'database.db')])


def test_rocoto_statcount():

result = rocoto_statcount(rocotostat)

assert result['SUCCEEDED'] == 20
assert result['FAIL'] == 0
assert result['DEAD'] == 0
assert result['RUNNING'] == 0
assert result['SUBMITTING'] == 0
assert result['QUEUED'] == 0


def test_rocoto_summary():

result = rocotostat_summary(rocotostat)

assert result['CYCLES_TOTAL'] == 1
assert result['CYCLES_DONE'] == 1


def test_rocoto_done():

result = rocotostat_summary(rocotostat)

assert is_done(result)

rmtree(testdata_full_path)


def test_rocoto_stalled():
testdata_path = 'testdata/rocotostat_stalled'
testdata_full_path = os.path.join(script_dir, testdata_path)
xml = os.path.join(testdata_full_path, 'stalled.xml')
db = os.path.join(testdata_full_path, 'stalled.db')

if not os.path.isfile(os.path.join(testdata_full_path, 'stalled.db')):
os.makedirs(testdata_full_path, exist_ok=True)
workflow_url = test_data_url + str(testdata_path) + '/stalled.xml'
database_url = test_data_url + str(testdata_path) + '/stalled.db'

workflow_destination = os.path.join(testdata_full_path, 'stalled.xml')
wget.download(workflow_url, workflow_destination)

database_destination = os.path.join(testdata_full_path, 'stalled.db')
wget.download(database_url, database_destination)

rocotostat = which('rocotostat')
rocotostat.add_default_arg(['-w', xml, '-d', db])

result = rocoto_statcount(rocotostat)

assert result['SUCCEEDED'] == 11
assert is_stalled(result)

rmtree(testdata_full_path)
89 changes: 89 additions & 0 deletions ci/scripts/tests/test_setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
from wxflow import Executable, Configuration, ProcessError
from shutil import rmtree
import pytest
import os

_here = os.path.dirname(__file__)
HOMEgfs = os.sep.join(_here.split(os.sep)[:-3])
RUNDIR = os.path.join(_here, 'testdata/RUNDIR')
pslot = "C48_ATM"
account = "fv3-cpu"
TerrenceMcGuinness-NOAA marked this conversation as resolved.
Show resolved Hide resolved
foobar = "foobar"


def test_setup_expt():

arguments = [
"gfs", "forecast-only",
"--pslot", pslot, "--app", "ATM", "--resdetatmos", "48",
"--comroot", f"{RUNDIR}", "--expdir", f"{RUNDIR}",
"--idate", "2021032312", "--edate", "2021032312", "--overwrite"
]
setup_expt_script = Executable(os.path.join(HOMEgfs, "workflow", "setup_expt.py"))
setup_expt_script.add_default_arg(arguments)
setup_expt_script()
assert (setup_expt_script.returncode == 0)


def test_setup_xml():

setup_xml_script = Executable(os.path.join(HOMEgfs, "workflow/setup_xml.py"))
setup_xml_script.add_default_arg(f"{RUNDIR}/{pslot}")
setup_xml_script()
assert (setup_xml_script.returncode == 0)

cfg = Configuration(f"{RUNDIR}/{pslot}")
base = cfg.parse_config('config.base')
assert base.ACCOUNT == account
TerrenceMcGuinness-NOAA marked this conversation as resolved.
Show resolved Hide resolved

assert "UNKNOWN" not in base.values()

with open(f"{RUNDIR}/{pslot}/{pslot}.xml", 'r') as file:
contents = file.read()
assert contents.count(account) > 5

rmtree(RUNDIR)


def test_setup_xml_fail_config_env_cornercase():

script_content = ('''#!/usr/bin/env bash
export HOMEgfs=foobar
../../../workflow/setup_xml.py "${1}"\n
''')

with open('run_setup_xml.sh', 'w') as file:
file.write(script_content)
os.chmod('run_setup_xml.sh', 0o755)

try:
setup_xml_script = Executable(os.path.join(HOMEgfs, "ci", "scripts", "tests", "run_setup_xml.sh"))
setup_xml_script.add_default_arg(f"{RUNDIR}/{pslot}")
setup_xml_script()
assert (setup_xml_script.returncode == 0)

cfg = Configuration(f"{RUNDIR}/{pslot}")
base = cfg.parse_config('config.base')
assert base.ACCOUNT == account

assert foobar not in base.values()
assert "UNKNOWN" not in base.values()

with open(f"{RUNDIR}/{pslot}/{pslot}.xml", 'r') as file:
contents = file.read()
assert contents.count(account) > 5

except ProcessError as e:
# We expect this fail becuse ACCOUNT=fv3-cpu in config.base and environment
pass
except Exception as e:
# If an exception occurs, pass the test with a custom message
pytest.fail(f"Expected exception occurred: {e}")
TerrenceMcGuinness-NOAA marked this conversation as resolved.
Show resolved Hide resolved

finally:
# Cleanup code to ensure it runs regardless of test outcome
os.remove('run_setup_xml.sh')
try:
rmtree(RUNDIR)
except FileNotFoundError:
pass
Loading
Loading