Skip to content

Commit fd1eec9

Browse files
robertsLandoclaude
andcommitted
ci(codecov): add nightly e2e-coverage job, drop "(unit)" from badge alt
Standing up the missing half of #267's Phase 2 acceptance criteria: "CI runs the unit suite on every PR (cheap) and the full coverage job on-label or nightly (expensive — full e2e)." - .github/workflows/coverage-nightly.yml: daily 03:00 UTC job (also workflow_dispatch) that runs yarn build + yarn coverage:e2e on Node 22 / Linux and uploads coverage/lcov.info to Codecov with `flags: e2e`. Reuses the same ~/.pkg-cache key as test.yml so it doesn't refetch all pkg-fetch binaries each night. - README: badge alt text is now "Coverage" — once the first nightly lands, Codecov merges the `unit` (from PR / main pushes) and `e2e` flag uploads per commit, so main-branch reports reflect the combined picture. PRs still show unit-only signal via flags. Codecov's flag-based merge means this doesn't touch the per-PR upload path — the existing build_artifact step keeps uploading unit with the fast ~2s feedback, and e2e drifts in once per day. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent f4d5644 commit fd1eec9

2 files changed

Lines changed: 58 additions & 1 deletion

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Coverage (nightly)
2+
3+
# Nightly e2e-coverage upload to Codecov. Runs the full e2e suite (no-npm
4+
# flavor, Node 22) under c8 and uploads the lcov with `flags: e2e`.
5+
#
6+
# PR runs already upload unit coverage with `flags: unit`; Codecov merges the
7+
# two flags per commit, so main-branch reports reflect unit + e2e combined
8+
# while PRs keep the fast (~2s) unit-only signal.
9+
#
10+
# This job is slow (~30 min), which is why it runs once per day on a schedule
11+
# and is only otherwise triggerable via workflow_dispatch.
12+
13+
on:
14+
schedule:
15+
# 03:00 UTC — off-peak, runs on whatever main HEAD is at that time.
16+
- cron: '0 3 * * *'
17+
workflow_dispatch:
18+
19+
jobs:
20+
e2e-coverage:
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 60
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: 22.x
28+
cache: 'yarn'
29+
30+
# pkg-fetch caches pre-built Node.js binaries in ~/.pkg-cache/. The
31+
# e2e suite downloads multiple targets; caching keeps the job from
32+
# refetching ~200 MB every night.
33+
- uses: actions/cache@v4
34+
with:
35+
path: ~/.pkg-cache/
36+
key: pkg-cache-ubuntu-latest-22.x
37+
restore-keys: |
38+
pkg-cache-ubuntu-latest-
39+
40+
- run: yarn install
41+
- run: yarn build
42+
43+
# coverage:e2e uses `c8 --clean=false`, but coverage/tmp doesn't exist
44+
# on a fresh checkout so the resulting lcov.info is pure e2e data.
45+
- name: Run e2e suite with coverage
46+
run: yarn coverage:e2e
47+
env:
48+
CI: true
49+
50+
- name: Upload e2e coverage to Codecov
51+
uses: codecov/codecov-action@v5
52+
with:
53+
token: ${{ secrets.CODECOV_TOKEN }}
54+
slug: yao-pkg/pkg
55+
files: coverage/lcov.info
56+
flags: e2e
57+
fail_ci_if_error: false

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +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>
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" /></a>
1414
<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>
1515
<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>
1616
<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>

0 commit comments

Comments
 (0)