actions-rs / grcov Goto Github PK
View Code? Open in Web Editor NEW๐ GitHub Action for code coverage reporting with grcov
Home Page: https://github.com/marketplace/actions/rust-grcov
License: MIT License
๐ GitHub Action for code coverage reporting with grcov
Home Page: https://github.com/marketplace/actions/rust-grcov
License: MIT License
Do the checklist before filing an issue:
actions-rs
Actions?I want the --excl-*
options added in grcov v0.5.14 (mozilla/grcov#416) to be mapped to grcov.yml so that one can exclude #[derive(...)]
, mod tests { ... }
, etc. from coverage analysis.
grcov.yml
excl-line: "#\\[derive\\("
excl-br-line: "#\\[derive\\("
excl-start: "mod tests \\{"
excl-br-start: "mod tests \\{"
Do the checklist before filing an issue:
actions-rs
Actions?From-source builds in CI with grcov take time and resources, so utilizing binstall would mean milliseconds instead of minutes for installation.
This requires binstall to be present on the action runner, which can be solved with its action.
- uses: codecov/codecov-action@v3
with:
binstall: true # default = false
Install grcov from cargo install
command cost a lot of time.
Is there any possible to install grcov from binary assets of mozilla/grcov releases.
Example:
grcov merged mozilla/grcov#509 (comment) - it would be great to have access to it from the action.
It would be nice to configure grcov inline with my other workflow commands, similar to how the other actions-rs actions work.
- uses: actions-rs/[email protected]
with:
branch: true
ignore-not-existing: true
llvm: true
filter: covered
output-type: lcov
output-path: ./lcov.info
prefix-dir: /home/user/build/
ignore:
- "/*"
- "C:/*"
- "../*"
path-mapping:
- "/path1"
- "/path2"
I think this method of configuration should probably be mutually exclusive with the separate configuration file.
Do the checklist before filing an issue:
actions-rs
Actions? If not, use GitHub Community forum to ask questions about Actions in a whole: https://github.communityWhen I run the cargo-grcov
action, I need to replace hypens with underscores in order to make it work. Unfortunately, if another subcrate is added, changing hypens to underscores break its compilation.
Searching for coverage files
Found project crates: tree-sitter-core,tree-sitter-tests
##[error]Unable to find any coverage files, was `cargo test` executed correctly?
cargo-grcov
should run regardless of the hypens present in a crate name.
Add any other context about the problem here.
The RUSTFLAGS provided in the README does not work with proc-macro crates because compiling procedural macros requires the panic_unwind
runtime. We would get this error instead:
error: the linked panic runtime `panic_unwind` is not compiled with this crate's panic strategy `abort`
It would be useful to document in the README what is suggested to be done in the case of workspaces with procedural macros. For example, are users advised to override the panic strategy through a certain cfg filter in Cargo.toml? Or are there other suggested tricks?
coverage.getCoverageFiles
does not seem to work correctly for packages like:
[package]
name = "foo-bar-baz"
Line 45 in 3ce5aed
$ node
> 'foo-bar-baz'.replace('-', '_')
'foo_bar-baz'
https://github.com/qryxip/gh-releases-from-actions/runs/493381276
I have a repository with a workspace containing 4 crates.
The 4 crates should appear in the coverage report but 1 is ignored. The crate that is ignored is the first one, fantoch, which has the same name as the repository.
To make sure that's not a coincidence, I've created a repository named test with the same content as fantoch and now all the 4 crates appear in the coverage report.
ignore-not-existing: true
output-type: lcov
output-path: ./lcov.info
ignore:
- "/*"
- "fantoch_ps/src/bin/*"
- "fantoch_bote/src/main.rs"
I have also tried 0.2-proto
in this branch (it was suggested in #51 for a different issue), but the problem still occurs.
While typing I started wondering if the issue is in coverallsapp/github-action@master
and not in this action.
Do the checklist before filing an issue:
actions-rs
Actions?Using a Github Workflow like the one suggested in the documentation, macro invocation is considered as not covered by tests, although it is.
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests -Cinstrument-coverage'
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests -Cinstrument-coverage'
- uses: actions-rs/[email protected]
id: coverage
name: Generate code coverage
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
files: ${{ steps.coverage.outputs.report }}
token: ${{ secrets.CODECOV_TOKEN }}
This code of the thiserror
macro be covered, instead it is not:
#[derive(Error, Debug, PartialEq, Eq)]
pub enum EncodingFormatParsingError {
#[error("Unexpected encoding {0}")] // line not covered
UnexpectedEncoding(String),
}
A pr from fork repository branch always failed:
Please provide the repository token to upload reports via `-t :repository-token`
workflow like this
jobs:
grcov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Clean
uses: actions-rs/cargo@v1
with:
command: clean
- name: Execute tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads"
- name: Gather coverage data
id: coverage
uses: actions-rs/[email protected]
with:
config: configs/grcov.config.yml
coveralls-token: ${{ secrets.COVERALLS_TOKEN }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ${{ steps.coverage.outputs.report }}
fail_ci_if_error: true
pr from same repository branch is ok.
this is the full report: https://github.com/rxRust/rxRust/pull/59/checks
Hi!
Maybe I'm doing something wrong, but I spend a few hours trying to make it working, unfortunately without any luck. I don't have any errors - everything passes successfully. Could I ask you to confirm if this is a bug?
My repo's GitHub action config is here: https://github.com/luna/basegl/blob/master/.github/workflows/build.yml
And the build results are here:
https://github.com/luna/basegl/actions
As you can see, the coverage file gets generated and gets successfully passed to actions-rs/grcov. The codecov token is correct as well, however, codecov does not display any results and no errors are reported anywhere :( I'd be thankful for any hint here!
After v0.5.14 of grcov was released, actions-rs/grcov
invocations stopped working because the --output-file
command-line option is no longer recognized by the grcov binary.
Looking at the compare, (upstream does not keep a proper changelog) it appears that mozilla/grcov@26acaa0 is the culprit, and does not include a backwards compatibility mechanism. It appears that a simple change from output-file
to output-path
is all that is necessary to resolve this, and I'm preparing a patch for that. This issue is mostly just for tracking.
Do the checklist before filing an issue:
actions-rs
Actions?My .github/actions-rs/grcov.yml
contains:
branch: true
ignore-not-existing: true
llvm: true
filter: covered
output-type: lcov
output-path: ./lcov.info
excl-line: "#\\[derive\\("
excl-br-line: "#\\[derive\\("
excl-start: "mod tests \\{"
excl-br-start: "mod tests \\{"
The debug statement when the action is run prints:
##[debug]User configuration: {"branch":true,"ignoreNotExisting":true,"llvm":true,"filter":"covered","outputType":"lcov","outputPath":"./lcov.info"}
It looks like the excl*
config values are missing.
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests
RUSTDOCFLAGS: -Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests
##[debug]User configuration: {"branch":true,"ignoreNotExisting":true,"llvm":true,"filter":"covered","outputType":"lcov","outputPath":"./lcov.info"}
::group::Searching for coverage files
Searching for coverage files
Found project crates: apollo-query-planner,graphql-parser
##[debug]Creating an archive with coverage files at /tmp/coverage-wmwe4iwq1z.zip
Archiving coverage file: /home/runner/work/rust/rust/target/debug/deps/apollo_query_planner-48cd324783e6f8e1.gcno
Archiving coverage file: /home/runner/work/rust/rust/target/debug/deps/apollo_query_planner-9a2d2ac00302e9ac.gcda
Archiving coverage file: /home/runner/work/rust/rust/target/debug/deps/apollo_query_planner-9a2d2ac00302e9ac.gcno
Archiving coverage file: /home/runner/work/rust/rust/target/debug/deps/graphql_parser-13f552932c4a8288.gcda
Archiving coverage file: /home/runner/work/rust/rust/target/debug/deps/graphql_parser-13f552932c4a8288.gcno
Archiving coverage file: /home/runner/work/rust/rust/target/debug/deps/graphql_parser-989eb3afebc0a136.gcda
Archiving coverage file: /home/runner/work/rust/rust/target/debug/deps/graphql_parser-989eb3afebc0a136.gcno
Coverage files archive was created at the /tmp/coverage-wmwe4iwq1z.zip
::endgroup::
::group::Execute grcov
Execute grcov
/usr/share/rust/.cargo/bin/grcov /tmp/coverage-wmwe4iwq1z.zip --branch --ignore-not-existing --llvm --commit-sha 8a2f4ca73c9529274661fcc710573c49b7647409 --filter covered --output-path /home/runner/work/rust/rust/lcov.info --output-type lcov --service-name Code Coverage --source-dir /home/runner/work/rust/rust
::endgroup::
Generated coverage report at /home/runner/work/rust/rust/lcov.info
::set-output name=report::/home/runner/work/rust/rust/lcov.info
##[debug]steps.coverage.outputs.report='/home/runner/work/rust/rust/lcov.info'
##[debug]Node Action run completed with exit code 0
##[debug]Finishing: Run actions-rs/[email protected]
I believe the result of those options not showing up is that some lines are detected as not covered, e.g. all of the lines in the FetchGroup struct here: https://codecov.io/gh/apollographql/rust/src/8a2f4ca73c9529274661fcc710573c49b7647409/query-planner/src/groups.rs
Hi! We've been succesfully using grcov
for some time now and we have recently refactored our codebase. Our Cargo.toml
is no longer located at the top-level. Instead it is inside src/rust
folder. When running the CI we got error now: no such file or directory, open '/home/runner/work/ide/ide/Cargo.lock'
, which is true, as it should point to no such file or directory, open '/home/runner/work/ide/ide/src/rust/Cargo.lock'
instead. The problem is that GitHub Actions do not provide a way to set up CWD for third party actions and I haven't found any configuration here how to point grcov
to some specific root folder. I'd be very thankful for any help! In case this would be important, this is our repo: https://github.com/luna/ide (branch wip/wd/dev, soon the changes will be on master)
Do the checklist before filing an issue:
actions-rs
Actions?Do the checklist before filing an issue:
actions-rs
Actions?In today, I am runing my github action with actions-rs/[email protected]
, then run coverallsapp/github-action
, it is return Error :
Error: ENOENT: no such file or directory, open '/tmp/grcov-report-n2jbbrhhsc'
first time, I thought it was their ( coverallsapp/github-action
) problem. then I tried to change it settings multiple times :
- name: Coveralls upload
uses: coverallsapp/github-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ steps.coverage.outputs.report }}
- name: Coveralls upload
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ steps.coverage.outputs.report }}
- name: Coveralls upload
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.coverage.outputs.report }}
- name: Coveralls upload
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
They all failed
Listed up
This is some time github action log : https://github.com/tu6ge/oss-rs/actions
success output report
no more info
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.