Skip to content

introduce code coverage to the cpp sdk #5

introduce code coverage to the cpp sdk

introduce code coverage to the cpp sdk #5

Workflow file for this run

name: Coverage
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
concurrency:
group: coverage-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
coverage:
runs-on: ubuntu-22.04
permissions:
contents: read
pull-requests: write
services:
ydb:
image: ydbplatform/local-ydb:24.4
ports:
- 2135:2135
- 2136:2136
- 8765:8765
volumes:
- /tmp/ydb_certs:/ydb_certs
env:
YDB_LOCAL_SURVIVE_RESTART: true
YDB_USE_IN_MEMORY_PDISKS: true
YDB_TABLE_ENABLE_PREPARED_DDL: true
options: '-h localhost'
steps:
- name: Checkout PR
uses: actions/checkout@v4
if: github.event.pull_request.head.sha != ''
with:
submodules: true
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout
uses: actions/checkout@v4
if: github.event.pull_request.head.sha == ''
with:
submodules: true
- name: Install dependencies
uses: ./.github/actions/prepare_vm
- name: Configure and build with coverage
shell: bash
run: |
mkdir -p build
rm -rf build/*
cmake --preset coverage-test-gcc
cmake --build build -j"$(nproc)"
- name: Test
shell: bash
run: |
ctest -j1 --preset coverage-all --output-on-failure
- name: Generate coverage report
uses: ./.github/actions/gcovr
with:
build-directory: build
source-root: ${{ github.workspace }}
gcov-executable: gcov-13
post-pr-comment: ${{ github.event_name == 'pull_request' }}
- name: Upload coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: build/coverage/
retention-days: 14