-
Notifications
You must be signed in to change notification settings - Fork 461
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?
Changes from 10 commits
b98c0c0
83e4c30
b0c29ae
fb078aa
ce85e18
a2905c8
293d6b9
fc82953
807c72a
fd22dc3
31493f3
f76c72f
567fe53
ec27e3e
4dde722
a81799d
c7c4bce
9e29d11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,108 @@ | ||||||||||
| name: Debug Build and Test | ||||||||||
|
|
||||||||||
| on: | ||||||||||
| pull_request: | ||||||||||
| branches: [ develop ] | ||||||||||
|
|
||||||||||
| env: | ||||||||||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||
| FC: gfortran-13 | ||||||||||
| Python_REQUIRED_VERSION: 3.12.3 # 3.12.2 not available on Ubuntu 24 GHA | ||||||||||
| python-arch: x64 | ||||||||||
| os: ubuntu-24.04 | ||||||||||
|
|
||||||||||
| jobs: | ||||||||||
| build_and_test: | ||||||||||
| name: Debug Testing | ||||||||||
| runs-on: ubuntu-24.04 | ||||||||||
| permissions: | ||||||||||
| pull-requests: write | ||||||||||
|
|
||||||||||
| steps: | ||||||||||
|
|
||||||||||
| - uses: actions/checkout@v5 | ||||||||||
|
|
||||||||||
| - name: Setup System | ||||||||||
| id: setup-runner | ||||||||||
| uses: ./.github/actions/setup-runner | ||||||||||
| with: | ||||||||||
| python-version: ${{ env.Python_REQUIRED_VERSION }} | ||||||||||
| python-arch: ${{ env.python-arch }} | ||||||||||
|
|
||||||||||
| - name: Install coverage tools | ||||||||||
| shell: bash | ||||||||||
| run: sudo apt-get update && sudo apt-get install lcov gcovr | ||||||||||
|
|
||||||||||
| - name: Create Build Directory | ||||||||||
| shell: bash | ||||||||||
| run: cmake -E make_directory ./build/ | ||||||||||
|
|
||||||||||
| - name: Install problem matcher | ||||||||||
| shell: bash | ||||||||||
| run: echo "::add-matcher::./.github/workflows/cpp-problem-matcher.json" | ||||||||||
|
|
||||||||||
| - name: Configure and Build | ||||||||||
| id: branch_build | ||||||||||
| uses: ./.github/actions/configure-and-build | ||||||||||
| with: | ||||||||||
| enable-pch: ${{ env.ENABLE_PCH }} | ||||||||||
| minimal-targets: false | ||||||||||
| build-directory: ./build | ||||||||||
| nproc: ${{ steps.setup-runner.outputs.nproc }} | ||||||||||
| python-version: ${{ env.Python_REQUIRED_VERSION }} | ||||||||||
| python-root-dir: ${{ steps.setup-runner.outputs.python-root-dir }} | ||||||||||
| build-type: "RelWithDebInfo" | ||||||||||
| enable-coverage: "ON" | ||||||||||
| build-python-cli: "OFF" | ||||||||||
|
|
||||||||||
| - name: Remove problem matcher | ||||||||||
| shell: bash | ||||||||||
| run: echo "::remove-matcher owner=gcc-problem-matcher::" | ||||||||||
|
|
||||||||||
| - name: Run Tests | ||||||||||
| working-directory: ./build | ||||||||||
| shell: bash | ||||||||||
| run: | | ||||||||||
| begin_group() { echo -e "::group::\033[93m$1\033[0m"; } | ||||||||||
|
|
||||||||||
| Color_Off='\033[0m' # Text Reset | ||||||||||
|
|
||||||||||
| # Regular Colors | ||||||||||
| Red='\033[0;31m' | ||||||||||
| Green='\033[0;32m' | ||||||||||
|
|
||||||||||
| begin_group "Running CTests" | ||||||||||
| if ctest -j ${{ env.NPROC }}; then | ||||||||||
| echo "::endgroup::" | ||||||||||
| echo -e "✅ ${Green}All tests passed${Color_Off}" | ||||||||||
| else | ||||||||||
| echo "::endgroup::" | ||||||||||
| echo -e "❌ ${Red}Some Tests Failed${Color_Off}" | ||||||||||
| begin_group "Re-running failed tests verbosely..." | ||||||||||
| ctest --rerun-failed -VV | ||||||||||
| echo "::endgroup::" | ||||||||||
| fi; | ||||||||||
|
|
||||||||||
| # - name: Setup upterm session | ||||||||||
| # uses: owenthereal/action-upterm@v1 | ||||||||||
|
|
||||||||||
| - 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 | ||||||||||
|
||||||||||
| 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

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 gcovrpulls in 8.3, while apt on ubuntu 24.04 pulls in 7.0