mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-29 16:15:50 +00:00
ci: Refactor how we run code coverage (#2065)
Fix: https://github.com/XRPLF/clio/issues/2061
This commit is contained in:
11
.codecov.yml
11
.codecov.yml
@@ -9,3 +9,14 @@ coverage:
|
||||
default:
|
||||
target: 20% # Need to bump this number https://docs.codecov.com/docs/commit-status#patch-status
|
||||
threshold: 2%
|
||||
|
||||
# `codecov/codecov-action` reruns `gcovr` if build files present
|
||||
# That's why we run it in a separate workflow
|
||||
# This ignore list is not currently used
|
||||
#
|
||||
# More info: https://github.com/XRPLF/clio/pull/2066
|
||||
ignore:
|
||||
- "tests"
|
||||
- "src/data/cassandra/"
|
||||
- "src/data/CassandraBackend.hpp"
|
||||
- "src/data/BackendFactory.*"
|
||||
|
||||
8
.github/actions/code_coverage/action.yml
vendored
8
.github/actions/code_coverage/action.yml
vendored
@@ -3,20 +3,24 @@ description: Run tests, generate code coverage report and upload it to codecov.i
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
||||
steps:
|
||||
- name: Run tests
|
||||
shell: bash
|
||||
run: |
|
||||
build/clio_tests
|
||||
|
||||
# Please keep exclude list in sync with .codecov.yml
|
||||
- name: Run gcovr
|
||||
shell: bash
|
||||
run: |
|
||||
gcovr -e tests \
|
||||
gcovr \
|
||||
-e tests \
|
||||
-e src/data/cassandra \
|
||||
-e src/data/CassandraBackend.hpp \
|
||||
-e 'src/data/BackendFactory.*' \
|
||||
--xml build/coverage_report.xml -j8 --exclude-throw-branches
|
||||
--xml build/coverage_report.xml \
|
||||
-j8 --exclude-throw-branches
|
||||
|
||||
- name: Archive coverage report
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
28
.github/workflows/build.yml
vendored
28
.github/workflows/build.yml
vendored
@@ -19,34 +19,24 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [heavy]
|
||||
conan_profile: [gcc, clang]
|
||||
build_type: [Release, Debug]
|
||||
container: ['{ "image": "ghcr.io/xrplf/clio-ci:latest" }']
|
||||
code_coverage: [false]
|
||||
static: [true]
|
||||
|
||||
include:
|
||||
- os: heavy
|
||||
conan_profile: gcc
|
||||
build_type: Release
|
||||
container: '{ "image": "ghcr.io/xrplf/clio-ci:latest" }'
|
||||
code_coverage: false
|
||||
static: true
|
||||
- os: heavy
|
||||
conan_profile: gcc
|
||||
build_type: Debug
|
||||
container: '{ "image": "ghcr.io/xrplf/clio-ci:latest" }'
|
||||
code_coverage: true
|
||||
static: true
|
||||
- os: heavy
|
||||
conan_profile: clang
|
||||
build_type: Release
|
||||
container: '{ "image": "ghcr.io/xrplf/clio-ci:latest" }'
|
||||
code_coverage: false
|
||||
static: true
|
||||
- os: heavy
|
||||
conan_profile: clang
|
||||
build_type: Debug
|
||||
container: '{ "image": "ghcr.io/xrplf/clio-ci:latest" }'
|
||||
code_coverage: false
|
||||
static: true
|
||||
- os: macos15
|
||||
conan_profile: default_apple_clang
|
||||
build_type: Release
|
||||
container: ""
|
||||
code_coverage: false
|
||||
static: false
|
||||
|
||||
@@ -60,7 +50,7 @@ jobs:
|
||||
static: ${{ matrix.static }}
|
||||
run_unit_tests: true
|
||||
run_integration_tests: false
|
||||
clio_server: true
|
||||
upload_clio_server: true
|
||||
|
||||
check_config:
|
||||
name: Check Config Description
|
||||
|
||||
8
.github/workflows/build_and_test.yml
vendored
8
.github/workflows/build_and_test.yml
vendored
@@ -52,8 +52,8 @@ on:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
clio_server:
|
||||
description: Whether to build clio_server
|
||||
upload_clio_server:
|
||||
description: Whether to upload clio_server
|
||||
required: true
|
||||
type: boolean
|
||||
|
||||
@@ -80,13 +80,13 @@ jobs:
|
||||
disable_cache: ${{ inputs.disable_cache }}
|
||||
code_coverage: ${{ inputs.code_coverage }}
|
||||
static: ${{ inputs.static }}
|
||||
clio_server: ${{ inputs.clio_server }}
|
||||
upload_clio_server: ${{ inputs.upload_clio_server }}
|
||||
targets: ${{ inputs.targets }}
|
||||
sanitizer: ${{ inputs.sanitizer }}
|
||||
|
||||
test:
|
||||
needs: build
|
||||
# TODO: We don't upload tests if code coverage is enabled
|
||||
# We don't upload tests if code coverage is enabled
|
||||
if: ${{ !inputs.code_coverage }}
|
||||
uses: ./.github/workflows/test_impl.yml
|
||||
with:
|
||||
|
||||
23
.github/workflows/build_impl.yml
vendored
23
.github/workflows/build_impl.yml
vendored
@@ -38,8 +38,8 @@ on:
|
||||
required: true
|
||||
type: boolean
|
||||
|
||||
clio_server:
|
||||
description: Whether to build clio_server
|
||||
upload_clio_server:
|
||||
description: Whether to upload clio_server
|
||||
required: true
|
||||
type: boolean
|
||||
|
||||
@@ -115,15 +115,15 @@ jobs:
|
||||
cat /tmp/ccache.stats
|
||||
|
||||
- name: Strip unit_tests
|
||||
if: ${{ !inputs.code_coverage && inputs.sanitizer == 'false' }}
|
||||
if: inputs.sanitizer == 'false' && !inputs.code_coverage
|
||||
run: strip build/clio_tests
|
||||
|
||||
- name: Strip integration_tests
|
||||
if: ${{ !inputs.code_coverage }}
|
||||
if: inputs.sanitizer == 'false' && !inputs.code_coverage
|
||||
run: strip build/clio_integration_tests
|
||||
|
||||
- name: Upload clio_server
|
||||
if: ${{ inputs.clio_server }}
|
||||
if: inputs.upload_clio_server && !inputs.code_coverage
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: clio_server_${{ runner.os }}_${{ inputs.build_type }}_${{ inputs.conan_profile }}
|
||||
@@ -157,12 +157,21 @@ jobs:
|
||||
code_coverage: ${{ inputs.code_coverage }}
|
||||
conan_profile: ${{ inputs.conan_profile }}
|
||||
|
||||
# TODO: This is not a part of build process but it is the easiest way to do it here.
|
||||
# It will be refactored in https://github.com/XRPLF/clio/issues/1075
|
||||
# This is run as part of the build job, because it requires the following:
|
||||
# - source code
|
||||
# - generated source code (Build.cpp)
|
||||
# - conan packages
|
||||
# - .gcno files in build directory
|
||||
#
|
||||
# It's all available in the build job, but not in the test job
|
||||
- name: Run code coverage
|
||||
if: ${{ inputs.code_coverage }}
|
||||
uses: ./.github/actions/code_coverage
|
||||
|
||||
# `codecov/codecov-action` will rerun `gcov` if it's available and build directory is present
|
||||
# To prevent this from happening, we run this action in a separate workflow
|
||||
#
|
||||
# More info: https://github.com/XRPLF/clio/pull/2066
|
||||
upload_coverage_report:
|
||||
if: ${{ inputs.code_coverage }}
|
||||
name: Codecov
|
||||
|
||||
2
.github/workflows/nightly.yml
vendored
2
.github/workflows/nightly.yml
vendored
@@ -47,7 +47,7 @@ jobs:
|
||||
static: ${{ matrix.static }}
|
||||
run_unit_tests: true
|
||||
run_integration_tests: ${{ matrix.os != 'macos15' }}
|
||||
clio_server: true
|
||||
upload_clio_server: true
|
||||
disable_cache: true
|
||||
|
||||
nightly_release:
|
||||
|
||||
2
.github/workflows/sanitizers.yml
vendored
2
.github/workflows/sanitizers.yml
vendored
@@ -39,6 +39,6 @@ jobs:
|
||||
static: false
|
||||
run_unit_tests: true
|
||||
run_integration_tests: false
|
||||
clio_server: false
|
||||
upload_clio_server: false
|
||||
targets: clio_tests clio_integration_tests
|
||||
sanitizer: ${{ matrix.sanitizer }}
|
||||
|
||||
20
.github/workflows/test_impl.yml
vendored
20
.github/workflows/test_impl.yml
vendored
@@ -59,12 +59,20 @@ jobs:
|
||||
with:
|
||||
name: clio_tests_${{ runner.os }}_${{ inputs.build_type }}_${{ inputs.conan_profile }}
|
||||
|
||||
- name: Run clio_tests
|
||||
run: |
|
||||
chmod +x ./clio_tests
|
||||
${{ inputs.sanitizer != 'false' && './.github/scripts/execute-tests-under-sanitizer' || '' }} ./clio_tests
|
||||
- name: Make clio_tests executable
|
||||
shell: bash
|
||||
run: chmod +x ./clio_tests
|
||||
|
||||
- name: Run clio_tests (regular)
|
||||
if: inputs.sanitizer == 'false'
|
||||
run: ./clio_tests
|
||||
|
||||
- name: Run clio_tests (sanitizer)
|
||||
if: inputs.sanitizer != 'false'
|
||||
run: ./.github/scripts/execute-tests-under-sanitizer ./clio_tests
|
||||
|
||||
- name: Check for sanitizer report
|
||||
if: inputs.sanitizer != 'false'
|
||||
shell: bash
|
||||
id: check_report
|
||||
run: |
|
||||
@@ -75,7 +83,7 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Upload sanitizer report
|
||||
if: ${{ steps.check_report.outputs.found_report == 'true' }}
|
||||
if: inputs.sanitizer != 'false' && steps.check_report.outputs.found_report == 'true'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ inputs.conan_profile }}_report
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
|
||||
# TODO: enable when we have fixed all currently existing issues from sanitizers
|
||||
- name: Create an issue
|
||||
if: ${{ false && steps.check_report.outputs.found_report == 'true' }}
|
||||
if: false && inputs.sanitizer != 'false' && steps.check_report.outputs.found_report == 'true'
|
||||
uses: ./.github/actions/create_issue
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
Reference in New Issue
Block a user