File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,9 +33,18 @@ summary = json.loads(Path(os.environ["SUMMARY_JSON"]).read_text())
3333repo = os.environ["GITHUB_REPOSITORY"]
3434run_id = os.environ["GITHUB_RUN_ID"]
3535
36- line = summary["line"]
37- branch = summary["branch"]
38- func = summary["function"]
36+ def metric(name: str) -> dict:
37+ if name in summary:
38+ return summary[name]
39+ return {
40+ "covered": summary[f"{name}_covered"],
41+ "num": summary[f"{name}_total"],
42+ "percent": summary.get(f"{name}_percent") or 0,
43+ }
44+
45+ line = metric("line")
46+ branch = metric("branch")
47+ func = metric("function")
3948
4049def bar(percent: float) -> str:
4150 filled = max(0, min(10, int(round(percent / 10))))
Original file line number Diff line number Diff line change @@ -38,9 +38,19 @@ if [[ -n "${GITHUB_STEP_SUMMARY:-}" && -f "${OUTPUT_DIR}/summary.json" ]]; then
3838 echo " | Metric | Covered | Total | Percent |"
3939 echo " | --- | ---: | ---: | ---: |"
4040 jq -r '
41- .line as $l
42- | .branch as $b
43- | .function as $f
41+ def metric($name):
42+ if has($name) then
43+ .[$name]
44+ else
45+ {
46+ covered: .[$name + "_covered"],
47+ num: .[$name + "_total"],
48+ percent: .[$name + "_percent"]
49+ }
50+ end;
51+ metric("line") as $l
52+ | metric("branch") as $b
53+ | metric("function") as $f
4454 | "| Line | \($l.covered) | \($l.num) | \($l.percent // 0)% |",
4555 "| Branch | \($b.covered) | \($b.num) | \($b.percent // 0)% |",
4656 "| Function | \($f.covered) | \($f.num) | \($f.percent // 0)% |"
Original file line number Diff line number Diff line change 1818 runs-on : ubuntu-22.04
1919 permissions :
2020 contents : read
21+ id-token : write
2122 pull-requests : write
2223 services :
2324 ydb :
7172 gcov-executable : gcov-13
7273 post-pr-comment : ${{ github.event_name == 'pull_request' }}
7374
75+ - name : Upload coverage to Codecov
76+ uses : codecov/codecov-action@v5
77+ with :
78+ use_oidc : true
79+ files : build/coverage/cobertura.xml
80+ disable_search : true
81+ flags : sdk
82+ name : ydb-cpp-sdk
83+ fail_ci_if_error : true
84+ verbose : true
85+
7486 - name : Upload coverage reports
7587 uses : actions/upload-artifact@v4
7688 with :
Original file line number Diff line number Diff line change 11# YDB C++ SDK: driver for [ YDB] ( https://github.com/ydb-platform/ydb )
22
3+ [ ![ Codecov] ( https://codecov.io/gh/ydb-platform/ydb-cpp-sdk/branch/main/graph/badge.svg )] ( https://app.codecov.io/gh/ydb-platform/ydb-cpp-sdk )
4+
35## Building YDB C++ SDK from sources
46
57### Prerequisites
You can’t perform that action at this time.
0 commit comments