Skip to content

Commit

Permalink
add codecov upload action in coverage.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
Shourya742 committed Oct 10, 2024
1 parent c05d8cd commit f6bb0c7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 22 deletions.
35 changes: 16 additions & 19 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# Performs test coverage of project's libraries using cargo-tarpaulin and generates results using codecov.io.
# The following flags are set inside `tarpaulin.toml`:
# `features = "..."`: Includes the code with the listed features. The following features result in a
# tarpaulin error and are NOT included: derive, alloc, arbitrary-derive, attributes, and
# with_serde
# `run-types = [ "Lib" ]`: Only tests the package's library unit tests. Includes protocols, and utils (without the
# exclude-files flag, it includes this example because it contains a lib.rs file)
# `exclude-files = [ "examples/*" ]`: Excludes all projects in examples directory (specifically added to
# ignore examples that that contain a lib.rs file like interop-cpp)
# `timeout = "120s"`: If unresponsive for 120 seconds, action will fail
# `fail-under = 20`: If code coverage is less than 20%, action will fail
# `out = ["Xml"]`: Required for codecov.io to generate coverage result
# All message-generator test flags are in tests in test/message-generator/test
# This test loops through every test in test/message-generator/test, and runs each one, collecting
# code coverage data for anything in the roles/ directory that is relevant to SV2(pool, mining-proxy)
# tarpaulin error and are NOT included: derive, alloc, arbitrary-derive, attributes, and with_serde
# `run-types = [ "Lib" ]`: Only tests the package's library unit tests, including protocols and utils
# (without the exclude-files flag, it includes examples that contain a lib.rs file).
# `exclude-files = [ "examples/*" ]`: Excludes all projects in the examples directory (specifically added to
# ignore examples that contain a lib.rs file like interop-cpp).
# `timeout = "120s"`: If unresponsive for 120 seconds, the action will fail.
# `fail-under = 20`: If code coverage is less than 20%, the action will fail.
# `out = ["Xml"]`: Required for codecov.io to generate coverage results.
# All message-generator test flags are in tests in test/message-generator/test.
# This test loops through every test in test/message-generator/test, collecting code coverage data for anything
# in the roles/ directory that is relevant to SV2 (pool, mining-proxy).

name: Test Coverage

Expand Down Expand Up @@ -40,11 +39,9 @@ jobs:
run: |
./scripts/tarpaulin.sh
- name: Archive Tarpaulin code coverage results
uses: actions/upload-artifact@v4
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
name: tarpaulin-report
path: |
protocols/cobertura.xml
roles/cobertura.xml
utils/cobertura.xml
files: "./roles/cobertura.xml, ./protocols/cobertura.xml, ./utils/cobertura.xml"
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion protocols/tarpaulin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
features = "disable_nopanic prop_test noise_sv2 with_buffer_pool derive_codec_sv2 binary_codec_sv2 default core"
run-types = [ "Lib" ]
timeout = "120s"
fail-under = 20
fail-under = 0

[report]
out = ["Xml"]
2 changes: 1 addition & 1 deletion roles/tarpaulin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
features = "with_buffer_pool async_std tokio with_tokio default"
run-types = [ "Lib" ]
timeout = "120s"
fail-under = 20
fail-under = 0

[report]
out = ["Xml"]
2 changes: 1 addition & 1 deletion utils/tarpaulin.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[default]
run-types = [ "Lib" ]
timeout = "120s"
fail-under = 7
fail-under = 0

[report]
out = ["Xml"]

0 comments on commit f6bb0c7

Please sign in to comment.