-
Notifications
You must be signed in to change notification settings - Fork 31
130 lines (112 loc) · 3.87 KB
/
Copy pathcoverage.yml
File metadata and controls
130 lines (112 loc) · 3.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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
id-token: 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: Prepare coverage cache key
id: coverage-cache-key
shell: bash
run: |
echo "prefix=ubuntu-22.04-coverage-gcc-${{ hashFiles('CMakePresets.json', '**/CMakeLists.txt', 'cmake/**') }}" >> "$GITHUB_OUTPUT"
- name: Restore coverage build cache
id: coverage-build-cache
uses: actions/cache/restore@v4
with:
path: build
key: ${{ steps.coverage-cache-key.outputs.prefix }}-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: |
${{ steps.coverage-cache-key.outputs.prefix }}-
ubuntu-22.04-coverage-gcc-
- name: Install dependencies
uses: ./.github/actions/prepare_vm
- name: Configure and build with coverage
shell: bash
run: |
mkdir -p build
cmake --preset coverage-test-gcc
cmake --build build -j"$(nproc)"
- name: Test
shell: bash
run: |
set -euo pipefail
IAM_REGEX='^(DriverAuth|TMetadataFixture|TJwtIamFixture|TOAuthIamFixture|OAuth_WithFacility)\.'
FLAKY_REGEX='(ManyMessages|DiscoveryHang|DescribeHang)'
EXCLUDE_REGEX="${IAM_REGEX}|${FLAKY_REGEX}"
find build -type f \( -name '*.gcda' -o -name '*.gcov' \) -delete
rm -rf build/coverage
ctest -j1 --preset coverage-all -E "${EXCLUDE_REGEX}" --output-on-failure
IAM_CTEST_JOBS=1 ./.github/scripts/run_iam_integration_tests.sh
- name: Generate coverage report
uses: ./.github/actions/gcovr
with:
build-directory: build
source-root: ${{ github.workspace }}
gcov-executable: gcov-13
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
use_oidc: true
files: build/coverage/coverage-codecov.lcov
disable_search: true
plugins: noop
flags: sdk
name: ydb-cpp-sdk
fail_ci_if_error: true
verbose: true
- name: Upload coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: build/coverage/
retention-days: 14
- name: Clean coverage data before cache save
if: github.event_name != 'pull_request' && success()
shell: bash
run: |
find build -type f \( -name '*.gcda' -o -name '*.gcov' \) -delete
rm -rf build/coverage
- name: Save coverage build cache
if: github.event_name != 'pull_request' && success() && steps.coverage-build-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: build
key: ${{ steps.coverage-cache-key.outputs.prefix }}-${{ github.run_id }}-${{ github.run_attempt }}