Add running the unittests to the GitHub workflow#321
Add running the unittests to the GitHub workflow#321Zubair Maalick (zmaalick) wants to merge 41 commits into
Conversation
mo-nikosbaltas
left a comment
There was a problem hiding this comment.
Although the unit tests block is correct and works, my suggestion is:
Instead of:
eval "$(conda shell.bash hook)"
conda activate cmew
...
Use conda run:
conda run -n cmew cylc validate -O metoffice -O unittest .
This eliminates shell activation issues and is more reliable in Actions.
This also applies to other tests in this file.
As already said this is a suggestion.
- name: Run Cylc unit tests
run: |
cd CMEW
conda run -n cmew cylc vip -O metoffice -O unittest .
Although not applicable for this issue I would suggest to include some logging by adding at the end:
- name: Upload cylc-run logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: cylc-run-logs
path: ~/cylc-run
Otherwise it is all good for me.
|
The unit tests should read: not In my previous comment I was giving an example for 'cylc validate'. Sorry if I confused you. Also the checks failed when pushing. Can you correct? |
Made the changes and also added the logging. Working fine. |
mo-nikosbaltas
left a comment
There was a problem hiding this comment.
Modify PR title to : #321: Add running the unittests to the GitHub workflow. See https://github.com/MetOffice/CMEW/wiki/Detailed-Working-Practices#create-a-pull-request
Done |
|
Also, Zubair Maalick (@zmaalick) can you change the copyright years (# (C) Crown Copyright 2022-2025, Met Office.) in the file to 2022-2026. |
Done |
Emma Hogan (ehogan)
left a comment
There was a problem hiding this comment.
Thanks Zubair Maalick (@zmaalick) 🥳
The "end of new line" issue with one of the files in this branch suggests you have not set up the pre-commit hooks. Please set up the pre-commit hooks. Instructions are available at https://github.com/MetOffice/CMEW/wiki/First-time-developer-instructions#first-time-developer-instructions.
Emma Hogan (ehogan)
left a comment
There was a problem hiding this comment.
Thanks Zubair Maalick (@zmaalick) 😊
Now that the pytest configuration has been added, please remove the cd command to be removed from the unittest app.
Emma Hogan (ehogan)
left a comment
There was a problem hiding this comment.
Thanks Zubair Maalick (@zmaalick), just one more outstanding change (and I will add to the working practices that the developer should check the changes in the "Files changed" tab and perform a self-review before requesting a review).
Emma Hogan (ehogan)
left a comment
There was a problem hiding this comment.
Thanks Zubair Maalick (@zmaalick) 🥳
pytest on the command line, cylc vip -O metoffice -O test and cylc vip -O metoffice -O unittest all return the same output 🎉
| = cmew-esmvaltool-env pytest | ||
| =cmew-esmvaltool-env pytest | ||
|
|
||
| [file:pytest.ini] |
There was a problem hiding this comment.
I feel it would be clearer if the full path was specified here, rather than specifying file-install-root at the top of this file. Also, would it be possible to use .pytest.ini rather than pytest.ini, please?
| [file:pytest.ini] | |
| [file:${CYLC_WORKFLOW_RUN_DIR/.pytest.ini] |
There was a problem hiding this comment.
There was a problem hiding this comment.
Also, would it be possible to use
.pytest.inirather thanpytest.ini, please?
Please also update the name of the file in the repository from pytest.ini to .pytest.ini.
There was a problem hiding this comment.
There was a problem hiding this comment.
As mentioned at #321 (comment) and in a previous retro where we agreed to update the PR checklist with the point "Remember to re-check the Definition of Done after making changes in response to a review.", please re-check the Definition of Done after making this change (particularly the testing).
There was a problem hiding this comment.
in `app/unittest' we are doing:
[file:$CYLC_WORKFLOW_RUN_DIR/.pytest.ini]
source=git:https://github.com/MetOffice/CMEW.git::pytest.ini::165_add_unittest_in_github_workflow
cylc does not read hidden files. Making pytest.ini to .pytest.ini will not work in cylc. (that is why unitest are failing in cylc)
we need to convert it back to pytest.ini to make it work.
Closes #165 .
PR creation checklist for the developer
<issue_number>above ☝️ been replaced with the issue number?mainbeen selected as the base branch?<issue_number>_<short_description_of_feature>?good first issuelabel) been added to the PR?Climate Model Evaluation Workflow (CMEW)project been added to the PR?Definition of Done for the developer
docdirectory) related to the change been updated appropriately, including the Quick Start section?PR creation checklist for the reviewer
<issue_number>above ☝️ been replaced with the issue number?mainbeen selected as the base branch?<issue_number>_<short_description_of_feature>?good first issuelabel) been added to the PR?Climate Model Evaluation Workflow (CMEW)project been added to the PR?Definition of Done for the reviewer
docdirectory) related to the change been updated appropriately including the Quick Start section? N/A