Skip to content

Post reports as a single PR comment#151

Open
gohabereg wants to merge 45 commits into
mainfrom
chore/pr-reporting
Open

Post reports as a single PR comment#151
gohabereg wants to merge 45 commits into
mainfrom
chore/pr-reporting

Conversation

@gohabereg
Copy link
Copy Markdown
Member

@gohabereg gohabereg commented May 31, 2026

Now only a single comment with test reports generated and updated for all workflows. Some minor workflow changes as well. Coverage comparison would be enabled after merge as base branch doesn't generate summary at the moment

Suggestions on the format are welcome.
Current format for a package section (warning are displayed conditionally):


<package-name>

Unit tests report

<number> tests passed in <number> suites.
Branches coverage: <number>%

Caution

Coverage for <category> dropped by <number>%
Coverage for <another-category> dropped by <number>%

Mutation tests report

Mutation tests run with mutation score <number>%.
Survived mutants: <number>
Not covered mutants: <number>

Caution

Mutation score is below the low threshold of <number>%

Warning

Mutation score is below the low threshold of <number>%

Dashboard URL: <URL>


@gohabereg gohabereg marked this pull request as ready for review June 1, 2026 13:59
@gohabereg gohabereg requested a review from Copilot June 1, 2026 13:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the CI pipelines to generate unit-test coverage + mutation-test artifacts per workflow and aggregate them into a single, continuously-updated PR comment (one section per package/workflow), while also adding workflow concurrency controls and bumping multiple GitHub Actions versions.

Changes:

  • Generate/upload Jest JSON + coverage summary artifacts (head + base) and Stryker JSON artifacts for later aggregation.
  • Add an aggregate-report composite action plus scripts to assemble Markdown and update a single PR comment.
  • Add concurrency to multiple workflows and introduce a new report job that posts/updates the aggregated comment.

Reviewed changes

Copilot reviewed 34 out of 35 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
packages/sdk/jest.config.ts Adds coverage reporters needed for summary extraction.
packages/ot-server/package.json Updates coverage script to emit Jest JSON output.
packages/ot-server/jest.config.ts Adds coverage reporters for JSON summary + text summary.
packages/model/stryker.conf.mjs Adds JSON reporter for mutation results.
packages/model/package.json Updates coverage script to emit Jest JSON output.
packages/model/jest.config.ts Adds coverage reporters for JSON summary + text summary.
packages/dom-adapters/package.json Updates coverage script to emit Jest JSON output (currently with trailing whitespace bug).
packages/dom-adapters/jest.config.ts Adds coverage reporters for JSON summary + text summary.
packages/core/stryker.conf.mjs Adds JSON reporter for mutation results.
packages/core/package.json Updates coverage script to emit Jest JSON output.
packages/core/jest.config.ts Adds coverage reporters for JSON summary + text summary.
packages/collaboration-manager/package.json Updates coverage script to emit Jest JSON output.
packages/collaboration-manager/jest.config.ts Adds coverage reporters for JSON summary + text summary.
.gitignore Ignores generated jest-report.json.
.github/workflows/sdk.yml Adds concurrency + bumps checkout action version.
.github/workflows/playground.yml Adds concurrency + bumps checkout action version.
.github/workflows/ot-server.yml Adds concurrency, bumps checkout version, adds report job (needs PR-only gating).
.github/workflows/npm-publish.yml Bumps checkout/setup-node action versions.
.github/workflows/model.yml Adds concurrency, bumps checkout version, adds report job (needs PR-only gating).
.github/workflows/dom-adapters.yml Adds concurrency, bumps checkout version, adds report job (needs PR-only gating; mutation JSON reporter mismatch).
.github/workflows/core.yml Adds concurrency, bumps checkout version, adds report job.
.github/workflows/collaboration-manager.yml Adds concurrency, bumps checkout version, adds report job (needs PR-only gating).
.github/workflows/build-and-push-docker-image.yml Bumps checkout action version.
.github/scripts/update-aggregated-comment.js Implements “create/update single aggregated PR comment” logic (export format currently incompatible with require).
.github/scripts/process-mutation.js Parses mutation JSON + changed-files list into Markdown (module format + logic issues).
.github/scripts/generate-report.js Generates per-package Markdown section (export format currently incompatible with require).
.github/scripts/compare-coverage.js Compares head/base coverage + extracts Jest counts into Markdown (module format + formatting issues).
.github/actions/unit-tests/action.yml Runs coverage, uploads artifacts, triggers base coverage (needs PR-only gating).
.github/actions/setup/action.yml Bumps cache action version.
.github/actions/mutation-tests-changed-files/action.yml Uploads mutation artifacts and changed-files list for aggregation.
.github/actions/mutation-tests-all-files/action.yml Bumps setup-node/changed-files versions.
.github/actions/lint/action.yml Bumps setup-node version.
.github/actions/build/action.yml Bumps setup-node version.
.github/actions/base-coverage/action.yml New composite action to run coverage on base ref and upload artifacts.
.github/actions/aggregate-report/action.yml New composite action to download artifacts, build Markdown, and update the aggregated PR comment (coverage path handling needed).
Comments suppressed due to low confidence (1)

.github/scripts/compare-coverage.js:118

  • After removing the ESM export keyword, processReports still needs to be exported for the require(...).processReports call site. Add a CommonJS export at the end of the file.
  return message;
}




💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/dom-adapters/package.json Outdated
"lint:fix": "yarn lint --fix",
"test": "jest",
"test:coverage": "yarn test --coverage=true",
"test:coverage": "yarn test --coverage=true --json --outputFile=jest-report.json ",
Comment thread .github/scripts/compare-coverage.js
Comment thread .github/scripts/compare-coverage.js Outdated
Comment thread .github/scripts/process-mutation.js
Comment on lines +21 to +29
const score = (killed + timedOut) / (killed + timedOut + notCovered + survived).toFixed(2);

return {
total,
score,
survived,
notCovered,
thresholds: obj.thresholds,
};
Comment thread .github/actions/aggregate-report/action.yml
Comment on lines +38 to 42
- name: Run base coverage action
uses: ./.github/actions/base-coverage
with:
package-name: ${{ inputs.package-name }}
working-directory: ${{ inputs.working-directory }}
Comment thread .github/scripts/compare-coverage.js Outdated
Comment on lines +98 to +112
let message = `${tests.passedTests} tests passed in ${tests.passedSuites} suites.\n`

message += `Branches coverage: ${categories.branches.head}%\n`;

let warning = '';

for (const cat in categories) {
if (categories[cat].delta < 0) {
warning += `Coverage for ${cat} dropped by ${categories[cat].delta.toFixed(2)}%\n`;
}
}

if (warning.length > 0) {
message += `> [!WARNING]\n> ${message}\n`;
}
Comment thread .github/scripts/process-mutation.js Outdated
Comment on lines +37 to +48
if (!fs.existsSync(reportFile) && !fs.existsSync(changedFilesFile)) {
return '';
}
const changedFiles = JSON.parse(fs.readFileSync(changedFilesFile, 'utf8'));

if (changedFiles.length === 0) {
return 'No files to mutate found.';
}

const raw = fs.readFileSync(reportFile, 'utf8');
const obj = JSON.parse(raw);

Comment thread .github/scripts/process-mutation.js Outdated
Comment on lines +52 to +66
let message = `Mutation tests run with mutation score ${(metrics.score * 100).toFixed(2)}%.\n`;

if (metrics.survived) {
message += `Survived mutants: ${metrics.survived}\n`;
}

if (metrics.notCovered) {
message += `Not covered mutants: ${metrics.notCovered}\n`;
}

if (metrics.score < metrics.thresholds.low) {
message += `> [!WARNING]\n> Mutation score is below the low threshold of ${metrics.thresholds.low}%\n`;
} else if (metrics.score < metrics.thresholds.high) {
message += `> [!CAUTION]\n> Mutation score is below the high threshold of ${metrics.thresholds.low}%\n`;
}
@neSpecc
Copy link
Copy Markdown
Contributor

neSpecc commented Jun 1, 2026

@editorjs/model

Unit tests report

563 tests passed in 26 suites. Branches coverage: 98.43%

Mutation tests report

No files to mutate found.

@editorjs/core

Unit tests report

143 tests passed in 8 suites. Branches coverage: 91.3%

Mutation tests report

No files to mutate found.

@editorjs/collaboration-manager

Unit tests report

130 tests passed in 7 suites. Branches coverage: 85.81%

@editorjs/ot-server

Unit tests report

4 tests passed in 1 suites. Branches coverage: 20%

@editorjs/dom-adapters

Unit tests report

11 tests passed in 2 suites. Branches coverage: 86.95%

Mutation tests report

No files to mutate found.

  1. Why do we need to see tests result in a comment when we can see it in Checks section?
  2. It will show reports for all packages every time? Or only for those which was affected in a PR?

@gohabereg
Copy link
Copy Markdown
Member Author

  1. We can remove test results, the main info is coverage anyway. Maybe instead we can include coverage on changed or added files

  2. For now it shows all packages every time. I am not sure how we can selectively run the workflows and guarantee there won't be integration problems. Will look into it

@neSpecc
Copy link
Copy Markdown
Contributor

neSpecc commented Jun 1, 2026

  1. We can remove test results, the main info is coverage anyway. Maybe instead we can include coverage on changed or added files
  2. For now it shows all packages every time. I am not sure how we can selectively run the workflows and guarantee there won't be integration problems. Will look into it

maybe it would be better to display the result as a simple table

package coverage coverage change
@editorjs/model 98.43% increased
@editorjs/core 99.11%
@editorjs/ot-server 80.12% ⚠️ decreased


- name: Find current PR's number
uses: jwalton/gh-find-current-pr@v1
id: findPr
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
id: findPr
id: find_pr

for ids consistency if possible

Comment on lines +9 to +16
if (fs.existsSync(report)) {
try {
return JSON.parse(fs.readFileSync(report, 'utf8'));
} catch (report) {
// continue
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice if eslint checked this scripts too, but for now i would suggest logging of the report or explicitly dismissing with void report

Comment thread .github/scripts/compare-coverage.js Outdated
Comment on lines +35 to +37
} catch (e) {
// ignore parse errors
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, dismiss or log

Comment thread .github/scripts/compare-coverage.js Outdated
Comment on lines +91 to +92
// prefer head counts; if missing, fallback to base counts; otherwise null
const tests = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// prefer head counts; if missing, fallback to base counts; otherwise null
const tests = {
// prefer head counts; if missing, fallback to base counts; otherwise null
const tests = {

Comment thread .github/scripts/compare-coverage.js Outdated

for (const cat in categories) {
if (categories[cat].delta < 0) {
warning += `\n> Coverage for ${cat} dropped by ${categories[cat].delta.toFixed(2)}%\n`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if delta is 'N/A' — it has no toFixed() method, otherwise delta is already .toFixed(2)

Comment thread .github/scripts/should-run-ci.sh
Comment thread .github/scripts/should-run-ci.sh Outdated
Comment on lines +49 to +54
elif git rev-parse --verify "origin/master" >/dev/null 2>&1; then
RESOLVED_BASE_REF="origin/master"
debug "Resolved base ref as: origin/master"
elif git rev-parse --verify "master" >/dev/null 2>&1; then
RESOLVED_BASE_REF="master"
debug "Resolved base ref as: master"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant

Suggested change
elif git rev-parse --verify "origin/master" >/dev/null 2>&1; then
RESOLVED_BASE_REF="origin/master"
debug "Resolved base ref as: origin/master"
elif git rev-parse --verify "master" >/dev/null 2>&1; then
RESOLVED_BASE_REF="master"
debug "Resolved base ref as: master"

Comment thread .github/scripts/generate-report.js Outdated
let md = '';

md += `<!-- ${pkg} REPORT -->\n`;
md += `## ${pkg}\n\n`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets start with separator

Suggested change
md += `## ${pkg}\n\n`;
md += '---'
md += `## ${pkg}\n\n`;

@editor-js editor-js deleted a comment from github-actions Bot Jun 1, 2026
@editor-js editor-js deleted a comment from github-actions Bot Jun 1, 2026
@editor-js editor-js deleted a comment from github-actions Bot Jun 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

Unit Tests

Package Coverage Delta
@editorjs/dom-adapters 86.95% N/A
@editorjs/core 91.3% N/A
@editorjs/ot-server 20% N/A
@editorjs/model 98.43% N/A
@editorjs/collaboration-manager 85.81% N/A

Mutation Tests

Package Mutation score Dashboard URL
@editorjs/dom-adapters No files to mutate found.
@editorjs/core No files to mutate found.
@editorjs/model No files to mutate found.

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.

4 participants