Skip to content

ci: add scala-build prebuild job to share compilation across Scala CI jobs#6317

Draft
Yicong-Huang wants to merge 1 commit into
apache:mainfrom
Yicong-Huang:ci/scala-prebuild-job
Draft

ci: add scala-build prebuild job to share compilation across Scala CI jobs#6317
Yicong-Huang wants to merge 1 commit into
apache:mainfrom
Yicong-Huang:ci/scala-prebuild-job

Conversation

@Yicong-Huang

@Yicong-Huang Yicong-Huang commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

The four sbt-based CI jobs — amber, amber-integration, platform, and platform-integration — each compile the shared common-module graph (DAO, WorkflowCore, WorkflowOperator, Auth, Config, …) from scratch. That is up to 14 runner legs redoing the same Scala build every run.

This adds a single scala-build prebuild job that compiles the whole Scala world once and hands the result to the downstream jobs as artifacts.

scala-build (ubuntu, one leg) runs one sbt invocation:

  • scalafmtCheckAll + scalafixAll --check (cross-cutting lints, moved here from amber / amber-integration)
  • all 7 <svc>/dist
  • root Test/compile (compiles every module's test scope; TexeraProject aggregates all modules)

…then uploads two artifacts:

  • scala-build-target — per-module target/ tree (classes, test-classes, Zinc analysis, generated JOOQ sources, dists). Restored by amber / amber-integration (Linux) / platform so their jacoco/test reuse compilation.
  • scala-dists — just the dist zips, for platform-integration's smoke-boot.

Downstream jobs drop their own lint + compile and consume the artifacts.

Respecting the label gate: scala-build.if is the union of the four Scala run_* inputs, so a docs-only / frontend-only PR never runs it and every downstream Scala job stays skipped in lockstep. The required-checks aggregator depends on the whole build reusable-workflow result, so the new job is transparent to the merge gate (no .asf.yaml change). Artifact names are computed per build.yml invocation (from job_name_suffix / backport_target_branch) so the main build and the backport legs — which share one workflow run — don't collide on upload.

Known caveats / follow-ups:

  • macOS amber-integration still self-compiles (Zinc analysis is not OS-portable). Because needs: is per-job, the macOS leg now waits for scala-build before starting; if the measured hit is large, split it into an independent job with no needs:.
  • Zinc cross-job reuse relies on github.workspace being a stable path across GitHub-hosted ubuntu runners; if the analysis is ever rejected, sbt just recompiles — slower, never wrong.
  • The 6-leg platform matrix each downloads scala-build-target; if download time dominates, slim the tar or split per service.

Primary goal is deduplicating compilation / cutting runner-minutes, not necessarily wall-clock — a serial prebuild + artifact transfer is inserted before the fan-out. Opened as draft to gather real numbers (wall-clock and total runner-minutes vs. a baseline) before committing to the approach.

Any related issues, documentation, discussions?

Closes #6318

How was this PR tested?

This is a CI-only change, validated by the workflow run on this PR itself:

  • Confirm scala-build runs (the PR carries the ci label, which selects every stack) and the four downstream Scala jobs succeed off the restored artifacts.
  • Confirm from the downstream sbt logs that jacoco/test do not trigger a full recompile (Zinc reuse working).
  • Confirm the binary LICENSE/NOTICE checks in amber / platform and the platform-integration smoke-boot run off the restored dists.
  • Locally: actionlint passes on .github/workflows/build.yml (no new findings); YAML parses clean.

build.yml is a reusable workflow with no unit-test harness, so correctness is verified end-to-end by the run rather than by added tests.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 4.8)

… jobs

The four sbt-based jobs (amber, amber-integration, platform,
platform-integration) each compiled the shared common-module graph (DAO,
WorkflowCore, WorkflowOperator, ...) from scratch — up to 14 runner legs
redoing the same Scala build.

Add a single `scala-build` prebuild job that compiles every module once
(main + test scopes), runs the cross-cutting scalafmt/scalafix lints, builds
all seven dists, and uploads two artifacts:

  * scala-build-target — per-module target/ tree (classes, test-classes, Zinc
    analysis, generated JOOQ sources, dists), restored by amber /
    amber-integration (Linux) / platform so their jacoco/test reuse
    compilation instead of redoing it.
  * scala-dists — just the dist zips, for platform-integration's smoke-boot.

Downstream Scala jobs drop their own lint + compile and consume the artifacts.
The prebuild is gated on the union of the four Scala run_* inputs, so a
docs-only / frontend-only PR never runs it and every downstream Scala job
stays skipped in lockstep. Artifact names are computed per build.yml
invocation so the main build and backport legs don't collide in one run.

macOS amber-integration keeps self-compiling — Zinc analysis embeds
OS-specific absolute paths and is not portable across runners.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com>
@github-actions github-actions Bot added the ci changes related to CI label Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @mengw15
    You can notify them by mentioning @mengw15 in a comment.

@codecov-commenter

codecov-commenter commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.98%. Comparing base (0e92b16) to head (6fcf3e7).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6317      +/-   ##
============================================
- Coverage     61.02%   60.98%   -0.04%     
+ Complexity     3374     3373       -1     
============================================
  Files          1140     1140              
  Lines         44923    44923              
  Branches       4942     4942              
============================================
- Hits          27413    27396      -17     
- Misses        16001    16015      +14     
- Partials       1509     1512       +3     
Flag Coverage Δ
access-control-service 70.00% <ø> (ø)
agent-service 44.59% <ø> (ø)
amber 66.39% <ø> (-0.01%) ⬇️
computing-unit-managing-service 0.00% <ø> (ø)
config-service 52.30% <ø> (ø)
file-service 63.97% <ø> (ø)
frontend 53.25% <ø> (-0.08%) ⬇️
notebook-migration-service 78.94% <ø> (ø)
pyamber 91.18% <ø> (ø)
workflow-compiling-service 55.14% <ø> (ø)

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

✅ No material benchmark regressions detected

🟢 4 better · 🔴 0 worse · ⚪ 11 noise (<±5%) · 0 without baseline

Compared against main 0e92b16 benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🟢 bs=10 sw=10 sl=64 398 0.243 24,395/34,262/34,262 us 🟢 -11.0% / 🔴 +131.6%
🟢 bs=100 sw=10 sl=64 804 0.49 125,193/139,886/139,886 us 🟢 -9.4% / 🔴 +35.6%
bs=1000 sw=10 sl=64 917 0.559 1,091,267/1,140,823/1,140,823 us ⚪ within ±5% / 🔴 +15.0%
Baseline details

Latest main 0e92b16 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 398 tuples/sec 405 tuples/sec 814.14 tuples/sec -1.7% -51.1%
bs=10 sw=10 sl=64 MB/s 0.243 MB/s 0.247 MB/s 0.497 MB/s -1.6% -51.1%
bs=10 sw=10 sl=64 p50 24,395 us 24,095 us 12,120 us +1.2% +101.3%
bs=10 sw=10 sl=64 p95 34,262 us 38,490 us 14,792 us -11.0% +131.6%
bs=10 sw=10 sl=64 p99 34,262 us 38,490 us 18,232 us -11.0% +87.9%
bs=100 sw=10 sl=64 throughput 804 tuples/sec 804 tuples/sec 1,050 tuples/sec 0.0% -23.4%
bs=100 sw=10 sl=64 MB/s 0.49 MB/s 0.49 MB/s 0.641 MB/s 0.0% -23.5%
bs=100 sw=10 sl=64 p50 125,193 us 119,830 us 96,227 us +4.5% +30.1%
bs=100 sw=10 sl=64 p95 139,886 us 154,436 us 103,174 us -9.4% +35.6%
bs=100 sw=10 sl=64 p99 139,886 us 154,436 us 111,033 us -9.4% +26.0%
bs=1000 sw=10 sl=64 throughput 917 tuples/sec 915 tuples/sec 1,072 tuples/sec +0.2% -14.5%
bs=1000 sw=10 sl=64 MB/s 0.559 MB/s 0.559 MB/s 0.655 MB/s 0.0% -14.6%
bs=1000 sw=10 sl=64 p50 1,091,267 us 1,089,462 us 950,645 us +0.2% +14.8%
bs=1000 sw=10 sl=64 p95 1,140,823 us 1,154,337 us 991,936 us -1.2% +15.0%
bs=1000 sw=10 sl=64 p99 1,140,823 us 1,154,337 us 1,022,498 us -1.2% +11.6%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,503.02,200,128000,398,0.243,24395.19,34262.23,34262.23
1,100,10,64,20,2489.07,2000,1280000,804,0.490,125192.50,139885.58,139885.58
2,1000,10,64,20,21820.36,20000,12800000,917,0.559,1091267.15,1140822.68,1140822.68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci changes related to CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: deduplicate Scala compilation across CI jobs via a prebuild + artifact handoff

2 participants