mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 09:17:57 +00:00
chore: Improve codecov coverage reporting (#4977)
* Amend `.codecov.yml` to disable coverage reporting of test sources and explicitly set most parameters * Increase codecov upload retry time to 210s (from 35s) * Upgrade gcovr adding support for more coverage formats (lcov, clover, jacoco) * Upgrade github actions in coverage workflow * Explicitly disable codecov plugins (also removing `gcov` coverage, which is not correctly handled by codecov https://github.com/codecov/feedback/issues/334)
This commit is contained in:
31
.codecov.yml
31
.codecov.yml
@@ -1,6 +1,37 @@
|
|||||||
|
codecov:
|
||||||
|
require_ci_to_pass: true
|
||||||
|
|
||||||
|
comment:
|
||||||
|
behavior: default
|
||||||
|
layout: reach,diff,flags,tree,reach
|
||||||
|
show_carryforward_flags: false
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
|
range: "60..80"
|
||||||
|
precision: 1
|
||||||
|
round: nearest
|
||||||
status:
|
status:
|
||||||
project:
|
project:
|
||||||
default:
|
default:
|
||||||
target: 60%
|
target: 60%
|
||||||
threshold: 2%
|
threshold: 2%
|
||||||
|
patch:
|
||||||
|
default:
|
||||||
|
target: auto
|
||||||
|
threshold: 2%
|
||||||
|
changes: false
|
||||||
|
|
||||||
|
github_checks:
|
||||||
|
annotations: true
|
||||||
|
|
||||||
|
parsers:
|
||||||
|
cobertura:
|
||||||
|
partials_as_hits: true
|
||||||
|
handle_missing_conditions : true
|
||||||
|
|
||||||
|
slack_app: false
|
||||||
|
|
||||||
|
ignore:
|
||||||
|
- "src/test/"
|
||||||
|
- "src/ripple/beast/test/"
|
||||||
|
- "src/ripple/beast/unit_test/"
|
||||||
|
|||||||
12
.github/workflows/nix.yml
vendored
12
.github/workflows/nix.yml
vendored
@@ -179,6 +179,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.conan
|
mkdir -p ~/.conan
|
||||||
tar -xzf conan.tar -C ~/.conan
|
tar -xzf conan.tar -C ~/.conan
|
||||||
|
- name: install gcovr
|
||||||
|
run: pip install "gcovr>=7,<8"
|
||||||
- name: check environment
|
- name: check environment
|
||||||
run: |
|
run: |
|
||||||
echo ${PATH} | tr ':' '\n'
|
echo ${PATH} | tr ':' '\n'
|
||||||
@@ -207,7 +209,7 @@ jobs:
|
|||||||
-DCMAKE_CXX_FLAGS="-O0"
|
-DCMAKE_CXX_FLAGS="-O0"
|
||||||
-DCMAKE_C_FLAGS="-O0"
|
-DCMAKE_C_FLAGS="-O0"
|
||||||
cmake-target: coverage
|
cmake-target: coverage
|
||||||
- name: build
|
- name: move coverage report
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
mv "${build_dir}/coverage.xml" ./
|
mv "${build_dir}/coverage.xml" ./
|
||||||
@@ -218,13 +220,15 @@ jobs:
|
|||||||
path: coverage.xml
|
path: coverage.xml
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
- name: upload coverage report
|
- name: upload coverage report
|
||||||
uses: wandalen/wretry.action@v1.3.0
|
uses: wandalen/wretry.action@v1.4.10
|
||||||
with:
|
with:
|
||||||
action: codecov/codecov-action@v4
|
action: codecov/codecov-action@v4.3.0
|
||||||
with: |
|
with: |
|
||||||
files: coverage.xml
|
files: coverage.xml
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
|
disable_search: true
|
||||||
verbose: true
|
verbose: true
|
||||||
|
plugin: noop
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
attempt_limit: 5
|
attempt_limit: 5
|
||||||
attempt_delay: 35000 # in milliseconds
|
attempt_delay: 210000 # in milliseconds
|
||||||
|
|||||||
@@ -95,6 +95,9 @@
|
|||||||
# - replace both functions setup_target_for_coverage_gcovr_* with a single setup_target_for_coverage_gcovr
|
# - replace both functions setup_target_for_coverage_gcovr_* with a single setup_target_for_coverage_gcovr
|
||||||
# - add support for all gcovr output formats
|
# - add support for all gcovr output formats
|
||||||
#
|
#
|
||||||
|
# 2024-04-03, Bronek Kozicki
|
||||||
|
# - add support for output formats: jacoco, clover, lcov
|
||||||
|
#
|
||||||
# USAGE:
|
# USAGE:
|
||||||
#
|
#
|
||||||
# 1. Copy this file into your cmake modules path.
|
# 1. Copy this file into your cmake modules path.
|
||||||
@@ -256,10 +259,10 @@ endif()
|
|||||||
# BASE_DIRECTORY "../" # Base directory for report
|
# BASE_DIRECTORY "../" # Base directory for report
|
||||||
# # (defaults to PROJECT_SOURCE_DIR)
|
# # (defaults to PROJECT_SOURCE_DIR)
|
||||||
# FORMAT "cobertura" # Output format, one of:
|
# FORMAT "cobertura" # Output format, one of:
|
||||||
# # xml cobertura sonarqube json-summary
|
# # xml cobertura sonarqube jacoco clover
|
||||||
# # json-details coveralls csv txt
|
# # json-summary json-details coveralls csv
|
||||||
# # html-single html-nested html-details
|
# # txt html-single html-nested html-details
|
||||||
# # (xml is an alias to cobertura;
|
# # lcov (xml is an alias to cobertura;
|
||||||
# # if no format is set, defaults to xml)
|
# # if no format is set, defaults to xml)
|
||||||
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
|
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
|
||||||
# # to BASE_DIRECTORY, with CMake 3.4+)
|
# # to BASE_DIRECTORY, with CMake 3.4+)
|
||||||
@@ -308,6 +311,8 @@ function(setup_target_for_coverage_gcovr)
|
|||||||
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.txt)
|
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.txt)
|
||||||
elseif(Coverage_FORMAT STREQUAL "csv")
|
elseif(Coverage_FORMAT STREQUAL "csv")
|
||||||
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.csv)
|
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.csv)
|
||||||
|
elseif(Coverage_FORMAT STREQUAL "lcov")
|
||||||
|
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.lcov)
|
||||||
else()
|
else()
|
||||||
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.xml)
|
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.xml)
|
||||||
endif()
|
endif()
|
||||||
@@ -320,6 +325,14 @@ function(setup_target_for_coverage_gcovr)
|
|||||||
set(Coverage_FORMAT cobertura) # overwrite xml
|
set(Coverage_FORMAT cobertura) # overwrite xml
|
||||||
elseif(Coverage_FORMAT STREQUAL "sonarqube")
|
elseif(Coverage_FORMAT STREQUAL "sonarqube")
|
||||||
list(APPEND GCOVR_ADDITIONAL_ARGS --sonarqube "${GCOVR_OUTPUT_FILE}" )
|
list(APPEND GCOVR_ADDITIONAL_ARGS --sonarqube "${GCOVR_OUTPUT_FILE}" )
|
||||||
|
elseif(Coverage_FORMAT STREQUAL "jacoco")
|
||||||
|
list(APPEND GCOVR_ADDITIONAL_ARGS --jacoco "${GCOVR_OUTPUT_FILE}" )
|
||||||
|
list(APPEND GCOVR_ADDITIONAL_ARGS --jacoco-pretty )
|
||||||
|
elseif(Coverage_FORMAT STREQUAL "clover")
|
||||||
|
list(APPEND GCOVR_ADDITIONAL_ARGS --clover "${GCOVR_OUTPUT_FILE}" )
|
||||||
|
list(APPEND GCOVR_ADDITIONAL_ARGS --clover-pretty )
|
||||||
|
elseif(Coverage_FORMAT STREQUAL "lcov")
|
||||||
|
list(APPEND GCOVR_ADDITIONAL_ARGS --lcov "${GCOVR_OUTPUT_FILE}" )
|
||||||
elseif(Coverage_FORMAT STREQUAL "json-summary")
|
elseif(Coverage_FORMAT STREQUAL "json-summary")
|
||||||
list(APPEND GCOVR_ADDITIONAL_ARGS --json-summary "${GCOVR_OUTPUT_FILE}" )
|
list(APPEND GCOVR_ADDITIONAL_ARGS --json-summary "${GCOVR_OUTPUT_FILE}" )
|
||||||
list(APPEND GCOVR_ADDITIONAL_ARGS --json-summary-pretty)
|
list(APPEND GCOVR_ADDITIONAL_ARGS --json-summary-pretty)
|
||||||
|
|||||||
Reference in New Issue
Block a user