From 2f3b2e4f658f98650a28ebde4be654a7f00bcb66 Mon Sep 17 00:00:00 2001 From: Talal Ashraf Date: Tue, 7 Jul 2026 10:16:23 -0400 Subject: [PATCH 1/3] fix: replace node20 very_good_coverage with awk lcov threshold check --- .github/workflows/ci.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a938faeeee..c5c58b678b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -132,11 +132,17 @@ jobs: path-to-lcov: ./contracts/zero-ex/lcov.info - name: Check coverage threshold - uses: VeryGoodOpenSource/very_good_coverage@v2 - with: - path: ./contracts/zero-ex/lcov.info - min_coverage: 6.98 - exclude: '**/tests' + run: | + awk -F: ' + /^SF:/ { skip = ($2 ~ /\/tests\//) } + /^LF:/ && !skip { lf += $2 } + /^LH:/ && !skip { lh += $2 } + END { + cov = lf ? 100 * lh / lf : 100 + printf "Line coverage: %.2f%% (min 6.98%%)\n", cov + if (cov < 6.98) { print "::error::coverage below threshold"; exit 1 } + } + ' ./contracts/zero-ex/lcov.info - name: Run Forge build on governance contracts working-directory: ./contracts/governance From 18df494051840c0408188917a4fe1e306ee9dbd9 Mon Sep 17 00:00:00 2001 From: Talal Ashraf Date: Mon, 24 Aug 2026 14:56:52 -0400 Subject: [PATCH 2/3] fix: make lcov coverage check fail closed on empty report Match very_good_coverage: empty/zero-line lcov now fails (was passing). Drop the no-op tests exclude (minimatch '**/tests' matched nothing) so the check is faithful and robust to the report's path prefix. --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5c58b678b..068626fbc8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -134,11 +134,10 @@ jobs: - name: Check coverage threshold run: | awk -F: ' - /^SF:/ { skip = ($2 ~ /\/tests\//) } - /^LF:/ && !skip { lf += $2 } - /^LH:/ && !skip { lh += $2 } + /^LF:/ { lf += $2 } + /^LH:/ { lh += $2 } END { - cov = lf ? 100 * lh / lf : 100 + cov = lf ? 100 * lh / lf : 0 printf "Line coverage: %.2f%% (min 6.98%%)\n", cov if (cov < 6.98) { print "::error::coverage below threshold"; exit 1 } } From 821134c38a53e367b87e918eea633fcb29b6fe12 Mon Sep 17 00:00:00 2001 From: Talal Ashraf Date: Mon, 24 Aug 2026 14:58:24 -0400 Subject: [PATCH 3/3] refactor: use github-script for coverage check instead of awk More readable node24 implementation; identical coverage math, 6.98% floor, and fail-closed on empty report. --- .github/workflows/ci.yml | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 068626fbc8..4e6bddb298 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -132,16 +132,23 @@ jobs: path-to-lcov: ./contracts/zero-ex/lcov.info - name: Check coverage threshold - run: | - awk -F: ' - /^LF:/ { lf += $2 } - /^LH:/ { lh += $2 } - END { - cov = lf ? 100 * lh / lf : 0 - printf "Line coverage: %.2f%% (min 6.98%%)\n", cov - if (cov < 6.98) { print "::error::coverage below threshold"; exit 1 } - } - ' ./contracts/zero-ex/lcov.info + uses: actions/github-script@v9 + with: + script: | + const fs = require('fs'); + const MIN_COVERAGE = 6.98; + const lcov = fs.readFileSync('./contracts/zero-ex/lcov.info', 'utf8'); + let linesFound = 0; + let linesHit = 0; + for (const line of lcov.split('\n')) { + if (line.startsWith('LF:')) linesFound += Number(line.slice(3)); + else if (line.startsWith('LH:')) linesHit += Number(line.slice(3)); + } + const coverage = linesFound ? (100 * linesHit) / linesFound : 0; + core.info(`Line coverage: ${coverage.toFixed(2)}% (min ${MIN_COVERAGE}%)`); + if (coverage < MIN_COVERAGE) { + core.setFailed(`Coverage ${coverage.toFixed(2)}% is below the ${MIN_COVERAGE}% threshold`); + } - name: Run Forge build on governance contracts working-directory: ./contracts/governance