Skip to content

Add pre-commit CI checks and skills-signature validation#137

Merged
hannahli-nv merged 5 commits into
mainfrom
add-pre-commit-hooks
Jun 9, 2026
Merged

Add pre-commit CI checks and skills-signature validation#137
hannahli-nv merged 5 commits into
mainfrom
add-pre-commit-hooks

Conversation

@hannahli-nv

@hannahli-nv hannahli-nv commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds pre-commit hooks and two new CI jobs to catch formatting issues and stale skill signatures automatically.

What's included

  • .pre-commit-config.yaml — hooks:

    • trailing-whitespace, end-of-file-fixer (all text files, excluding .sig and .patch)
    • check-yaml, check-json, pretty-format-json (--indent=2)
    • check-added-large-files
    • ruff-check (--fix) and ruff-format (Python only), pinned to ruff 0.14.9
    • evals/evals.json excluded from pretty-format-json to preserve canonical key ordering and literal non-ASCII characters (e.g. em-dashes)
    • *.sig files excluded from all modifying hooks (NVSkills signature artifacts)
  • pre-commit job (in tilegym-ci-infra-tests.yml) — runs the hooks on files changed by each PR. Ruff is skipped here (SKIP=ruff-check,ruff-format) since python-formatting already handles ruff for the whole repo.

  • check-skills-signatures job (in tilegym-ci-infra-tests.yml) — fails if skills/ content is modified without a subsequent /nvskills-ci run. Backed by .github/scripts/check_skills_signatures.py, which compares the timestamp of the latest non-.sig skills commit against the latest bot commit whose message starts with the configured signature title.

  • format.sh — run bash format.sh locally to install and apply all hooks in one step before pushing.

Why

ruff only covers Python. Markdown, YAML, and JSON files had no automated gate, allowing trailing whitespace, missing final newlines, or malformed JSON to slip in. The pre-commit hooks close that gap.

The check-skills-signatures job prevents PRs from merging with stale skill signatures — a common mistake when skill content is updated but /nvskills-ci is forgotten.

CI Configuration

config:
  build: true
  # valid options are "ops" and "benchmark"
  test: []

@copy-pr-bot

copy-pr-bot Bot commented Jun 2, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@hannahli-nv hannahli-nv force-pushed the add-pre-commit-hooks branch from 87851b7 to 49655a1 Compare June 8, 2026 14:39
@hannahli-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test f1ae611

@hannahli-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test 7a01e7c

@hannahli-nv hannahli-nv force-pushed the add-pre-commit-hooks branch from 7a01e7c to 30a3119 Compare June 8, 2026 23:47
@hannahli-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test 30a3119

@hannahli-nv hannahli-nv force-pushed the add-pre-commit-hooks branch from 30a3119 to e19b1bd Compare June 9, 2026 00:09
@hannahli-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test e19b1bd

@hannahli-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test b7cc082

@hannahli-nv hannahli-nv force-pushed the add-pre-commit-hooks branch from b7cc082 to e19b1bd Compare June 9, 2026 00:23
@hannahli-nv hannahli-nv changed the title Add pre-commit hooks and run them from format.sh Add pre-commit CI checks and skills-signature validation Jun 9, 2026
@hannahli-nv hannahli-nv requested a review from xjmxyt June 9, 2026 00:28
Add .pre-commit-config.yaml with trailing-whitespace, end-of-file,
YAML/JSON validation, JSON pretty-format, and ruff lint/format checks.

Add a CI job in tilegym-ci-infra-tests.yml that runs pre-commit on the
files changed by each pull request.
- Remove standalone pre-commit.yml; merge pre-commit job into
  tilegym-ci-infra-tests.yml alongside python-formatting and spdx-headers-check.
- Add check-skills-signatures job backed by check_skills_signatures.py.
  Fails if skills/ content is modified without a subsequent /nvskills-ci run.
- Update .pre-commit-config.yaml: remove skills/ exclusions, exclude
  evals/evals.json from pretty-format-json to preserve key order and
  literal non-ASCII characters (e.g. em-dashes).
Exclude *.sig files from whitespace and JSON-format hooks to avoid
modifying NVSkills signature artifacts. Drop --no-sort-keys (redundant
since evals.json is already excluded from pretty-format-json).
Set SKIP=ruff-check,ruff-format in the pre-commit CI job so ruff is
handled exclusively by the python-formatting job (whole-repo scan),
avoiding duplicate ruff runs on changed files.

Add an if: failure() hint step to python-formatting and pre-commit
jobs suggesting users run 'bash format.sh' to fix issues locally.
@hannahli-nv hannahli-nv force-pushed the add-pre-commit-hooks branch from e19b1bd to 21472a6 Compare June 9, 2026 02:38
@hannahli-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test 21472a6

@hannahli-nv hannahli-nv merged commit cedd34d into main Jun 9, 2026
21 checks passed
@hannahli-nv hannahli-nv deleted the add-pre-commit-hooks branch June 9, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants