ci: run heavy CI jobs on PRs only when opted in via label

Open
#11,423 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
github-actions, go
Domain
ci-cd, devops

Research direction

Read .github/workflows/main.yml, especially ci-gate, its heavy matrix jobs, and the existing label lookup in .github/actions/check-label. First confirm the prerequisite merge queue is required on master, then check the workflow’s pull_request.types and event handling. Done means the fast subset and label-gated heavy jobs match the proposed behavior, with full CI still running for merge_group and nightly schedules; the label name and several policy questions remain open.

Written by the indexing model from the issue text.

Description

CI enhancement

Every push to every open PR currently runs the full CI workflow. One full run is ~16.6 runner-hours (unit matrix, itest tranches, windows itest, cross-compilation). Most of those runs happen while a PR is still iterating and nobody is reading the results yet.

Proposal: new PRs get only a fast subset of CI by default. The heavy jobs run once a maintainer or the author opts in with a label.

Why a label

GitHub's built-in skip ([skip ci] and friends) is per commit and driven by the commit message. It can't be toggled per PR or by a reviewer, so the switch has to live in main.yml.

Proposed behavior
PR state Jobs
Draft, or ready without run-ci Fast subset. This is what drafts already run today: static checks, lint, commit checks, release notes, dependency pins, non-race unit tests and basic itests. Skipped: cross-compilation, unit-race, full/windows/macOS itests, backwards-compat.
Ready for review and labeled run-ci Full workflow
merge_group Full workflow, always (labels aren't visible here)
Nightly schedule on master Full workflow

The label name is TBD. An alternative is the inverse, a skip-heavy-ci label on top of a full-by-default policy. That saves less, but it's less surprising for contributors.

Implementation sketch

Most of the plumbing exists:

  • ci-gate already computes a docs-only output that heavy jobs consume. Extend it, or add a sibling output (heavy), to cover "PR event, not draft, and has run-ci". Use the live label lookup that .github/actions/check-label already does, so a re-run picks up a label added after the run started.
  • Heavy matrix jobs must keep the matrix instantiated and skip at the step level, as they do for docs-only today. Otherwise the per-leg required check names are never reported.
  • Add labeled (and probably unlabeled) to pull_request.types, so applying the label starts a run. The existing concurrency group cancels the stale run.
  • Non-PR events (merge_group, schedule, workflow_dispatch) always set heavy=true.
Hard prerequisite: required merge queue

Skipped required checks count as passing. Without a required merge queue, this label would effectively let a PR merge without the heavy CI ever running. This must only land after the merge queue is required on master; see the discussion on #11421. With the queue required, merge_group runs ignore PR labels and stay the real gate. The label then only controls how much pre-queue feedback a PR gets.

Open questions
  • Who may apply the label? Labels need triage permission, so external contributors depend on a maintainer, which is probably what we want for cost. Should the author be able to request it via a comment command?
  • Should the label persist across pushes (simplest), or be removed on synchronize so each heavy run is a deliberate request?
  • Are any fast-subset jobs worth promoting to heavy, or the reverse (e.g. unit-race)?
Dominant language
Go
Stars
8.2k
Forks
2.3k
Avg merge
1d 11h
Merged PRs (30d)
103

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lightningnetwork/lnd

All issues in lightningnetwork/lnd

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.