Skip to content

ci: add prek commit hooks - #1578

Open
assignUser wants to merge 9 commits into
NVIDIA:mainfrom
assignUser:ci/add-prek-hooks
Open

assignUser wants to merge 9 commits into
NVIDIA:mainfrom
assignUser:ci/add-prek-hooks

Conversation

@assignUser

@assignUser assignUser commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #1571

This PR adds prek as a pre-commit framework. You can easily install prek from pypi via uv tool install prek but it's also available through nix, conda, brew etc..

preks api is largely a drop in for pre-commit, so if you know how to run that you can re-use those commands but prek has the advantage of workspaces which make it easier to handle component specific checks, like in this repo.

I have moved the big check mentioned in CONTRIBUTING.md:

  • Header checks
  • formatting, replacing cargo oxide fmt with separate, file gated cargo fmt invocations matching the fmt.yml CI. If IUC this means the fmt part of cargo-oxide can be dropped as prek can cover the different workspaces with the right toolchain. So it should now run much faster and not block commits for 23 seconds for each commit.
  • branch name
  • clippy
  • sign-off (this is only run pre-push to avoid dropping commit messages)
  • dependency inventory (only when the files themselves change, the full check in CI still remains)
  • a number of basic file checks like trailing whitespace etc. I have excluded generated files from these.

I have not yet replaced the existing CI jobs with the relevant prek commands (i.e. fmt etc.) but that is of course a big advantage, same command in CI as locally. There additional hooks we can run, e.g. linting of Actions Workflows, toml formatting etc.. But this should be a good baseline.

Checklist

  • All commits signed off (git commit -s)
  • SPDX headers on new source files

Signed-off-by: Jacob Wujciak-Jens <[email protected]>
Signed-off-by: Jacob Wujciak-Jens <[email protected]>
Signed-off-by: Jacob Wujciak-Jens <[email protected]>
Signed-off-by: Jacob Wujciak-Jens <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Oct 20, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

It runs over the whole repo, passing files just runs it multiple times.

Signed-off-by: Jacob Wujciak-Jens <[email protected]>
Signed-off-by: Jacob Wujciak-Jens <[email protected]>
remove superflous comments etc.

Signed-off-by: Jacob Wujciak-Jens <[email protected]>
@assignUser
assignUser marked this pull request as ready for review October 23, 2026 12:09

This branch has not been deployed

No deployments
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.

ci: Add commit hooks

1 participant