jdaugherty opened a new pull request, #16673:
URL: https://github.com/apache/grails-core/pull/16673

   ## Summary
   
   GitHub Actions usage on this repository is far above what the review process 
needs, so this change makes
   every workflow decide, in one place, whether it runs at all and whether its 
test jobs run.
   
   **Pull requests**
   
   - A **draft** pull request runs no workflow unless it carries the **`run 
ci`** label. Marking it ready for review
     starts CI (every `pull_request` trigger now lists `ready_for_review`, 
which is not a default type).
   - A pull request labelled **`no ci`** runs no workflow at all, draft or not.
   - Labels are read when a run starts: add `run ci` (or remove `no ci`) and 
push, or mark the draft ready, to get a run.
     `labeled` is deliberately not a trigger, because the Release Drafter 
autolabeler would start runs on every new
     pull request that cancel the real one through the concurrency group.
   
   **Tests**
   
   - A new reusable workflow, `.github/workflows/ci-policy.yml`, is the first 
job (`policy`) of every workflow that
     runs tests; test jobs and the test steps of the build jobs are gated on 
its `run-tests` output.
   - On the **default branch and the release branches above it** the tests run 
unless the head commit message starts
     with `[skip tests]` (unchanged intent).
   - On a **release branch below the default** (7.0.x, 7.2.x while 8.0.x is the 
default) and on a **pull request whose
     base is a side branch** rather than a release branch, the tests run only 
when the head commit message starts with
     `[run tests]`. Otherwise the run builds, and on a push still publishes 
snapshots, exactly like a `[skip tests]`
     commit does today. Dependency validation, code style, build health, RAT 
and CodeQL keep running.
   - The old `contains(github.event.head_commit.message, '[skip tests]')` check 
was empty on `pull_request` events, so
     every pull request ran the tests whatever the message said. The policy 
reads the head commit through the API, so
     the markers now work on pull requests too. The decision and its reason are 
written to the job summary.
   - The marker is matched against the start of the first line, which is how 
every `[skip tests]` commit in the
     history is written.
   
   Documented as rule 14 and the "CI policy" section of AGENTS.md and the 
"Continuous Integration" section of
   CONTRIBUTING.md.
   
   ## Actions usage, week of 2026-10-12 to 2026-10-18
   
   Runner time summed from every job of every workflow run of 
`apache/grails-core` in that week (5,032 runs,
   38,077 executed jobs; the public repository reports no billable minutes, so 
durations come from the jobs API).
   
   | Measure | Value |
   |---|---|
   | Total runner time | **16,968 h** (2,424 h per day, about 101 runners busy 
around the clock) |
   | From `pull_request` events | 14,510 h (85.5%) |
   | From `push` events | 2,431 h (14.3%) |
   | Test jobs | 15,117 h (89%) |
   | Jobs cancelled by a newer push to the same pull request | 1,249 h (7%) |
   | Linux / Windows / macOS | 15,443 h / 1,053 h / 472 h |
   
   By workflow:
   
   | Workflow | Runs | Runner hours | Share |
   |---|---|---|---|
   | CI | 522 | 14,878 h | 87.7% |
   | Groovy Snapshot Canary Build | 247 | 415 h | 2.4% |
   | Build Health | 523 | 355 h | 2.1% |
   | SiteMesh 2 Compatibility | 174 | 333 h | 2.0% |
   | Coverage | 464 | 299 h | 1.8% |
   | Code Style | 523 | 184 h | 1.1% |
   | Code Analysis | 464 | 178 h | 1.0% |
   | End to End | 464 | 154 h | 0.9% |
   | everything else (CodeQL, Groovy joint, JMH, RAT, Release Drafter, Copilot 
review, ...) | | 172 h | 1.0% |
   
   By target branch (the branch pushed to, or the base of the pull request):
   
   | Target | Runner hours | Share | Tests under this change |
   |---|---|---|---|
   | Default branch and above (8.0.x, 8.1.x, 9.0.x, 9.1.x, 10.0.x) | 8,406 h 
(7,481 h tests) | 49.5% | run, unless `[skip tests]` |
   | Side branches, i.e. pull requests into `refactor/java-to-groovy-*` and 
similar | 7,897 h (7,077 h tests) | 46.5% | only with `[run tests]` |
   | Below the default branch (7.0.x, 7.1.x, 7.2.x) | 664 h (559 h tests) | 
3.9% | only with `[run tests]` |
   
   Cost of a single push:
   
   | Event | Pushes | Mean runner hours per push |
   |---|---|---|
   | Push to a pull request (all workflows) | 357 (97 branches) | 41 h (median 
44 h, max 92 h) |
   | Push to 8.0.x / 8.1.x / 9.0.x / 9.1.x | 20 / 14 / 18 / 11 | 33 h / 36 h / 
35 h / 27 h |
   | Push to 7.0.x / 7.1.x / 7.2.x / 10.0.x | 14 / 7 / 8 / 5 | 5 h / 13 h / 14 
h / 11 h |
   
   The ten busiest pull-request branches consumed 4,800 h; the largest single 
pull request (#16237) consumed 1,450 h in
   the week. Pull requests that are drafts right now account for 594 h, but the 
draft state at the time of each run is
   not recorded, so the saving from the draft rule cannot be measured from 
history.
   
   **Expected effect.** Had this policy been active, the test jobs on 
side-branch and 7.x targets (7,636 h, 45% of the
   week) would have run only on commits marked `[run tests]`, and the draft and 
`no ci` rules remove whole runs on
   top of that. The remaining lever is the size of the CI matrix itself (a run 
on a non-draft pull request into 8.x or
   9.x costs about 40 runner-hours), which this change does not touch.
   
   ## Follow-ups
   
   - Create the `no ci` and `run ci` labels in `apache/grails-core` (`gh label 
create 'no ci'`, `gh label create 'run ci'`).
   - On merge-up, 8.0.x and later carry more workflows with the old `[skip 
tests]` check (`coverage.yml`, `end-to-end.yml`,
     `groovy-snapshot-canary.yml`, `sitemesh2.yml`, and 19 occurrences in 
`gradle.yml`): wire them to the `policy` job
     the same way, and add the label-and-draft `if` to the non-test workflows 
(`benchmark.yml`, `codeanalysis.yml`,
     `validate-actions.yml`).
   
   ## Verification
   
   - The workflow YAML was parsed and structure-checked (every `needs`, `uses` 
and `needs.policy.outputs` reference
     resolves); the policy script was run locally for pushes to 7.0.x, 7.2.x, 
8.0.x, 8.1.x, 10.0.x and a side branch,
     with and without each marker, and for a pull request and a dispatch, 
including a fork pull request's head commit
     read through the API.
   - This pull request runs under its own workflows. Its head commit starts 
with `[run tests]`, so the full matrix runs
     once here and exercises the test-path wiring; without the marker a pull 
request into 7.0.x gets the build-only run.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to