Skip to content

Publish TestingBot results as a GitHub check (testingbotChecks)#30

Merged
jochen-testingbot merged 2 commits into
build-report-embedfrom
github-checks
Jul 16, 2026
Merged

Publish TestingBot results as a GitHub check (testingbotChecks)#30
jochen-testingbot merged 2 commits into
build-report-embedfrom
github-checks

Conversation

@jochen-testingbot

@jochen-testingbot jochen-testingbot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What

Publishes the TestingBot outcome of a build as a GitHub check (✅/❌ on the commit & PR), the modern equivalent of Sauce Labs' "custom context + message" GitHub Pull Request Builder option.

Change

New TestingBotChecksPublisher (Recorder + SimpleBuildStep, @Symbol("testingbotChecks")) — works as a freestyle post-build action and as a pipeline step:

testingbotChecks(name: 'TestingBot', message: 'End-to-end tests on TestingBot')
  • name — the check name/context on the commit/PR (default TestingBot).
  • message — optional summary; when empty, a summary is generated from the TestingBot sessions in the build.
  • Conclusion: reflects the TestingBot sessions found in the build (all passed → success); falls back to the overall build result when none are present.
  • Details URL links to the embedded TestingBot build report (from Add TESTINGBOT_BUILD env var and embedded build-report page #28) when present, else the run URL.

Delivery to GitHub is handled at runtime by the github-checks plugin + a GitHub App; when absent, ChecksPublisherFactory.fromRun returns a NullChecksPublisher so the step is a safe no-op. Depends on checks-api + display-url-api (both BOM-managed).

Validation

  • mvn -DskipTests verify (SpotBugs on) — clean.
  • hpi:run script console:
    • Post-build descriptor registers; freestyle name/message config round-trips; default name is TestingBot.
    • Pipeline testingbotChecks(...) runs green as a no-op with no GitHub Checks impl installed.
    • With a capturing ChecksPublisherFactory, the published ChecksDetails is verified end-to-end: passing build → name TestingBot, status COMPLETED, conclusion SUCCESS, configured summary, run-URL details link; failing build → conclusion FAILURE.

Note

Stacked on #28 (build-report-embed) for the build-report details URL. Retarget to master once #28 merges.

Summary by CodeRabbit

  • New Features
    • Added the ability to publish TestingBot test results as GitHub commit and pull request checks.
    • Configure a check name and optional summary message.
    • Checks include pass/fail outcomes, test result details, and a link to the full TestingBot report.
    • Added support for freestyle post-build actions and Pipeline configuration.
  • Documentation
    • Added setup and configuration guidance for publishing GitHub checks.

Adds a TestingBotChecksPublisher (freestyle post-build action + the
testingbotChecks pipeline step) that publishes the build's TestingBot outcome
as a GitHub check via the checks-api plugin. The check name (its context) and
summary message are configurable — the modern equivalent of the custom
context/message Sauce exposes for GitHub Pull Request Builder jobs.

The conclusion reflects the TestingBot sessions in the build (all passed ->
success), falling back to the overall build result when none are present, and
the check links to the embedded TestingBot build report. Delivery to GitHub is
provided at runtime by the github-checks plugin; when absent the publish is a
safe no-op (NullChecksPublisher). Depends on checks-api + display-url-api (both
BOM-managed).
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fe26be44-63ef-4f35-9fcf-f7c2bd3f636a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Line 151: Update the “Publishing results as a GitHub check” heading in
README.md to use the repository’s required setext heading style instead of an
ATX heading, preserving the heading text and section structure.

In `@src/main/java/testingbot/TestingBotChecksPublisher.java`:
- Around line 95-103: Update the result-processing loop in
TestingBotChecksPublisher to normalize and deduplicate the session IDs returned
by TestingBotReportFactory.findSessionIDs(cr), then count and render each unique
session rather than each CaseResult. Ensure total, passed, rows, and the
resulting conclusion all reflect the unique-session counts while preserving
existing handling for cases with no sessions.

In `@src/main/resources/testingbot/TestingBotChecksPublisher/help-message.html`:
- Around line 2-4: Update the help text describing the TestingBot check link to
state that it links to the embedded TestingBot build report when available, and
otherwise falls back to the Jenkins run URL.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e49c33b6-93ff-4f40-a78d-f44d8957762e

📥 Commits

Reviewing files that changed from the base of the PR and between cce2a98 and bfba787.

📒 Files selected for processing (6)
  • README.md
  • pom.xml
  • src/main/java/testingbot/TestingBotChecksPublisher.java
  • src/main/resources/testingbot/TestingBotChecksPublisher/config.jelly
  • src/main/resources/testingbot/TestingBotChecksPublisher/help-message.html
  • src/main/resources/testingbot/TestingBotChecksPublisher/help-name.html

Comment thread README.md
}
```

## Publishing results as a GitHub check

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the repository’s required heading style.

markdownlint-cli2 reports MD003 here because this section uses an ATX heading while the repository expects setext headings. Convert it to:

Proposed fix
-## Publishing results as a GitHub check
+Publishing results as a GitHub check
+-----------------------------------
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Publishing results as a GitHub check
Publishing results as a GitHub check
-----------------------------------
🧰 Tools
🪛 markdownlint-cli2 (0.23.0)

[warning] 151-151: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` at line 151, Update the “Publishing results as a GitHub check”
heading in README.md to use the repository’s required setext heading style
instead of an ATX heading, preserving the heading text and section structure.

Source: Linters/SAST tools

Comment on lines +95 to +103
if (TestingBotReportFactory.findSessionIDs(cr).isEmpty()) {
continue;
}
total++;
boolean casePassed = cr.isPassed();
if (casePassed) {
passed++;
}
rows.add("| " + cr.getFullName() + " | " + (casePassed ? "✅ passed" : "❌ failed") + " |");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Count unique TestingBot sessions, not merely test cases.

TestingBotReportFactory.findSessionIDs(cr) returns every matching session token, but this code only checks whether the list is non-empty and increments total once per CaseResult. Multiple sessions in one case, or repeated tokens across fields, therefore produce incorrect totals, pass counts, rows, and potentially the conclusion. Normalize/deduplicate the IDs and count/render each session, or enforce a one-session-per-case contract upstream.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/testingbot/TestingBotChecksPublisher.java` around lines 95 -
103, Update the result-processing loop in TestingBotChecksPublisher to normalize
and deduplicate the session IDs returned by
TestingBotReportFactory.findSessionIDs(cr), then count and render each unique
session rather than each CaseResult. Ensure total, passed, rows, and the
resulting conclusion all reflect the unique-session counts while preserving
existing handling for cases with no sessions.

Comment on lines +2 to +4
Optional summary shown on the check. When left empty, a summary is generated from the TestingBot
sessions in the build (for example, <code>3 of 4 TestingBot session(s) passed.</code>).
The check also links to the embedded TestingBot build report.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Document the report-link fallback.

The publisher links to the embedded TestingBot report only when available; otherwise the check links to the Jenkins run URL. Update this text to reflect both cases.

Proposed wording
-    The check also links to the embedded TestingBot build report.
+    When available, the check links to the embedded TestingBot build report;
+    otherwise it links to the Jenkins run.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Optional summary shown on the check. When left empty, a summary is generated from the TestingBot
sessions in the build (for example, <code>3 of 4 TestingBot session(s) passed.</code>).
The check also links to the embedded TestingBot build report.
Optional summary shown on the check. When left empty, a summary is generated from the TestingBot
sessions in the build (for example, <code>3 of 4 TestingBot session(s) passed.</code>).
When available, the check links to the embedded TestingBot build report;
otherwise it links to the Jenkins run.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/resources/testingbot/TestingBotChecksPublisher/help-message.html`
around lines 2 - 4, Update the help text describing the TestingBot check link to
state that it links to the embedded TestingBot build report when available, and
otherwise falls back to the Jenkins run URL.

…iew on #30)

- TestingBotChecksPublisher now counts and renders each distinct session id
  (trimmed + deduplicated across cases) instead of one entry per CaseResult, so
  a case logging several sessions, or a session shared by several cases, is
  reflected accurately in total/passed/rows and the conclusion. Cases without
  sessions still contribute nothing.
- help-message.html now states the check links to the embedded build report when
  available and otherwise to the Jenkins run.

Skipped the README setext-heading suggestion: the repo uses ATX headings (## / ###)
for every section and subsection; only the H1 title is setext, so ## here is
consistent.
@jochen-testingbot jochen-testingbot merged commit 6f77011 into build-report-embed Jul 16, 2026
4 checks passed
jochen-testingbot added a commit that referenced this pull request Jul 16, 2026
PRs #29 and #30 were merged into the build-report-embed branch, but that branch
had already been squash-merged to master as #28 beforehand, so their code never
reached master. This brings the stranded changes forward, on top of the current
master (which already has #28 and the #31 inline-media feature):

- #29: run the freestyle tunnel on the build's agent (TunnelManager.startOnChannel/
  stopOnChannel + shared registry; wrapper + testingbotTunnel step delegate to it).
- #30: TestingBotChecksPublisher (testingbotChecks) publishing results as a GitHub
  check, plus the checks-api + display-url-api dependencies and docs.

No behavior change versus the already-reviewed #29/#30; only rebased onto master.
The inline-media (#31) files are left untouched.
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