Files
floci/.github/workflows/checkstyle.yml
T
Matheus André 33052fa101 ci: run required checks on merge queue entries (#7064)
Add a merge_group trigger to ci, checkstyle, docs-actions and
partition-literals so a merge queue can gate main on them.

Refs #5085
2026-11-02 10:27:34 -04:00

65 lines
2.0 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'
# Runs each merge queue entry against main plus the PRs queued ahead of it. paths does not
# apply to merge_group, so a queued PR is always checked.
merge_group:
types: [checks_requested]
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@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
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
- name: Test that each suppression matches exactly one file
run: python3 tools/checkstyle/test_suppressions.py