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