Skip to content

Commit 5f87416

Browse files
robertsLandoclaude
andcommitted
ci(codecov): upload unit-suite lcov on every PR + README badge
Per-PR coverage signal via Codecov. Unit suite only — `yarn coverage` for the full merged (unit + e2e) report stays a follow-up job (30+ min is too expensive per PR; issue #267 plans a nightly or on-label job for that). - Adds `yarn coverage:unit` step to build_artifact (Linux, Node 22) after lint/build, then uploads coverage/lcov.info via codecov-action@v5. build_artifact already runs on every PR and produces the distributable bundle, so coverage fits naturally without adding a separate job. - codecov.yml: informational status (never fail a PR on coverage swings, since e2e coverage isn't uploaded yet), ignore compiled output / tests / docs-site / dictionary, carryforward disabled on the `unit` flag. - README: Codecov badge next to CI badge, labeled "Coverage (unit)" so the scope is obvious at a glance. Requires: Codecov GitHub App installed on yao-pkg and CODECOV_TOKEN set as a repo secret (optional on public repos but recommended for PR uploads). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 8f369e7 commit 5f87416

3 files changed

Lines changed: 54 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ jobs:
5757
prelude/sea-bootstrap.bundle.js
5858
retention-days: 1
5959

60+
# Coverage upload — unit-suite only. The full `yarn coverage` (unit + e2e)
61+
# is 30+ min and not worth paying on every PR; a follow-up can add a
62+
# nightly or labeled job for the merged report. The `build` matrix runs
63+
# `yarn test:unit` on 3 OS × Node 22/24 to verify platform behavior; this
64+
# is the single canonical upload for Codecov.
65+
- if: needs.changes.outputs.code == 'true'
66+
run: yarn coverage:unit
67+
- if: needs.changes.outputs.code == 'true'
68+
uses: codecov/codecov-action@v5
69+
with:
70+
files: coverage/lcov.info
71+
flags: unit
72+
fail_ci_if_error: false
73+
token: ${{ secrets.CODECOV_TOKEN }}
74+
6075
# Sanity check: `yarn build` succeeds on every supported OS + Node combo.
6176
# Runs in parallel with tests (they don't consume this job's output) so
6277
# failures still mark the PR red without gating the test jobs.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
<p align="center">
1212
<a href="https://github.com/yao-pkg/pkg/actions/workflows/ci.yml"><img src="https://github.com/yao-pkg/pkg/actions/workflows/ci.yml/badge.svg" alt="Build Status" /></a>
13+
<a href="https://codecov.io/gh/yao-pkg/pkg"><img src="https://codecov.io/gh/yao-pkg/pkg/branch/main/graph/badge.svg" alt="Coverage (unit)" /></a>
1314
<a href="https://www.npmjs.com/package/@yao-pkg/pkg"><img src="https://img.shields.io/npm/v/@yao-pkg/pkg" alt="npm version" /></a>
1415
<a href="https://www.npmjs.com/package/@yao-pkg/pkg"><img src="https://img.shields.io/npm/dm/@yao-pkg/pkg" alt="npm downloads" /></a>
1516
<a href="https://github.com/yao-pkg/pkg/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@yao-pkg/pkg" alt="license" /></a>

codecov.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Codecov config — keep coverage informational, don't gate PRs on it.
2+
# Upload is unit-suite only today; nightly / labeled merged uploads may land
3+
# as a follow-up (see #267 Phase 2 acceptance criteria).
4+
coverage:
5+
status:
6+
project:
7+
default:
8+
# Report but never fail the PR. Coverage swings with e2e-vs-unit
9+
# scope changes, and the e2e suite isn't on Codecov yet.
10+
target: auto
11+
threshold: 5%
12+
informational: true
13+
patch:
14+
default:
15+
# New lines should be covered by the unit suite when reasonable, but
16+
# many changes land in integration-heavy modules (walker, producer,
17+
# packer) that stay e2e-tested. Warn, don't fail.
18+
informational: true
19+
20+
comment:
21+
layout: "reach, diff, files"
22+
behavior: default
23+
require_changes: true
24+
25+
ignore:
26+
- "lib-es5/**"
27+
- "test/**"
28+
- "prelude/**"
29+
- "dictionary/**"
30+
- "scripts/**"
31+
- "docs-site/**"
32+
- "**/*.d.ts"
33+
34+
flags:
35+
unit:
36+
paths:
37+
- lib/
38+
carryforward: false

0 commit comments

Comments
 (0)