-
Couldn't load subscription status.
- Fork 642
Adds Code Coverage #1076
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
Adds Code Coverage #1076
Conversation
59cfdd8 to
97629a4
Compare
tools/ci/ci_agent.py
Outdated
| log("\n----------------------------------------------------------------") | ||
| log("Upload Code Coverage report to codecov.io") | ||
| log("----------------------------------------------------------------") | ||
| cmd = f"curl -s https://codecov.io/bash | bash -s - -t {codecov_token}" |
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.
Hey... umm... this is a non-starter.
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.
To clarify, I mean running untrusted code is a non-starter.
Codecov Report
@@ Coverage Diff @@
## development #1076 +/- ##
================================================
+ Coverage 96.54% 100.00% +3.45%
================================================
Files 9 4 -5
Lines 5643 1180 -4463
Branches 641 365 -276
================================================
- Hits 5448 1180 -4268
+ Misses 9 0 -9
+ Partials 186 0 -186
Continue to review full report at Codecov.
|
tools/ci/ci_agent.py
Outdated
| target_build_result = target_result.setdefault("CodeCoverage", {}) | ||
| out = _build_target("coverage", src, build_path, build_flags, c_flags) | ||
| log(out) | ||
| out = _run_cmd(f"gcovr -r . -x -o {build_path}/cobertura.xml") |
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.
Does this need to be named cobertura?
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 as we can use this file with cobertura as well
| out = _run_cmd(f"gcovr -r . -x -o {build_path}/cobertura.xml") | ||
| log(out) | ||
|
|
||
| commit_id = os.environ.get("ghprbActualCommit") or "" |
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.
We probably want coverage run on the merge head (${sha1} in Jenkins)
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.
hmm ok
| cmd_code_coverage, | ||
| "--config-file", | ||
| "--src", | ||
| "--build-path", | ||
| "--build-flags", | ||
| "--c-flags", | ||
| "--codecov-token", | ||
| ) |
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.
At this point I'm inclined to think we should just take the config as an argument and do the rest through the config or environment variables. It's getting difficult to grapple with all the options.
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.
config is one of the argument, we have options to override options in config
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 not convinced that flexibility is required.
| return result | ||
|
|
||
|
|
||
| def _build_code_coverage(src, build_path, build_flags, c_flags, codecov_token): |
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.
what's the significance of build_flags vs c_flags?
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.
in csdk we have 2 levels of flags one for cmake and other for compiler
build_flags is for cmake and c_flags are for compiler
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 don't like the build_flags name. But at the very least we should have a descriptive doc string saying what they are.
* Adds code to create coverage report * Adds option to upload report to codecov.io
tools/ci/ci_agent.py
Outdated
| target_build_result = target_result.setdefault("CodeCoverage", {}) | ||
| out = _build_target("coverage", src, build_path, build_flags, c_flags) | ||
| log(out) | ||
| out = _run_cmd(f"gcovr -r . -x -o {build_path}/cobertura.xml") |
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.
Looks like this might be passed to a shell - so what happens if build path contains a space?
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.
or worse, a semicolon...
4be5512 to
f55fbf7
Compare
* Adds Code Coverage * Adds code to create coverage report * Adds option to upload report to codecov.io * Use requests
* Adds Code Coverage * Adds code to create coverage report * Adds option to upload report to codecov.io * Use requests
* Adds Code Coverage * Adds code to create coverage report * Adds option to upload report to codecov.io * Use requests
* Adds Code Coverage * Adds code to create coverage report * Adds option to upload report to codecov.io * Use requests
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.