Skip to content

Add gcovr to CI docker image #2621

Add gcovr to CI docker image

Add gcovr to CI docker image #2621

Workflow file for this run

name: Build
on:
push:
branches: [master, release/*, develop]
pull_request:
branches: [master, release/*, develop]
workflow_dispatch:
jobs:
lint:
name: Check format
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Run clang-format
uses: ./.github/actions/clang_format
build:
name: Build
needs: lint
strategy:
fail-fast: false
matrix:
include:
- os: Linux
container:
image: rippleci/clio_ci:latest
- os: macOS
runs-on: [self-hosted, "${{ matrix.os }}"]
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare runner
uses: ./.github/actions/prepare_runner
with:
disable_ccache: false
- name: Setup conan
uses: ./.github/actions/setup_conan
id: conan
- name: Restore cache
uses: ./.github/actions/restore_cache
id: restore_cache
with:
conan_dir: ${{ env.CONAN_USER_HOME }}/.conan
ccache_dir: ${{ env.CCACHE_DIR }}
- name: Run conan and cmake
uses: ./.github/actions/generate
with:
conan_profile: ${{ steps.conan.outputs.conan_profile }}
conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }}
build_type: 'Release'
- name: Build Clio
uses: ./.github/actions/build_clio
- name: Show ccache's statistics
shell: bash
id: ccache_stats
run: |
ccache -s > /tmp/ccache.stats
miss_rate=$(cat /tmp/ccache.stats | grep 'Misses' | head -n1 | sed 's/.*(\(.*\)%).*/\1/')
echo "miss_rate=${miss_rate}" >> $GITHUB_OUTPUT
cat /tmp/ccache.stats
- name: Strip tests
run: strip build/clio_tests
- name: Upload clio_tests
uses: actions/upload-artifact@v3
with:
name: clio_tests_${{ runner.os }}
path: build/clio_tests
- name: Upload compile_commans
if: ${{ runner.os == 'macOS' }}
uses: actions/upload-artifact@v3
with:
name: compile_commans_${{ runner.os }}
path: build/compile_commands.json
- name: Save cache
uses: ./.github/actions/save_cache
with:
conan_dir: ${{ env.CONAN_USER_HOME }}/.conan
conan_hash: ${{ steps.restore_cache.outputs.conan_hash }}
conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }}
ccache_dir: ${{ env.CCACHE_DIR }}
ccache_cache_hit: ${{ steps.restore_cache.outputs.ccache_cache_hit }}
ccache_cache_miss_rate: ${{ steps.ccache_stats.outputs.miss_rate }}
test:
name: Run Tests
needs: build
strategy:
fail-fast: false
matrix:
include:
- os: Linux
container:
image: rippleci/clio_ci:latest
- os: macOS
runs-on: [self-hosted, "${{ matrix.os }}"]
container: ${{ matrix.container }}
steps:
- uses: actions/download-artifact@v3
with:
name: clio_tests_${{ runner.os }}
- name: Run clio_tests
run: |
chmod +x ./clio_tests
./clio_tests --gtest_filter="-BackendCassandraBaseTest*:BackendCassandraTest*:BackendCassandraFactoryTestWithDB*"
coverage:
name: Run Coverage Report
needs: lint
strategy:
fail-fast: false
matrix:
include:
- os: Linux
container:
image: rippleci/clio_ci:latest
runs-on: [self-hosted, "${{ matrix.os }}"]
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare runner
uses: ./.github/actions/prepare_runner
with:
disable_ccache: true
- name: Install gcovr
run: |
pip install gcovr
- name: Setup conan
uses: ./.github/actions/setup_conan
id: conan
- name: Run conan and cmake
uses: ./.github/actions/generate
with:
conan_profile: ${{ steps.conan.outputs.conan_profile }}
conan_cache_hit: false
build_type: 'Debug'
extra_cmake_args: >-
-Dcoverage=ON
-DCODE_COVERAGE_TESTS_ARGS="--gtest_filter=-BackendCassandra*"
-DCODE_COVERAGE_REPORT_FORMAT=xml
- name: Run tests and coverage report
uses: ./.github/actions/build_clio
with:
target: coverage_report
- name: Archive coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report.xml
path: build/coverage_report.xml
retention-days: 30
- name: Upload coverage report
uses: codecov/codecov-action@v3
with:
files: build/coverage_report.xml
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}