Files
floci/.github/workflows/checkstyle.yml
T
Hector Ventura 379086f818 ci: let a running main CI run finish instead of cancelling it (#5396)
* ci: let a running main CI run finish instead of cancelling it

A CI run takes about 18 minutes and merges often land closer together
than that, so cancel-in-progress on refs/heads/main stopped runs partway
through: from 2026-10-05 to 2026-10-09, 77 of 138 CI runs on main were
cancelled, leaving most main commits without a result and a break
pointing at the wrong commit.

Cancel only on pull requests. On main the concurrency group still holds
one pending run that a newer merge replaces before it starts, so a burst
of merges is tested once, at its newest commit, and no run stops halfway.

Refs #5085

* ci: stop cancelling main runs in the other workflows that run on pushes to main

Checkstyle, Docs in sync and Partition Literals run on pull requests and
on pushes to main, so they get the same rule as ci.yml: cancel a superseded
run only on pull requests. The docs deploy never runs on pull requests, so
it stops cancelling altogether.

The remaining workflows named in #5085 (compatibility, compat-partitions,
iam-namespace-drift, nightly) have no push trigger, so a merge to main
never cancels them and they are left as they are.

Refs #5085

* ci: state the measured cancellation figures in the ci.yml comment

The comment quoted one-day figures (30 of 47 runs, a 13 minute median gap, 546 runner-minutes) that the run history does not reproduce. Replace them with the count measured from it: 77 of 138 CI runs on main cancelled from 2026-10-05 to 2026-10-09.

Refs #5085

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-11 00:06:59 -05:00

58 lines
1.7 KiB
YAML

name: Checkstyle
# Runs tools/checkstyle/checkstyle.xml over src and compatibility-tests/sdk-test-java.
# Kept out of the Maven build lifecycle because parsing the whole tree takes about 30s.
on:
pull_request:
paths:
- 'src/**/*.java'
- 'compatibility-tests/sdk-test-java/src/**/*.java'
- 'tools/checkstyle/**'
- 'pom.xml'
- '.github/workflows/checkstyle.yml'
push:
branches:
- main
paths:
- 'src/**/*.java'
- 'compatibility-tests/sdk-test-java/src/**/*.java'
- 'tools/checkstyle/**'
- 'pom.xml'
- '.github/workflows/checkstyle.yml'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Cancel a superseded run only on pull requests; a run on main is left to finish (see ci.yml).
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
checkstyle:
name: Checkstyle
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
java-version: '25'
distribution: 'temurin'
# Restore only. CI shard 1 owns saving this cache.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('pom.xml') }}
restore-keys: |
maven-${{ runner.os }}-
- name: Run Checkstyle
run: ./mvnw -B checkstyle:check
- name: Test import-order rules
run: python3 tools/checkstyle/test_import_order.py