Add an alternative Precommit workflow#7334
Open
Growl1234 wants to merge 4 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a project-owned, CP2K-inspired precommit system for ABACUS, including a Python driver (tools/precommit/precommit.py) and a containerized Flask/gunicorn “precommit server” used to run external formatters in a controlled environment. It also introduces a GitHub Actions workflow to run these checks on pull requests, and refactors the existing test workflow to better surface grouped test failures.
Changes:
- Added a self-contained precommit driver plus convention checks and supporting scripts under
tools/precommit/. - Added a containerized precommit server (Dockerfile + server app) and local/CI startup tooling.
- Added a new
PrecommitGitHub Actions workflow and improved test workflow failure reporting via a ctest wrapper.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/precommit/start_local_server.sh | Starts a local precommit server container (currently Podman-based). |
| tools/precommit/requirements.txt | Python dependencies for the precommit server/tooling container. |
| tools/precommit/README.md | Usage docs for installing the git hook and running the server/driver. |
| tools/precommit/precommit.py | Precommit driver: file discovery, caching, remote formatting, local checks. |
| tools/precommit/precommit_server.py | Flask server endpoints that run formatters inside the container. |
| tools/precommit/install_requirements.sh | Installs OS + Python tooling inside the container image. |
| tools/precommit/format_makefile.py | Local Makefile formatter helper. |
| tools/precommit/Dockerfile | Container image definition for the precommit server. |
| tools/precommit/deploy.sh | Script to build/push/deploy the server image (Cloud Run-oriented). |
| tools/precommit/cloudbuild.yaml | Cloud Build recipe to build/push/deploy the server image. |
| tools/precommit/clang_format_wrapper.sh | Wrapper to run clang-format with a project style file and split workaround. |
| tools/precommit/check_file_properties.py | Local ABACUS-specific convention checks (encoding, flags, header rules, etc.). |
| tools/precommit/abacus_clang_format.yaml | Project clang-format style configuration. |
| .github/workflows/test.yml | Improves CI test reporting by wrapping ctest invocations and aggregating failures. |
| .github/workflows/precommit.yml | New CI workflow that spins up the local precommit server and runs the driver. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Reduce wait time for precommit server readiness check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a self-contained precommit driver for ABACUS, replacing the previous workflow that relied on GitHub Action built-in/pre-commit style drivers.
The new implementation is inspired by the precommit infrastructure used in CP2K. It provides a project-owned driver under
tools/precommit/precommit.py, together with a local precommit server for running external formatting/checking tools in a controlled environment (it would be best if a remote server is configured).The driver performs strict formatting and file-property checks for files tracked by Git, covering most file types used in the repository. By default, it runs in check-only mode and reports formatting differences without modifying files. When invoked with
--allow-modifications, it can automatically fix part of the formatting issues, such as indentation and style inconsistencies.