Skip to content

ci: reintroduce code coverage reporting with cargo-llvm-cov#23336

Open
buraksenn wants to merge 9 commits into
apache:mainfrom
buraksenn:reintroduce-code-coverage-with-llvm-cov
Open

ci: reintroduce code coverage reporting with cargo-llvm-cov#23336
buraksenn wants to merge 9 commits into
apache:mainfrom
buraksenn:reintroduce-code-coverage-with-llvm-cov

Conversation

@buraksenn

@buraksenn buraksenn commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

Code coverage has been disabled since #3678. The reason was it failed because of sql_integration test binary. This PR reintroduces it

What changes are included in this PR?

Reintroduce code coverage

Are these changes tested?

I've been successfully make it work in my fork: buraksenn#345
image

I needed to add CODECOV_TOKEN as a secret variable to the fork.

You can check #23336 (comment) comment of codecov for successful run

Are there any user-facing changes?

no

@github-actions github-actions Bot added development-process Related to development process of DataFusion core Core DataFusion crate ffi Changes to the ffi crate labels Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Thank you for opening this pull request!

Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch).

Details
     Cloning apache/main
    Building datafusion v54.0.0 (current)
       Built [ 110.916s] (current)
     Parsing datafusion v54.0.0 (current)
      Parsed [   0.037s] (current)
    Building datafusion v54.0.0 (baseline)
       Built [ 107.513s] (baseline)
     Parsing datafusion v54.0.0 (baseline)
      Parsed [   0.037s] (baseline)
    Checking datafusion v54.0.0 -> v54.0.0 (no change; assume patch)
     Checked [   1.013s] 223 checks: 223 pass, 30 skip
     Summary no semver update required
    Finished [ 221.561s] datafusion
    Building datafusion-ffi v54.0.0 (current)
       Built [  59.655s] (current)
     Parsing datafusion-ffi v54.0.0 (current)
      Parsed [   0.064s] (current)
    Building datafusion-ffi v54.0.0 (baseline)
       Built [  59.967s] (baseline)
     Parsing datafusion-ffi v54.0.0 (baseline)
      Parsed [   0.064s] (baseline)
    Checking datafusion-ffi v54.0.0 -> v54.0.0 (no change; assume patch)
     Checked [   0.356s] 223 checks: 222 pass, 1 fail, 0 warn, 30 skip

--- failure feature_missing: package feature removed or renamed ---

Description:
A feature has been removed from this package's Cargo.toml. This will break downstream crates which enable that feature.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#cargo-feature-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.48.0/src/lints/feature_missing.ron

Failed in:
  feature tarpaulin_include in the package's Cargo.toml

     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [ 121.839s] datafusion-ffi

@github-actions github-actions Bot added the auto detected api change Auto detected API change label Jul 6, 2026
@codecov-commenter

codecov-commenter commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@d0304b3). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #23336   +/-   ##
=======================================
  Coverage        ?   80.61%           
=======================================
  Files           ?     1086           
  Lines           ?   364976           
  Branches        ?   364976           
=======================================
  Hits            ?   294216           
  Misses          ?    53234           
  Partials        ?    17526           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@buraksenn

Copy link
Copy Markdown
Contributor Author

As expected it could not compare since there is no code coverage uploaded for main branch. After this PR merges it will be ready

@Jefffrey Jefffrey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👀

Comment thread .github/workflows/rust.yml Outdated
coverage:
name: coverage
needs: linux-build-lib
runs-on: ${{ vars.USE_RUNS_ON == 'true' && format('runs-on={0},family=m8a+m7a+c8a,cpu=16,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

will this consume more of our ASF runner time?

maybe we can try it for a while and make sure it is useful before we spend too much xtra time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is correct can you check #23336 (comment)

@alamb

alamb commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Looks like the coverage run takes 19m and the main tests take 20m, so this adds a lot of resource usage, but it won't increase testing latancy

Screenshot 2026-07-10 at 8 23 18 PM Screenshot 2026-07-10 at 8 23 33 PM

@Jefffrey

Copy link
Copy Markdown
Contributor

would it also be an option to have it run occasionally on main only, to at least give us a general idea on the health of the codebase in terms of coverage, without consuming too many resources? 🤔

@buraksenn

Copy link
Copy Markdown
Contributor Author

I've first introduced it as uncommenting the coverage step but cargo-llvm-cov internally runs cargo test and calculates coverage with it so instead of this I've changed cargo test (amd64) to use llvm-cov. With this it actually does not cause any resource usage:

cargo test amd64 with llvm-cov:
image

unchanged cargo test amd64:
image

Another approach would be adding it as nightly/weekly. @alamb @Jefffrey

@2010YOUY01 2010YOUY01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM overall—thank you!

Andrew mentioned the resource-usage concern, so here is some background: our CI runner resources are provided by the ASF, and they have noted that DataFusion consumes a significant amount of compute. We are still within the hard limit, IIRC, but it would be good to continue reducing our usage as they suggested.

(I think the biggest contributor is PRs with dozens of commits, but we could address that separately.)

I would prefer to run this check on every PR. It is true that 100% line coverage does not necessarily imply good test quality; however, low coverage strongly suggests that we are missing test cases. I'd want to check the coverage metrics regularly when reviewing.

const KB: usize = 1 << 10;
#[tokio::test]
#[cfg_attr(tarpaulin, ignore)]
#[cfg_attr(coverage, ignore)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think they're not needed:

#[cfg(feature = "extended_tests")]

Those tests are under extended_tests attribute, and now we run llvm-cov in the regular test suite, so those slow tests won't be included.

In the future if there are other tests that are too expensive to run for llvm-cov, I think we should also put them in extended_tests feature, then we don't have to manage this additional coverage attribute to keep things simpler.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the heads up, I did not think if they were necessary and blindly applied. Now they are removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto detected api change Auto detected API change core Core DataFusion crate development-process Related to development process of DataFusion ffi Changes to the ffi crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coverage jobs are failing on master: Failed to compile tests! Error: sql_integration: linking with cc failed: exit status: 1"

5 participants