From 720d3edfe3501dc2e7aa10a504526906996ff469 Mon Sep 17 00:00:00 2001 From: Slendi Date: Thu, 2 Jul 2026 15:22:56 +0300 Subject: [PATCH] Add formatting checks for PRs Signed-off-by: Slendi --- .github/workflows/format.yml | 24 ++++++++++++++++++++++++ flake.nix | 1 + 2 files changed, 25 insertions(+) create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..4a7f11e --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,24 @@ +name: Format checks + +on: + pull_request: + branches: + - master + +jobs: + format: + name: Format + runs-on: ubuntu-22.04 + permissions: + contents: read + steps: + - name: git checkout + uses: actions/checkout@v4 + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + - name: Check clang-format + run: | + nix develop -c sh -lc 'git ls-files "*.cpp" "*.hpp" "*.cppm" | xargs clang-format --dry-run --Werror' + - name: Check cmake-format + run: | + nix develop -c sh -lc 'cmake-format --check CMakeLists.txt src/modules/CMakeLists.txt cmake/smathConfig.cmake.in' diff --git a/flake.nix b/flake.nix index 36a9ecb..fa664fd 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,7 @@ devShells.default = pkgs.mkShell { packages = with pkgs; [ cmake + cmake-format ninja clang-tools lldb