-
Notifications
You must be signed in to change notification settings - Fork 448
Trying out GHA for coverage and debug builds #11198
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
base: develop
Are you sure you want to change the base?
Conversation
|
||
- name: Install coverage tools | ||
shell: bash | ||
run: sudo apt-get update && sudo apt-get install lcov gcovr |
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.
AFAIK, pip install gcovr
pulls in 8.3, while apt on ubuntu 24.04 pulls in 7.0
- name: Prepare Initial Coverage Results | ||
shell: bash | ||
working-directory: ./build | ||
run: lcov -c -d . -o ./lcov.output --no-external --base-directory ../src/EnergyPlus --ignore-errors source | ||
|
||
- name: Clean up Coverage Results | ||
shell: bash | ||
working-directory: ./build | ||
run: lcov -r ./lcov.output `pwd`/\* -o ./lcov.output.filtered --ignore-errors source | ||
|
||
- name: Generate HTML Coverage Package | ||
shell: bash | ||
working-directory: ./build | ||
run: genhtml ./lcov.output.filtered -o lcov-html --demangle-cpp --function-coverage --synthesize-missing |
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'm confused by the use the lcov
and genhtml
here. What's the point of installing gcovr
then?
I have an older coverage test repo:
https://github.com/jmarrec/TestCpp-GHA-Coverage/blob/a7681924a92306a05a9d8486f8f1bdcd079b6239/.github/workflows/build.yml#L86-L99
gcovr -j $(nproc) --delete --root ../ --exclude '.*GTest.cpp' --print-summary --xml-pretty --xml coverage.xml .
So I guess you'd do something like this?
gcovr -j $(nproc) --delete --root ../ --exclude '.*unit.cc' --print-summary --html --html-details -o coverage.html
Maybe could do somthing like this too to make a table on the workflow summary page?
- name: Coverage summary
shell: bash
working-directory: ./build
run: |
gcovr --root ../ --txt-summary -o coverage_summary.txt
echo "## Code Coverage" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat coverage_summary.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
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.
gcovr gained a markdown option, unreleased yet.
pip install git+https://github.com/gcovr/gcovr.git
gcovr --root ../ --markdown-summary >> $GITHUB_STEP_SUMMARY
GCC Code Coverage Report
📂 Overall coverage
Metric | Coverage |
---|---|
Lines | 🟢 35/35 (100.0%) |
Functions | 🟢 13/13 (100.0%) |
Branches | 🔴 31/120 (25.8%) |
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.
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.
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.
Eventually I think you'd be doing something like
mkdir html
gcovr -j $(nproc) \
--gcov-ignore-errors=source_not_found \
--gcov-ignore-errors=no_working_dir_found \
--gcov-ignore-parse-errors=suspicious_hits.warn_once_per_file \
--merge-mode-functions=merge-use-line-min \
--print-summary \
--html=html/index.html --html-details \
--markdown=summary.md \
--root ../src/EnergyPlus \
--exclude '.*unit.cc' \
--exclude '.*test/.*' \
--exclude '/usr/.*' \
--gcov-object-directory=.
cat summary.md >> $GITHUB_STEP_SUMMARY
Alright, this is looking OK. @jmarrec may be able to do some fun tweaks to get gcovr working better, but I was finally able to get it to "work". Some quick notes:
OK, that's about enough. I will make a commit to resolve the merge conflict, and clean things up a little. But I would like to call this done so that Decent CI can be done for us as well. |
This is all happy, however, I did see some CI runs were queued waiting on runners. It may have been coincidence, but it's a strong reminder of why I have deferred this in the past. For the sake of all the other github.com/NREL/ projects running Actions, I think it might be a good idea to push this to just develop commits. As I mentioned - it stinks that it means you may not find an array bounds issue, or an infinity, until the PR is merged. But if this ends up eating all the CI runners available on a busy day, the problems are much worse. I'll note that if the ccache stuff is enabled, it may take this down from 123 minutes to like 105. That is great, but it's still a lot. There could also be some intelligence to skip this run if only documentation files are changed or something, but that would be such a small portion of the PRs, it is probably not worth it. The best solution is to stand up a large runner, or a self-hosted runner, that can run these long-duration commits for E+ without dragging down the overall pool of NREL GHA runners. |
How about a commit keyword that could run these upon request on the PR branch? |
The OpenStudio project uses a "Pull Request - Ready for CI" label on the PR to trigger longer CI runs, that's another option. See https://github.com/NREL/OpenStudio/pulls |
@Myoldmopar it has been 9 days since this pull request was last updated. |
@Myoldmopar it has been 7 days since this pull request was last updated. |
@Myoldmopar it has been 8 days since this pull request was last updated. |
Pull request overview
I'm trying out GHA for coverage and debug builds now that @jmarrec made some huge improvements to our CI system and runtime. If it goes real smooth, great. If not, this can be tossed for now.
Description of the purpose of this PR
Pull Request Author
Reviewer