From f0d6771ba76b63313e2a3e1217320124e6cde48f Mon Sep 17 00:00:00 2001 From: windka Date: Tue, 18 Aug 2026 16:08:27 +0200 Subject: [PATCH] ci: upload an inspectable coverage report as a build artifact MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The standard's CI template uploads the coverage report so a threshold failure can be inspected from the failing run instead of only being reproducible locally. This repo ran `coverage:check` but never kept the report. Two things were needed to make that worth having. c8 was running with its default text reporter, so `coverage/` held only tmp/ — raw V8 JSON, which is not something anyone can inspect. Added `reporter: ["text", "lcov"]`, so the run now also produces lcov.info and a browsable lcov-report. And the artifact uploads only those two, not the whole coverage/ directory: tmp/ is 23 MB here against a 647 kB report, so uploading the directory would ship ~97% dead weight on every run for 14 days. Gated on the 22.x leg only: the report is identical across matrix legs, and two legs writing the same artifact name is an error. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/node.js.yml | 15 +++++++++++++++ package.json | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 2e024a3..5a95638 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -24,3 +24,18 @@ jobs: - run: npm run format:check - run: npm test - run: npm run coverage:check + # Uploaded from one matrix leg only — the report is identical across them, and + # two legs writing the same artifact name is an error. Makes a coverage + # regression inspectable from the failing run instead of only reproducible locally. + - name: Upload coverage report + if: matrix.node-version == '22.x' + uses: actions/upload-artifact@v7 + with: + name: coverage-report + # Only the readable report. `coverage/` also holds c8's raw V8 dump in + # tmp/, which is ~97% of the bytes and inspectable by nothing — 23 MB of + # tmp against a 647 kB report in the worst case here. + path: | + coverage/lcov-report + coverage/lcov.info + retention-days: 14 diff --git a/package.json b/package.json index 32b5484..8c92397 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,10 @@ "coverage:check": "c8 --check-coverage npm test" }, "c8": { + "reporter": [ + "text", + "lcov" + ], "include": [ "telegrambot/**/*.js" ],