Skip to content

Rust Code Coverage

Actions
A GitHub Action that does single-action code coverage generation
v1.0.0
Latest
Star (8)

Unmaintained / Abandoned / Deprecated

I will not be maintaining / updating fucov going forward.

You should use cargo-llvm-cov instead, which is maintained, more feature complete and has a better user experience throughout. It also has very good integration with CI / GitHub Actions.


fucov

A GitHub Action that does single-action code coverage generation.

The action needs a nightly compiler and llvm-tools available. It will invoke cargo test and generate a coverage/coverage.lcov file which can be uploaded to codecov for example.

This action basically does all the steps that are described in the unstable book.

Example usage

# the action needs a nightly toolchain with llvm-tools
- uses: actions-rs/toolchain@v1
  with:
    profile: minimal
    toolchain: nightly
    components: llvm-tools-preview

# runs cargo with defaults flags, using the default `lcov` output
- uses: Swatinem/fucov@v1

# afterwards, upload the report to codecov
- uses: codecov/codecov-action@v1
  with:
    directory: coverage

NOTE that you do need a nightly toolchain with the llvm-tools-preview component installed, as this action will use the included llvm-profdata/cov tools.

Inputs

: args Arguments for the cargo test command. Defaults to --workspace --all-features.

: output-format The desired output format. One of lcov, json, html or profdata. Defaults to lcov.

: output-filename The desired output filename. Defaults to coverage/coverage.$ext, depending on the chosen output-format.

How it looks

This repo has some testcases included, which yield the following coverage results:

codecov

Known Issues

There are a few known issues around doctests:

Rust Code Coverage is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

A GitHub Action that does single-action code coverage generation
v1.0.0
Latest

Rust Code Coverage is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.