Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ jobs:
}}
uses: ./.github/workflows/ci-tests-e2e-coverage-package.yaml
with:
source_sha: ${{ github.event.pull_request.head.sha || github.sha }}
source_sha: ${{ github.sha }}
# A shard that died partway still uploads a tracefile, and one that
# produced none fails its own upload, so the matrix verdict is what
# makes the merge trustworthy for trend reporting.
Expand Down
9 changes: 8 additions & 1 deletion scripts/cicd/package-e2e-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,14 @@ ADD_ARGS=()
for file in "${COVERAGE_FILES[@]}"; do
ADD_ARGS+=(-a "$file")
done
lcov "${ADD_ARGS[@]}" -o "$COVERAGE_DIR/coverage.lcov"
# Istanbul can emit the same nested function name at different source lines in
# one tracefile (for example LiteGraph's inner_clicked callbacks). Function
# coverage is not published below, so retain the valid line data instead of
# failing the whole coverage package on lcov's function-metadata consistency
# check. `corrupt` is paired with `inconsistent` because lcov reports both for
# this single condition.
lcov "${ADD_ARGS[@]}" -o "$COVERAGE_DIR/coverage.lcov" \
--ignore-errors inconsistent,corrupt

MERGED_SF=$(grep -c '^SF:' "$COVERAGE_DIR/coverage.lcov" || true)
MERGED_LH=$(awk -F: '/^LH:/{s+=$2}END{print s+0}' "$COVERAGE_DIR/coverage.lcov")
Expand Down
26 changes: 26 additions & 0 deletions scripts/cicd/package-e2e-coverage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ set -euo pipefail
if [[ "$1" == "--remove" ]]; then
exit 0
fi
if [[ " $* " != *" --ignore-errors inconsistent,corrupt "* ]]; then
echo 'missing function-metadata error allowance' >&2
exit 64
fi
inputs=()
output=''
while [[ $# -gt 0 ]]; do
Expand Down Expand Up @@ -193,6 +197,18 @@ describe('package-e2e-coverage.sh', () => {
expect(result.output).not.toContain('::warning::')
})

it('preserves line coverage when function metadata is inconsistent', () => {
using fixture = coverageFixture()
fixture.writeShard('e2e-coverage-shard-1', coverage('src'))

const result = fixture.run(true)

expect(result.status).toBe(0)
expect(
readFileSync(join(fixture.output, 'coverage.lcov'), 'utf8')
).toContain('SF:src/file 0.ts')
})

// Preserves #15342: a flaky shard must not discard every other shard's real
// coverage. It stays published for Codecov and the PR comment, but flagged.
it('publishes a run with a whitespace path but flags a red matrix', () => {
Expand Down Expand Up @@ -302,6 +318,16 @@ describe('completeness gate wiring', () => {
)
})

it('packages coverage against the revision exercised by the workflow', () => {
const job = field(
readWorkflow('.github/workflows/ci-tests-e2e.yaml'),
'jobs',
'upload-e2e-coverage'
)

expect(field(job, 'with', 'source_sha')).toBe('${{ github.sha }}')
})

it('gates the saved E2E baseline on a whole merge', () => {
const steps = jobSteps(
readWorkflow('.github/workflows/coverage-slack-notify.yaml')
Expand Down
Loading