Skip to content

Commit fba7b77

Browse files
committed
Build Windows and MacOS with two-pass to match Linux
1 parent 16941ae commit fba7b77

File tree

1 file changed

+64
-6
lines changed

1 file changed

+64
-6
lines changed

.github/workflows/code-coverage.yml

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,24 +242,53 @@ jobs:
242242
module=$(basename ${GITHUB_REPOSITORY})
243243
mkdir -p gcovr
244244
245+
# First pass: collect raw coverage data into JSON
245246
gcovr \
246247
--root boost-root \
247248
--gcov-executable "xcrun llvm-cov gcov" \
248249
--merge-mode-functions separate \
249250
--sort uncovered-percent \
250-
--html-nested \
251-
--html-template-dir=ci-automation/gcovr-templates/html \
252251
--html-title "${module}" \
252+
--merge-lines \
253253
--exclude-unreachable-branches \
254254
--exclude-throw-branches \
255255
--exclude '.*/extra/.*' \
256256
--exclude '.*/example/.*' \
257257
--exclude '.*/examples/.*' \
258258
--filter ".*/${module}/.*" \
259-
--json-summary gcovr/summary.json \
260259
--html --output gcovr/index.html \
260+
--json-summary-pretty --json-summary gcovr/summary.json \
261+
--json gcovr/coverage-raw.json \
261262
boost-root/__build_cmake_test__
262263
264+
# Fix paths for repo-relative display
265+
python3 ci-automation/scripts/fix_paths.py \
266+
gcovr/coverage-raw.json \
267+
gcovr/coverage-fixed.json \
268+
--repo "${module}"
269+
270+
# Create symlinks so gcovr can find source files at repo-relative paths
271+
ln -sfn "boost-root/libs/${module}/include" include 2>/dev/null || true
272+
ln -sfn "boost-root/libs/${module}/src" src 2>/dev/null || true
273+
274+
# Second pass: generate nested HTML from fixed JSON with custom templates
275+
gcovr \
276+
-a gcovr/coverage-fixed.json \
277+
--merge-mode-functions separate \
278+
--sort uncovered-percent \
279+
--html-nested \
280+
--html-template-dir=ci-automation/gcovr-templates/html \
281+
--html-title "${module}" \
282+
--merge-lines \
283+
--exclude-unreachable-branches \
284+
--exclude-throw-branches \
285+
--exclude '(^|.*/)test/.*' \
286+
--exclude '.*/extra/.*' \
287+
--exclude '.*/example/.*' \
288+
--exclude '.*/examples/.*' \
289+
--html --output gcovr/index.html \
290+
--json-summary-pretty --json-summary gcovr/summary.json
291+
263292
- name: Generate sidebar navigation
264293
run: python3 ci-automation/scripts/gcovr_build_tree.py gcovr
265294

@@ -438,23 +467,52 @@ jobs:
438467
module=$(basename ${GITHUB_REPOSITORY})
439468
mkdir -p gcovr
440469
470+
# First pass: collect raw coverage data into JSON
441471
gcovr \
442472
--root boost-root \
443473
--merge-mode-functions separate \
444474
--sort uncovered-percent \
445-
--html-nested \
446-
--html-template-dir=ci-automation/gcovr-templates/html \
447475
--html-title "${module}" \
476+
--merge-lines \
448477
--exclude-unreachable-branches \
449478
--exclude-throw-branches \
450479
--exclude '.*/extra/.*' \
451480
--exclude '.*/example/.*' \
452481
--exclude '.*/examples/.*' \
453482
--filter ".*/${module}/.*" \
454-
--json-summary gcovr/summary.json \
455483
--html --output gcovr/index.html \
484+
--json-summary-pretty --json-summary gcovr/summary.json \
485+
--json gcovr/coverage-raw.json \
456486
boost-root/__build_cmake_test__
457487
488+
# Fix paths for repo-relative display
489+
python3 ci-automation/scripts/fix_paths.py \
490+
gcovr/coverage-raw.json \
491+
gcovr/coverage-fixed.json \
492+
--repo "${module}"
493+
494+
# Create symlinks so gcovr can find source files at repo-relative paths
495+
ln -sfn "boost-root/libs/${module}/include" include 2>/dev/null || true
496+
ln -sfn "boost-root/libs/${module}/src" src 2>/dev/null || true
497+
498+
# Second pass: generate nested HTML from fixed JSON with custom templates
499+
gcovr \
500+
-a gcovr/coverage-fixed.json \
501+
--merge-mode-functions separate \
502+
--sort uncovered-percent \
503+
--html-nested \
504+
--html-template-dir=ci-automation/gcovr-templates/html \
505+
--html-title "${module}" \
506+
--merge-lines \
507+
--exclude-unreachable-branches \
508+
--exclude-throw-branches \
509+
--exclude '(^|.*/)test/.*' \
510+
--exclude '.*/extra/.*' \
511+
--exclude '.*/example/.*' \
512+
--exclude '.*/examples/.*' \
513+
--html --output gcovr/index.html \
514+
--json-summary-pretty --json-summary gcovr/summary.json
515+
458516
- name: Generate sidebar navigation
459517
run: python3 ci-automation/scripts/gcovr_build_tree.py gcovr
460518

0 commit comments

Comments
 (0)