Skip to content

Add GitHub Actions CI with JaCoCo coverage badges - #2

Merged
andreasarf merged 7 commits into
mainfrom
claude/github-actions-ci
Oct 15, 2026
Merged

andreasarf merged 7 commits into
mainfrom
claude/github-actions-ci

Conversation

@andreasarf

@andreasarf andreasarf commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds the CI setup that andreasarf/simple-websocket-service uses, adapted for this project and hardened over three review rounds.

.github/workflows/ci.yml

  • Runs on pushes and PRs to main, plus workflow_dispatch. The test job runs ./mvnw -B clean test on Temurin JDK 25 with the Maven cache.
  • On main, a separate badges job generates JaCoCo coverage and branch-coverage badges and commits them to .github/badges/.
  • Security:
    • The workflow token defaults to contents: read. Only the badges job, which never runs on PRs, gets contents: write.
    • The test checkout doesn't persist credentials.
    • Every action is pinned to a commit SHA.
  • Badge correctness: a workflow-level concurrency group runs main pushes one at a time, in order, and cancels superseded PR runs. The badges job also skips the commit when its run's commit is no longer the newest non-badge commit on main, so re-running an old run can't put stale numbers back.
  • timeout-minutes on both jobs. The coverage artifact is kept for 1 day.

Other files

  • .github/dependabot.yml: weekly updates for GitHub Actions and Maven. Maven minor and patch updates come grouped in one PR.
  • pom.xml: jacoco-maven-plugin 0.8.15 (Java 25 needs 0.8.14 or newer), wired into test.
  • lombok.config: marks Lombok-generated code so JaCoCo ignores it, the same as the websocket repo.
  • README: CI badge (status of main), plus coverage and branch-coverage badges.

The coverage badge images appear after the first CI run on main commits them. main has no branch protection, so the bot push is allowed.

Test plan

  • ./mvnw -B clean test on OpenJDK 25 passes, and the JaCoCo report is generated
  • CI is green on this PR (test passed; badges correctly skipped on PRs)
  • Badge "is this still the latest commit" guard checked locally: tip, tip plus a badge commit, an older commit, and a newer commit
  • First main run commits the badges (checked after merge)

🤖 Generated with Claude Code

https://claude.ai/code/session_012MLyPXGHeCc1fvTeB8JnT2

Mirrors the CI setup from simple-websocket-service:
- CI workflow runs ./mvnw clean test on JDK 25 (Temurin) for pushes and
  PRs to main, generates JaCoCo coverage/branch badges and commits them
  on pushes to main
- Dependabot keeps GitHub Actions versions up to date weekly
- JaCoCo 0.8.15 (Java 25 class files need 0.8.14+) wired into the
  test phase
- CI and coverage badges in README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012MLyPXGHeCc1fvTeB8JnT2
- lombok.config marks generated methods with @lombok.Generated so JaCoCo
  ignores @DaTa equals/hashCode/toString (same as simple-websocket-service)
- CI badge shows the status of main instead of the latest run on any branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012MLyPXGHeCc1fvTeB8JnT2
@andreasarf
andreasarf changed the base branch from claude/practical-dirac-t5uv58 to main October 15, 2026 11:42
- Default the workflow token to contents: read; only a separate badges job,
  which runs on pushes to main, gets contents: write
- Badges job checks out the tip of main and is serialized with a concurrency
  group so the auto-commit fast-forwards
- Skip badge generation on pull requests
- Pin actions/checkout and actions/setup-java to commit SHAs like the other
  actions (setup-java bumped to v6.1.0)
- Let Dependabot also update Maven dependencies

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012MLyPXGHeCc1fvTeB8JnT2
- Workflow-level concurrency cancels superseded PR runs and runs main
  pushes one at a time, so an older run can't overwrite newer badges
- timeout-minutes on both jobs
- workflow_dispatch to regenerate badges without a commit
- Don't persist the checkout token in the test job
- Group Dependabot Maven minor/patch updates into one PR

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012MLyPXGHeCc1fvTeB8JnT2
- Badges job skips the commit unless the run's commit is still the latest
  non-badge commit on main
- Single ref condition for the main-only steps
- Keep the coverage artifact for 1 day; it is only handed to the next job

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012MLyPXGHeCc1fvTeB8JnT2
@andreasarf
andreasarf merged commit aadc4d8 into main Oct 15, 2026
2 checks passed
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.

2 participants