-
Notifications
You must be signed in to change notification settings - Fork 41
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 C++ coverage to CI #265
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov Report
@@ Coverage Diff @@
## master #265 +/- ##
=======================================
Coverage 99.73% 99.73%
=======================================
Files 4 4
Lines 383 383
=======================================
Hits 382 382
Misses 1 1
Continue to review full report at Codecov.
|
Hi all, this PR adds C++ coverage to CodeCov. Now it only uploads results from Linux and Windows, but macOS can be also added if it is necessary. Still, it seems like the coverage results only count the lines that are visible under the given environment, i.e. As I also renamed a required test, GH complains a bit about checks, but we may change our GH setting when this is ready to be merged. |
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.
Awesome work @chaeyeunpark
Left a few small comments/questions.
.github/workflows/tests_linux.yml
Outdated
@@ -98,6 +117,21 @@ jobs: | |||
check_name: Test Report (C++) on Ubuntu | |||
files: Build/tests/results/report.xml | |||
|
|||
- name: Build and run unit tests for code coverage | |||
run: | | |||
cmake pennylane_lightning/src -BBuildCov -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON |
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.
Do we need to enable -DENABLE_BLAS=ON
here also?
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.
Oops added 👍
.\Build\tests\Debug\runner.exe --order lex --reporter junit --out .\Build\tests\results\report.xml | ||
OpenCppCoverage --sources pennylane_lightning\src --export_type cobertura:coverage.xml Build\tests\Debug\runner.exe |
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.
Nice work --- this must've been a fun adventure to find
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.
Yes, but as we anyway have an AWS machine for MSVC, it wasn't that challenging 😉
|
||
namespace Pennylane::Util { | ||
#if defined(__x86_64__) && (defined(__GNUC__) || defined(__clang__)) | ||
#if (defined(__GNUC__) || defined(__clang__)) && defined(__x86_64__) |
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 assume __clang__
is also defined on intel's latest compilers (icpx)?
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.
Yes but as it also supports cpuid.h
normally, I think it is fine (also tested locally).
@@ -30,13 +30,15 @@ jobs: | |||
python-version: '3.7' | |||
|
|||
- uses: actions/checkout@v2 | |||
with: | |||
fetch-depth: 2 # for codecov |
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.
Nice -- wasn't aware this is an option.
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.
Yes, Codecov raises this warning. I think this is the reason why CodeCov sometimes couldn't merge coverage data uploaded from the same commit hash.
Add C++ code coverage to GH Action.