[PR #1263] [MERGED] Code coverage for Rust #4631

Closed
opened 2026-03-23 21:38:40 +00:00 by mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AppFlowy-IO/AppFlowy/pull/1263
Author: @SwapnilKumbhar
Created: 10/10/2022
Status: Merged
Merged: 10/11/2022
Merged by: @appflowy

Base: mainHead: main


📝 Commits (10+)

  • 2d6e96d feat: Bumped Rust to stable-2022-04-07 (1.60.0)
  • e70e1f6 feat: Added coverage tests and report generation
  • 6a48f9b feat: Added workflow for Rust Coverage
  • 004d63a feat: Bumped Rust to 1.60.0 in Workflows
  • 049a7b1 test: Testing for CI
  • 7a4a237 ci: Added name and fixed path for Rust Coverage
  • 40dde2c revert: "test: Testing for CI"
  • 5113743 fix: Added .pub-cache to PATH, change incremental builds to zero
  • d6f5c34 test: Testing for CI
  • 2cddad3 ci: Installing protobuf compiler in CI

📊 Changes

11 files changed (+282 additions, -11 deletions)

View changed files

📝 .github/workflows/ci.yaml (+1 -1)
📝 .github/workflows/dart_lint.yml (+1 -1)
📝 .github/workflows/dart_test.yml (+1 -1)
📝 .github/workflows/release.yml (+3 -3)
.github/workflows/rust_coverage.yml (+71 -0)
📝 .github/workflows/rust_lint.yml (+1 -1)
📝 .github/workflows/rust_test.yml (+2 -2)
frontend/rust-lib/covtest.rs (+0 -0)
📝 frontend/rust-lib/rust-toolchain.toml (+1 -1)
📝 frontend/scripts/makefile/tests.toml (+200 -0)
📝 shared-lib/rust-toolchain.toml (+1 -1)

📄 Description

Implements #1169.

Summary of changes

  • Bumped rustc to 2022-04-07, that is version 1.60.0 as that version introduces coverage instrumentation. These bumps are in the rust-toolchain.toml files in the projects and also in the CI workflow files.
  • In frontend/scripts/makefile/tests.toml, created two cargo make tasks (among other supporting ones):
    • get_test_coverage - Tests both projects with -C instrument-coverage flag with rustc. Further, runs grcov to create an HTML report of the total coverage. The report is stored in each project's directory under target/coverage-html/, main HTML file being index.html.
    • get_ci_test_coverage - Tests the same way as above, but generates lcov test reports instead of human readable HTML. These can be integrated in CI using various actions on the Github Marketplace. Each project will have a file called target/coverage.lcov that will contain the coverage data.
  • Created the rust-coverage.yml workflow that runs the get_ci_test_coverage task. This is intended to give a test report for each pull-request and push to main. I need some direction on what Github action should be used to display that.

Further help

This PR will give coverage capabilities, however they are not visible in the Github CI. There are multiple Github actions on the marketplace that will solve this problem if we just point them to the test coverage lcov file. I hope you can tell me what would be the best way to go here. Here's a list of actions that I found on the internet -

Note

You may see a lot of commits being made and reverted in the history. I mostly did those to trigger the CI.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/AppFlowy-IO/AppFlowy/pull/1263 **Author:** [@SwapnilKumbhar](https://github.com/SwapnilKumbhar) **Created:** 10/10/2022 **Status:** ✅ Merged **Merged:** 10/11/2022 **Merged by:** [@appflowy](https://github.com/appflowy) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (10+) - [`2d6e96d`](https://github.com/AppFlowy-IO/AppFlowy/commit/2d6e96d9e5c2f74a1b8cee25e19d16ad0327cab1) feat: Bumped Rust to stable-2022-04-07 (1.60.0) - [`e70e1f6`](https://github.com/AppFlowy-IO/AppFlowy/commit/e70e1f66bfa0510e32612cb302a1f5ab1a1ca946) feat: Added coverage tests and report generation - [`6a48f9b`](https://github.com/AppFlowy-IO/AppFlowy/commit/6a48f9bfd2565a0426d03ff2fc4871d19654660d) feat: Added workflow for Rust Coverage - [`004d63a`](https://github.com/AppFlowy-IO/AppFlowy/commit/004d63a1671faf27831c7df4de9317a366b2f0b3) feat: Bumped Rust to 1.60.0 in Workflows - [`049a7b1`](https://github.com/AppFlowy-IO/AppFlowy/commit/049a7b108822a4f468d35d20f432bd5002d5d461) test: Testing for CI - [`7a4a237`](https://github.com/AppFlowy-IO/AppFlowy/commit/7a4a2373dad2019459be5ed11c04cb9a60ae75c8) ci: Added name and fixed path for Rust Coverage - [`40dde2c`](https://github.com/AppFlowy-IO/AppFlowy/commit/40dde2c267a5bc91cc379ef05fb54391dc62a541) revert: "test: Testing for CI" - [`5113743`](https://github.com/AppFlowy-IO/AppFlowy/commit/5113743b697a1b5d5a9edafc45677951f30e570f) fix: Added .pub-cache to PATH, change incremental builds to zero - [`d6f5c34`](https://github.com/AppFlowy-IO/AppFlowy/commit/d6f5c344788938cf758fffb010abcf15425599fa) test: Testing for CI - [`2cddad3`](https://github.com/AppFlowy-IO/AppFlowy/commit/2cddad3287ba45ca72ab932f9b442a37022aa5fd) ci: Installing protobuf compiler in CI ### 📊 Changes **11 files changed** (+282 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yaml` (+1 -1) 📝 `.github/workflows/dart_lint.yml` (+1 -1) 📝 `.github/workflows/dart_test.yml` (+1 -1) 📝 `.github/workflows/release.yml` (+3 -3) ➕ `.github/workflows/rust_coverage.yml` (+71 -0) 📝 `.github/workflows/rust_lint.yml` (+1 -1) 📝 `.github/workflows/rust_test.yml` (+2 -2) ➕ `frontend/rust-lib/covtest.rs` (+0 -0) 📝 `frontend/rust-lib/rust-toolchain.toml` (+1 -1) 📝 `frontend/scripts/makefile/tests.toml` (+200 -0) 📝 `shared-lib/rust-toolchain.toml` (+1 -1) </details> ### 📄 Description Implements #1169. ## Summary of changes - Bumped `rustc` to `2022-04-07`, that is version `1.60.0` as that version introduces coverage instrumentation. These bumps are in the `rust-toolchain.toml` files in the projects and also in the CI workflow files. - In `frontend/scripts/makefile/tests.toml`, created two `cargo make` tasks (among other supporting ones): - `get_test_coverage` - Tests both projects with `-C instrument-coverage` flag with `rustc`. Further, runs `grcov` to create an HTML report of the total coverage. The report is stored in each project's directory under `target/coverage-html/`, main HTML file being `index.html`. - `get_ci_test_coverage` - Tests the same way as above, but generates `lcov` test reports instead of human readable HTML. These can be integrated in CI using various actions on the Github Marketplace. Each project will have a file called `target/coverage.lcov` that will contain the coverage data. - Created the `rust-coverage.yml` workflow that runs the `get_ci_test_coverage` task. This is intended to give a test report for each pull-request and push to `main`. I need some direction on what Github action should be used to display that. ## Further help This PR will give coverage capabilities, however they are not visible in the Github CI. There are multiple Github actions on the marketplace that will solve this problem if we just point them to the test coverage `lcov` file. I hope you can tell me what would be the best way to go here. Here's a list of actions that I found on the internet - - https://github.com/marketplace/actions/report-lcov - Comments the test coverage on the relevant PR - https://github.com/marketplace/actions/comment-lcov-code-coverage-report similar to above, but slightly prettier #### Note You may see a lot of commits being made and reverted in the history. I mostly did those to trigger the CI. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
mirror 2026-03-23 21:38:40 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AppFlowy-IO/AppFlowy#4631
No description provided.