GithubHelp home page GithubHelp logo

fucov's Introduction

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:

fucov's People

Contributors

swatinem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fucov's Issues

Workflow failed: No filenames specified!

My YAML is using just the defaults. I am running it locally using https://github.com/nektos/act but I dont see how that could be the problem.

  test:
    name: Test
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@master

      # coverage 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
|     Finished test [unoptimized + debuginfo] target(s) in 1m 58s
|      Running unittests src/main.rs (target/debug/deps/cargo_test_xunit-124fad530140ef78)
| 
| running 1 test
| test parser::tests::parse_output ... ok
| 
| test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
| 
| [command]/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata merge -sparse /tmp/_profraw/344-2690798127844891782_0.profraw /tmp/_profraw/348-7005446241495356693_0.profraw /tmp/_profraw/488-11968602179188622136_0.profraw -o /tmp/_profraw/coverage.profdata-1
| [command]/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-cov export -format=lcov -ignore-filename-regex=([\/]rustc[\/]|[\/].cargo[\/]registry[\/]) -instr-profile=/tmp/_profraw/coverage.profdata
| No filenames specified!
[Test/Test]   โ—  ::error::Error: The process '/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-cov' failed with exit code 1

I've switched to using https://github.com/actions-rs/grcov which works for my needs.
https://github.com/jayvdb/cargo-test-xunit/blob/master/.github/workflows/test.yml#L29

No such file or directory

Using the GH Action
/usr/share/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata merge -sparse /tmp/_profraw/5307.profraw /tmp/_profraw/3512.profraw /tmp/_profraw/4055.profraw /tmp/_profraw/3181.profraw /tmp/_profraw/3242.profraw /tmp/_profraw/5232.profraw /tmp/_profraw/4804.profraw /tmp/_profraw/4892.profraw /tmp/_profraw/4992.profraw /tmp/_profraw/2759.profraw /tmp/_profraw/4845.profraw /tmp/_profraw/4818.profraw /tmp/_profraw/4867.profraw /tmp/_profraw/3355.profraw /tmp/_profraw/4811.profraw /tmp/_profraw/2901.profraw /tmp/_profraw/3024.profraw /tmp/_profraw/3151.profraw /tmp/_profraw/4717.profraw /tmp/_profraw/4733.profraw /tmp/_profraw/3032.profraw /tmp/_profraw/5121.profraw /tmp/_profraw/3352.profraw /tmp/_profraw/5364.profraw /tmp/_profraw/2908.profraw /tmp/_profraw/3217.profraw /tmp/_profraw/5302.profraw /tmp/_profraw/2885.profraw /tmp/_profraw/4702.profraw /tmp/_profraw/4802.profraw /tmp/_profraw/3274.profraw /tmp/_profraw/3030.profraw /tmp/_profraw/4971.profraw /tmp/_profraw/3027.profraw /tmp/_profraw/5367.profraw /tmp/_profraw/5061.profraw /tmp/_profraw/3254.profraw /tmp/_profraw/5217.profraw /tmp/_profraw/5348.profraw /tmp/_profraw/2897.profraw /tmp/_profraw/4931.profraw /tmp/_profraw/4789.profraw /tmp/_profraw/5036.profraw /tmp/_profraw/4950.profraw /tmp/_profraw/3159.profraw /tmp/_profraw/3348.profraw /tmp/_profraw/5363.profraw /tmp/_profraw/4824.profraw /tmp/_profraw/5112.profraw /tmp/_profraw/5038.profraw /tmp/_profraw/5189.profraw /tmp/_profraw/4030.profraw /tmp/_profraw/2899.profraw /tmp/_profraw/4765.profraw /tmp/_profraw/3128.profraw /tmp/_profraw/5079.profraw /tmp/_profraw/3161.profraw /tmp/_profraw/4929.profraw /tmp/_profraw/3140.profraw /tmp/_profraw/3154.profraw /tmp/_profraw/3277.profraw /tmp/_profraw/3034.profraw /tmp/_profraw/5162.profraw /tmp/_profraw/3062.profraw /tmp/_profraw/5362.profraw /tmp/_profraw/3178.profraw /tmp/_profraw/5258.profraw /tmp/_profraw/2891.profraw /tmp/_profraw/5156.profraw /tmp/_profraw/3287.profraw -o /tmp/_profraw/coverage.profdata
Error: Error: ENOENT: no such file or directory, opendir '/tmp/_rustdoc'

Error on the Run

I'm seeing the following error on actions:

Run Swatinem/fucov@v1
(node:1595) UnhandledPromiseRejectionWarning: Error: The process '/usr/share/rust/.cargo/bin/rustc' failed with exit code 1
    at ExecState._setResult (/home/runner/work/_actions/Swatinem/fucov/v1/dist/index.js:1021:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/Swatinem/fucov/v1/dist/index.js:1004:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/Swatinem/fucov/v1/dist/index.js:898:27)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Socket.<anonymous> (internal/child_process.js:430:11)
    at Socket.emit (events.js:210:5)
    at Pipe.<anonymous> (net.js:659:12)
(node:1595) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1595) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Any thoughts on how I can resolve this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.