Skip to content

Add an alternative Precommit workflow#7334

Open
Growl1234 wants to merge 4 commits into
deepmodeling:developfrom
Growl1234:make-pretty
Open

Add an alternative Precommit workflow#7334
Growl1234 wants to merge 4 commits into
deepmodeling:developfrom
Growl1234:make-pretty

Conversation

@Growl1234
Copy link
Copy Markdown

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.

Copilot AI review requested due to automatic review settings May 12, 2026 09:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Precommit GitHub 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.

Comment thread tools/precommit/start_local_server.sh
Comment thread tools/precommit/format_makefile.py Outdated
Comment thread tools/precommit/format_makefile.py Outdated
Comment thread tools/precommit/format_makefile.py Outdated
Comment thread .github/workflows/precommit.yml
Comment thread tools/precommit/precommit_server.py
Comment thread tools/precommit/precommit_server.py Outdated
Comment thread tools/precommit/precommit.py
Comment thread tools/precommit/precommit.py
Growl1234 and others added 4 commits May 12, 2026 20:51
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Reduce wait time for precommit server readiness check.
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