-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add github actions for python unittests. #747
Merged
danielabdi-noaa
merged 10 commits into
ufs-community:develop
from
danielabdi-noaa:feature/actions
May 16, 2022
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2b36e92
Add github actions for python unittests.
dshawul 0c1a7b9
Include all python script in ush
danielabdi-noaa 97bba82
Merge branch 'develop' into feature/actions
danielabdi-noaa 53bad22
Skip defining QUILTING params when it is set to False
danielabdi-noaa e75a580
Update py_workflow
danielabdi-noaa 650ae64
Update unittest for set_extrn_mdl_params.
danielabdi-noaa 5065fc1
Merge branch 'develop' into feature/actions
danielabdi-noaa 84ab407
Updates from develop.
danielabdi-noaa ef8ba9f
Merge branch 'develop' into feature/actions
danielabdi-noaa e14ed47
Merge branch 'develop' into feature/actions
danielabdi-noaa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Python unittests | ||
on: [push, pull_request] | ||
jobs: | ||
|
||
python_unittests: | ||
name: Python unittests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# Install dependencies | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install python3 python3-pip netcdf-bin | ||
sudo pip3 install pyyaml jinja2 f90nml | ||
|
||
# Run python unittests | ||
- name: Run python unittests | ||
run: | | ||
cd ush | ||
python3 -m unittest -b python_utils/test_python_utils.py | ||
python3 -m unittest -b check_ruc_lsm.py create_diag_table_file.py \ | ||
create_model_configure_file.py link_fix.py set_cycle_dates.py \ | ||
set_extrn_mdl_params.py set_FV3nml_sfc_climo_filenames.py \ | ||
set_FV3nml_ens_stoch_seeds.py set_gridparams_ESGgrid.py \ | ||
set_gridparams_GFDLgrid.py set_ozone_param.py \ | ||
set_predef_grid_params.py set_thompson_mp_fix_files.py \ | ||
get_crontab_contents.py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work if there is just a pattern like
*.py
so we don't have to keep track of which files have tests in them?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had issues with some python scripts in
ush
dir and unittests. On hera, for example, numpy and matplotlib needed bymrms_pull_topofhour.py
andUFS_plot_domains.py
, are missing even after activatingwflow_hera.env
, so unittest fails. Moreover, with the former there is an issue with scripts that accept arguments but don't have unittest class implemented -- which I have fixed now.UFS_plot_domains.py
uses deprecated plotting librarayBasemap
frommpl_toolkits
so need to figure out a way to install that for github actions. Or I could simply include all python scripts except problematic ones with some sort of wildcard ...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok all is good now. It doesn't fail with
*.py
but no real unittests are done on python scripts not related to the workflow generation.