Skip to content

Skip non-relevant CI stacks based on changed file paths #4621

@Yicong-Huang

Description

@Yicong-Huang

Task Summary

Skip irrelevant CI stacks in the Build workflow based on the PR's changed file paths, so a PR that only touches one stack does not block on every other stack.

Pain points today

The Build workflow runs the full matrix on every PR, regardless of what changed:

  • frontend × 3 OS (ubuntu / windows / macos)
  • scala (ubuntu-22.04, JDK 11) — sbt build + tests, ~10–15 min
  • python × 4 versions (3.10 / 3.11 / 3.12 / 3.13)
  • agent-service × 2 OS (ubuntu / macos)
  • backport matrix per release/* label, each running the full reusable build

Concrete consequences:

  • A docs-only PR (docs/**, *.md) waits for sbt and pip just to be told "nothing changed".
  • A pure frontend PR pays the scala / python tax even though no Scala or Python file moved.
  • Backport matrix multiplies all of the above per release target — a 1-line frontend tweak with release/v1.1.0-incubating triggers a second full sbt build on the release branch checkout.
  • Required checks listed in .asf.yaml for release/* and main are statically named (e.g. frontend (ubuntu-latest, 18), scala (ubuntu-22.04, 11)), so simply gating jobs on if: would leave them as skipped and require coordination with Add a Required Checks aggregator job to consolidate CI status checks #4599 (Required Checks aggregator) so branch protection still passes.

The Build workflow's precheck job already exposes placeholder outputs run_frontend / run_scala / run_python / run_agent_service for exactly this purpose; today they are all hard-coded to true.

Proposal

Implement file-path detection in precheck, with the same rule set as .github/labeler.yml (single source of truth), to drive the existing run_* outputs:

  • frontend → frontend/**
  • scala → amber/** minus the python subtree, plus **/*.scala, **/build.sbt, **/project.sbt
  • python → amber/src/main/python/**, **/*.py, **/requirements.txt
  • agent-service → agent-service/**

push events on main / release/* / ci-enable/** keep running everything (no PR file list available, default to all true). Only pull_request events apply the gating.

Once required checks are aggregator-based (#4599), skipped stacks become non-blocking and the optimization is end-to-end.

Prior attempt

PR #3642 "chore(ci): skip non-relevant CIs" tried this in 2025-08 using dorny/paths-filter@v3 for the python subset only, sat open for 9 months, and was closed without merge on 2026-05-01. This task picks up the idea against the current precheck-centric Build workflow and broadens it to all four stacks.

Priority

P2 – Medium

Task Type

  • Code Implementation
  • DevOps / Deployment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions