Skip to content

Commit 9a07c5a

Browse files
committed
🌱 Add pre-commit config and CI integration
Add standardized pre-commit hooks based on the canonical config from llm-d/llm-d-infra: - File hygiene (trailing whitespace, EOF, yaml/json checks, large files) - Shell script linting (shellcheck) - Dockerfile linting (hadolint) - Markdown linting (markdownlint) - YAML linting (yamllint) Also adds pre-commit/action step to ci-pr-checks.yaml so pre-commit runs automatically on PRs. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Andrew Anderson <andy@clubanderson.com>
1 parent 4e36e94 commit 9a07c5a

File tree

2 files changed

+67
-2
lines changed

2 files changed

+67
-2
lines changed

‎.github/workflows/ci-pr-checks.yaml‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@ jobs:
4040
- name: Checkout source
4141
uses: actions/checkout@v6
4242

43-
- name: Sanity check repo contents
44-
run: ls -la
43+
- name: Set up Python (for pre-commit and CGO)
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: '3.12'
47+
48+
- name: Run pre-commit checks
49+
uses: pre-commit/action@v3.0.1
4550

4651
- name: Extract Go version from go.mod
4752
run: sed -En 's/^go (.*)$/GO_VERSION=\1/p' go.mod >> $GITHUB_ENV

‎.pre-commit-config.yaml‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Pre-commit configuration for llm-d-inference-scheduler
2+
# Based on canonical config from llm-d/llm-d-infra
3+
#
4+
# Install: pip install pre-commit && pre-commit install
5+
# Run all: pre-commit run --all-files
6+
7+
repos:
8+
# General file hygiene hooks
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v6.0.0
11+
hooks:
12+
- id: trailing-whitespace
13+
- id: end-of-file-fixer
14+
- id: check-yaml
15+
args: [--unsafe] # allows custom YAML tags used in k8s
16+
- id: check-json
17+
- id: check-added-large-files
18+
args: [--maxkb=1000]
19+
- id: check-merge-conflict
20+
- id: mixed-line-ending
21+
- id: check-case-conflict
22+
23+
# Shell script linting (requires shellcheck installed)
24+
- repo: local
25+
hooks:
26+
- id: shellcheck
27+
name: shellcheck
28+
language: system
29+
entry: shellcheck
30+
args: [-x, --severity=warning]
31+
types: [shell]
32+
33+
# Dockerfile linting (requires hadolint installed)
34+
- repo: local
35+
hooks:
36+
- id: hadolint-docker
37+
name: hadolint
38+
language: system
39+
entry: hadolint
40+
args: [--failure-threshold, error]
41+
files: Dockerfile.*
42+
types: [file]
43+
44+
# Markdown linting
45+
- repo: https://github.com/igorshubovych/markdownlint-cli
46+
rev: v0.47.0
47+
hooks:
48+
- id: markdownlint
49+
args: [--fix]
50+
51+
# YAML linting
52+
- repo: https://github.com/adrienverge/yamllint
53+
rev: v1.37.1
54+
hooks:
55+
- id: yamllint
56+
args:
57+
- -d
58+
- >-
59+
{extends: default, rules: {line-length: {max: 250},
60+
document-start: disable, truthy: {check-keys: false}}}

0 commit comments

Comments
 (0)