Skip to content

chore(ci): replace Codecov with GitHub-native coverage reporting#335

Merged
rhuanbarreto merged 12 commits into
mainfrom
chore/replace-codecov-with-github-native-coverage
May 24, 2026
Merged

chore(ci): replace Codecov with GitHub-native coverage reporting#335
rhuanbarreto merged 12 commits into
mainfrom
chore/replace-codecov-with-github-native-coverage

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

  • Replace Codecov with inline coverage reporting that works directly in GitHub — no external service, no tokens, no third-party actions
  • Coverage is now shown as a GitHub Actions job summary (visible in the Actions tab) and a sticky PR comment (updates in place on re-runs)
  • Parses coverage/lcov.info with awk for per-directory line coverage stats, posts via gh CLI
  • Remove codecov.yml config and all codecov-action references from both workflows
  • Simplify test:coverage script by dropping the JUnit reporter (was only used for Codecov test results)
  • Switch release workflow from validate:coverage to validate (coverage is a PR concern, not a release concern)

Cleanup note

The CODECOV_TOKEN secret in GitHub repo settings (Settings > Secrets and variables > Actions) can be removed — it is no longer referenced.

Test plan

  • Open this PR and verify the "Coverage report" step runs in the Validate workflow
  • Check the Actions job summary shows a coverage table with per-directory breakdown
  • Verify a coverage comment is posted on the PR with the same data
  • Push another commit and verify the PR comment is updated (not duplicated)
  • Verify the release workflow uses bun run validate (no coverage step)

Codecov was unreliable and required an external service. Replace it
with inline lcov parsing that posts coverage as a GitHub Actions job
summary and a sticky PR comment via the gh CLI.

- Parse lcov.info with awk for line coverage stats
- Write per-directory breakdown to job summary
- Post/update sticky PR comment (non-fork PRs only)
- Remove codecov.yml config and codecov-action references
- Simplify test:coverage script (drop JUnit reporter)
- Switch release workflow to validate (no coverage needed)

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@github-actions

github-actions Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Metric Value
Lines 90.0% (6393 / 7107)
Platforms Linux + Windows

Full HTML report available in workflow artifacts.

Per-directory breakdown
Directory Coverage Lines
src/commands/ 88.0% 2044 / 2323
src/engine/ 93.0% 1122 / 1206
src/formats/ 100.0% 140 / 140
src/helpers/ 89.8% 3087 / 3438

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 23, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: c99e80c
Status: ✅  Deploy successful!
Preview URL: https://7de37d5f.archgate-cli.pages.dev
Branch Preview URL: https://chore-replace-codecov-with-g.archgate-cli.pages.dev

View logs

Generate an interactive HTML coverage report via genhtml (lcov) and
upload it as a GitHub Actions artifact (30-day retention). The PR
comment and job summary now link to the artifact for detailed
per-file coverage inspection.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
- Filter lcov.info to src/* via lcov --extract before genhtml, fixing
  permission errors from test temp dir paths (../../../tmp/...)
- Use gh pr comment --edit-last instead of the issues REST API, which
  returned 404 because pull-requests:write does not cover it
- Read coverage stats from the filtered lcov-src.info

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Add 19 tests exercising the check command's action handler via
parseAsync(), covering: no project root, no rules, load errors,
ExitPromptError re-throw, output format selection (console/JSON/CI),
--verbose/--staged/--adr option forwarding, file arguments, agent
context auto-JSON, exit code propagation, and telemetry tracking.

Split into check-action.test.ts to stay within the 500-line limit.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Add 9 tests exercising the upgrade command's action handler via
parseAsync(), covering: successful binary download and replace,
telemetry tracking (success and failure), version comparison (already
up-to-date, null fetch), unsupported platform, download failure with
manual hint, ExitPromptError re-throw, and plugin update offer.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Add --coverage to the Windows smoke test and upload its lcov as an
artifact. Move coverage reporting to a dedicated job that downloads
both platform lcov files, normalizes Windows backslash paths, merges
them with lcov --add-tracefile, and generates a combined HTML report.

The PR comment and job summary now show merged cross-platform
coverage with a "Platforms" row indicating which platforms contributed.
If Windows coverage is unavailable (skipped/failed), the report
gracefully falls back to Linux-only data.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
genhtml needs the source files to generate line-level coverage
annotations in the HTML report. The coverage job was missing a
checkout step, causing "does not exist" errors.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
The upgrade test hooks were imported via `import(...?t=${Date.now()})`
to get a "fresh module instance", but upgrade.ts has no module-level
state — all functions read process.execPath and env vars at call time.
The cache-bust created separate module instances that Bun's coverage
instrumenter couldn't attribute back to the source file, silently
dropping coverage from 17+ tests.

Switch to static imports in both upgrade.test.ts and
plugin/shared.test.ts. Also narrow discriminated union types that the
cache-bust was silently bypassing (returned `any`), and update the
JSDoc comment on the test hook exports.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Add 12 tests covering the previously untested tryInstallPlugin
function (0% → covered), exercising: no credentials, cursor
marketplace URL, vscode auto-install, claude/copilot/opencode with
CLI available/unavailable, and install failure fallback paths.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Add coverage notes explaining why private environment detection
functions (detectCiProvider, detectShell, detectLocale) and PostHog
SDK init/capture internals show 0% coverage: tests run with
ARCHGATE_TELEMETRY=0 so the client is never initialized. These are
validated via the PostHog dashboard, not unit tests.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Add skipComments: true to the max-lines rule in .oxlintrc.json so
that comments and JSDoc blocks don't count toward the 500-line limit.
Code documentation should never be penalized by line budget.

Restores the full JSDoc on detectCiProvider that was trimmed to fit.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@rhuanbarreto rhuanbarreto merged commit 88a4afa into main May 24, 2026
12 checks passed
@rhuanbarreto rhuanbarreto deleted the chore/replace-codecov-with-github-native-coverage branch May 24, 2026 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant