Skip to content

feat(scala-ci): add reusable sbt/Scala CI workflow#2

Merged
monsieurleberre merged 5 commits into
devfrom
feat/jvm-helper-ci
May 27, 2026
Merged

feat(scala-ci): add reusable sbt/Scala CI workflow#2
monsieurleberre merged 5 commits into
devfrom
feat/jvm-helper-ci

Conversation

@monsieurleberre

@monsieurleberre monsieurleberre commented May 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds scala-ci.yaml, the Scala analogue of csharp-ci.yaml — a workflow_call-only reusable workflow that runs sbt build/test/coverage and emits a Cobertura summary + sticky PR comment + job-summary + artifact upload, mirroring the csharp-ci pattern step-for-step (minus the pack: job; jvm-helper is internal-only today).
  • Extracted from the inline jvm-helper-ci job in peacefulstudio/daml-codegen-csharp (.github/workflows/ci.yaml lines 31-100); step SHAs are copied across verbatim.
  • Workflow is named scala-ci, not jvm-helper-ci — it is reusable across any sbt/Scala workspace; the "helper" suffix would leak the only-current-caller's name into the contract. Renamed from jvm-ci to align on a language axis with csharp-ci (mixed language-vs-runtime axis was confusing).
  • New coverage-title input (default 'Scala coverage') prepends a markdown H2 to the rendered coverage report so a reader can tell which language each sticky PR comment covers when csharp-ci and scala-ci comment on the same PR.
  • Bumps actions/setup-java v5.0.0 -> v5.2.0 and actions/cache v4.2.3 -> v5.0.5 (cache v5 moves to Node 24; GitHub-hosted runners already meet the 2.327.1 minimum and the with: keys we set are unchanged).

Test plan

  • Sibling PR peacefulstudio/daml-codegen-csharp#164 (branch ci/test-csharp-ci-pr1) is updated to pin its jvm-helper-ci job to this PR's head SHA, point at scala-ci.yaml, and replace its inline steps with a uses: call.
  • That sibling PR's CI run is the integration test — confirms inputs resolve, the cache hits, sbt runs, the Cobertura report is staged at jvm-helper/coverage/merged/Cobertura.xml, the sticky comment posts with header scala-coverage and a visible ## Scala coverage heading, and the artifact uploads under name scala-coverage.
  • actionlint v1.7.7 (the same version used by this repo's build-and-test workflow) passes cleanly on the new file.

@monsieurleberre monsieurleberre changed the title feat(jvm-helper-ci): add reusable sbt/Scala CI workflow feat(jvm-ci): add reusable sbt/Scala CI workflow May 27, 2026
monsieurleberre added a commit that referenced this pull request May 27, 2026
* Tighten coverage-pr-comment-header description: this is a hidden
  HTML-comment dedup key for marocchino/sticky-pull-request-comment,
  not the visible header; redirect callers to coverage-title for the
  H2. Also flag that it shares the default string 'jvm-coverage' with
  coverage-artifact-name but the two are unrelated knobs.
* Tighten coverage-artifact-name description: explicit that it names
  the actions/upload-artifact target and shares (but does not unify
  with) coverage-pr-comment-header's default.
* Tighten coverage-title description: note that
  coverage-pr-comment-header is HTML-comment-only so the rendered
  comment shows ONLY the H2, no doubling.
* sbt-command description: warn that the step runs `eval "sbt $SBT_COMMAND"`
  to preserve embedded quoting, so the input must come from a trusted
  caller — workflow_dispatch would violate the precondition.
* Loud-fail "Prepend coverage title" if code-coverage-results.md is
  missing, matching the csharp-ci pattern.
* Loud-fail "Write to Job Summary" on the same missing file, matching
  csharp-ci's loud-fail shape.
* Bump actions/upload-artifact v5.0.0 -> v7.0.1 to match csharp-ci's pin.
@monsieurleberre monsieurleberre changed the title feat(jvm-ci): add reusable sbt/Scala CI workflow feat(scala-ci): add reusable sbt/Scala CI workflow May 27, 2026
monsieurleberre added a commit that referenced this pull request May 27, 2026
Brings go-ci.yaml onto the same shape as csharp-ci (PR #1) and
scala-ci (PR #2): a visible H2 heading is prepended to the rendered
coverage markdown before the sticky-comment step picks it up, so a
reader can tell the language at a glance when multiple coverage
sticky comments coexist on the same PR.

Default `coverage-title` is "Go coverage". The new "Prepend coverage
title" step runs after the existing "Augment coverage report with
cyclomatic complexity" step (which mutates `code-coverage-results.md`
in place) so the H2 ends up at the top of the final file, and loud-
fails if `code-coverage-results.md` is missing — mirroring the
pattern landed in csharp-ci / scala-ci.

terraform-ci.yaml is intentionally NOT changed: it has no coverage
chain (no `irongut/CodeCoverageSummary` step, no
`code-coverage-results.md`), only a separate `test-summary.md`
sticky comment. Adding `coverage-title` there would mean fabricating
a coverage chain, which is out of scope for this PR.

PR #1 (csharp-ci) and PR #2 (scala-ci) are still open. README
updates documenting `coverage-title` will follow once those land,
to avoid three-way conflicts on README.md.
@monsieurleberre monsieurleberre enabled auto-merge (squash) May 27, 2026 08:02
JVM analogue of csharp-ci.yaml. Extracts the build/test/coverage flow
from daml-codegen-csharp's inline `jvm-helper-ci` job (checkout, JDK
setup, sbt cache, sbt build+coverage, Cobertura staging, summary, sticky
PR comment, job summary, artifact upload) into a `workflow_call`-only
reusable workflow.

The workflow is named `jvm-ci` (not `jvm-helper-ci`) — it is reusable
across any sbt/Scala workspace; the "helper" suffix would leak the
only-current-caller's name into the contract.

Sticky PR coverage comment is language-labelled via a new
`coverage-title` input (default `'JVM coverage'`), prepended to the
rendered report so a reader can tell which language each sticky note
covers when csharp-ci and jvm-ci comment on the same PR.

No `pack:` job — JVM helper is internal-only today (tracer-bullet rule).
* Tighten coverage-pr-comment-header description: this is a hidden
  HTML-comment dedup key for marocchino/sticky-pull-request-comment,
  not the visible header; redirect callers to coverage-title for the
  H2. Also flag that it shares the default string 'jvm-coverage' with
  coverage-artifact-name but the two are unrelated knobs.
* Tighten coverage-artifact-name description: explicit that it names
  the actions/upload-artifact target and shares (but does not unify
  with) coverage-pr-comment-header's default.
* Tighten coverage-title description: note that
  coverage-pr-comment-header is HTML-comment-only so the rendered
  comment shows ONLY the H2, no doubling.
* sbt-command description: warn that the step runs `eval "sbt $SBT_COMMAND"`
  to preserve embedded quoting, so the input must come from a trusted
  caller — workflow_dispatch would violate the precondition.
* Loud-fail "Prepend coverage title" if code-coverage-results.md is
  missing, matching the csharp-ci pattern.
* Loud-fail "Write to Job Summary" on the same missing file, matching
  csharp-ci's loud-fail shape.
* Bump actions/upload-artifact v5.0.0 -> v7.0.1 to match csharp-ci's pin.
Aligns the workflow on the language axis (csharp-ci + scala-ci, C# coverage
+ Scala coverage) instead of the mixed language-vs-runtime axis. Default
strings shift jvm-coverage to scala-coverage and JVM coverage to Scala
coverage; references to JDK / java-version stay where they genuinely
denote the Java runtime.

Pin updates:
- actions/setup-java v5.0.0 -> v5.2.0 (additive + dep updates)
- actions/cache v4.2.3 -> v5.0.5 (Node 24 runtime; runner already meets
  the 2.327.1 minimum; with: keys path/key/restore-keys unchanged)
Adds an entry for `scala-ci.yaml` mirroring the `csharp-ci.yaml` section
shape (overview, uses snippet, input table, caller prerequisites) so
consumers get the same documentation footing across languages.
scala-ci has no BOT_GITHUB_TOKEN wiring and the only sbt resolver in the
canonical caller (peacefulstudio/daml-codegen-csharp jvm-helper) is Maven
Central. The packages:read grant was cargo-culted from csharp-ci, where
it is actually load-bearing for private NuGet feeds. Least-privilege: drop
it from the job's permissions block and from the README's required-perms
listing.

Also bring the README's scala-ci consumer snippet to structural parity
with the csharp-ci snippet — add the missing name: and on: trigger block
so copy-paste users get a complete workflow.
@monsieurleberre monsieurleberre merged commit 3c00116 into dev May 27, 2026
1 check passed
@monsieurleberre monsieurleberre deleted the feat/jvm-helper-ci branch May 27, 2026 08:14
monsieurleberre added a commit that referenced this pull request May 27, 2026
Brings terraform-ci.yaml onto the same shape as csharp-ci (PR #1),
scala-ci (PR #2), and go-ci (PR #3): a visible H2 heading is prepended
to the rendered test-summary markdown before the sticky-comment step
picks it up, so a reader can tell which workspace each sticky comment
covers at a glance when multiple sticky comments coexist on the same
PR.

The input name, env-var name, step name, and description wording mirror
csharp-ci / scala-ci / go-ci verbatim — coverage-title / COVERAGE_TITLE
/ "Prepend coverage title" — for cross-workflow consistency. The
default is 'Terraform coverage'.

The new "Prepend coverage title" step runs immediately after "Build
test summary", gates on the same condition the surrounding test-summary
chain uses (always() && steps.tests.outputs.ran == 'true'), and
loud-fails (::error:: + exit 1) if test-summary.md is missing —
mirroring the pattern landed in csharp-ci / scala-ci / go-ci.

coverage-title flows into the shell via env: indirection, not direct
${{ }} interpolation in run:.
monsieurleberre added a commit that referenced this pull request May 27, 2026
…ng (#4)

Brings terraform-ci.yaml onto the same shape as csharp-ci (PR #1),
scala-ci (PR #2), and go-ci (PR #3): a visible H2 heading is prepended
to the rendered test-summary markdown before the sticky-comment step
picks it up, so a reader can tell which workspace each sticky comment
covers at a glance when multiple sticky comments coexist on the same
PR.

The input name, env-var name, step name, and description wording mirror
csharp-ci / scala-ci / go-ci verbatim — coverage-title / COVERAGE_TITLE
/ "Prepend coverage title" — for cross-workflow consistency. The
default is 'Terraform coverage'.

The new "Prepend coverage title" step runs immediately after "Build
test summary", gates on the same condition the surrounding test-summary
chain uses (always() && steps.tests.outputs.ran == 'true'), and
loud-fails (::error:: + exit 1) if test-summary.md is missing —
mirroring the pattern landed in csharp-ci / scala-ci / go-ci.

coverage-title flows into the shell via env: indirection, not direct
${{ }} interpolation in run:.
@monsieurleberre monsieurleberre mentioned this pull request May 27, 2026
6 tasks
monsieurleberre added a commit that referenced this pull request May 27, 2026
Promote four merged feature PRs into a tagged 1.1.0 section:

- #2 scala-ci.yaml — new reusable sbt/Scala workflow
- #1 csharp-ci.yaml — migrated to xUnit v3 + Microsoft.Testing.Platform
- #3 go-ci.yaml — new coverage-title input
- #4 terraform-ci.yaml — new coverage-title input

Tagging (v1.1.0 + floating v1) follows on the merge commit per
CONTRIBUTING.md.
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