From 37a05ccc3f2608d7f0633c77862947f01f92a3f1 Mon Sep 17 00:00:00 2001 From: Walter Pinto Date: Sun, 4 Oct 2026 13:53:39 +0100 Subject: [PATCH] ci(swift): assert coverage with lcovcheck instead of grep The smoke steps grepped Please's console coverage table and the raw .lcov text. Use lcovcheck: Please's coverage.json for the per-file coverage, and the shared lcov parser for line statuses and function hits of the exported report. Item 4 of #66. Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/ci-swift.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-swift.yml b/.github/workflows/ci-swift.yml index 01d1598..33ec293 100644 --- a/.github/workflows/ci-swift.yml +++ b/.github/workflows/ci-swift.yml @@ -73,26 +73,29 @@ jobs: - name: Coverage smoke test (math_test) run: | - ./pleasew --plain_output cover //test/swift/lib:math_test 2>&1 | tee cover.log - grep -Eq '^\s+Math\.swift [1-9][0-9]*/' cover.log + ./pleasew --plain_output build //tools/common/lcovcheck + ./pleasew --plain_output cover //test/swift/lib:math_test + plz-out/bin/tools/common/lcovcheck/lcovcheck -coverage-json plz-out/log/coverage.json -covered test/swift/lib/Math.swift env: VERITAS_NO_HOOK: "1" - name: Coverage smoke test (mid_test, transitive dependencies) run: | - ./pleasew --plain_output cover //test/swift/chain:mid_test 2>&1 | tee cover.log - grep -Eq '^\s+Mid\.swift [1-9][0-9]*/' cover.log - grep -Eq '^\s+Base\.swift [1-9][0-9]*/' cover.log + ./pleasew --plain_output build //tools/common/lcovcheck + ./pleasew --plain_output cover //test/swift/chain:mid_test + plz-out/bin/tools/common/lcovcheck/lcovcheck -coverage-json plz-out/log/coverage.json \ + -covered test/swift/chain/Mid.swift -covered test/swift/chain/Base.swift env: VERITAS_NO_HOOK: "1" - name: Raw lcov export smoke test (functions and branches) run: | - ./pleasew --plain_output cover --rerun //test/swift/branches:branches_test 2>&1 | tee cover.log - f="plz-out/bin/test/swift/branches/branches_test.lcov" - grep -q '^SF:test/swift/branches/Branches\.swift$' "$f" - grep -Eq '^FNDA:0,.*unused' "$f" - grep -q '^BRDA:4,0,1,0$' "$f" - grep -q '^BRDA:12,0,0,0$' "$f" + ./pleasew --plain_output build //tools/common/lcovcheck + ./pleasew --plain_output cover --rerun //test/swift/branches:branches_test + plz-out/bin/tools/common/lcovcheck/lcovcheck \ + -lcov plz-out/bin/test/swift/branches/branches_test.lcov \ + -path test/swift/branches/Branches.swift \ + -line 4=partial -line 12=partial -line 5=uncovered \ + -function unused=missed -function classify=2 env: VERITAS_NO_HOOK: "1"