Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,21 @@ jobs:
uses: qard/heaviest-objects-in-the-universe@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
coverage:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update nightly
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo +nightly llvm-cov --all-features --workspace --lcov --output-path lcov.info
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this run the tests? How does it figure out the coverage?

Also, do we even need Rust tests? Since this is a JavaScript binding, would just relying on JavaScript tests be enough?

Copy link
Copy Markdown
Collaborator Author

@hoolioh hoolioh Apr 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it runs the tests and gathers information as the test go. I believe it works in the same way as GCOV.
Well, since I was doing the same work for libdatadog repo I thought it could come in handy as we add more code to the repo. Having the report is useful to spot some areas of the code that should be tested.
For examlple in the IAST native modules we have native tests covering some specific areas that are hard to excersize from the JS side.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is just a binding on top of another library, I don't think we would (or should) need that. Especially since the pipeline is set up in a way that expects the compiled binary to be used for testing, and Cargo tests require compiling in-place with different settings than the final binary.

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: lcov.info
fail_ci_if_error: true