From 0b3060eacdf441bbac5447169bbed8fecc0bc9cd Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:49:56 +0000 Subject: [PATCH 1/3] This commit updates the CMake formatting workflows to use `gersemi` instead of `cmake-format`. The following changes have been made: - A new `.gersemirc` configuration file has been added. - The `cmake-format-check.yaml` workflow has been updated to use `gersemi --check`. - The `cmake-format-fix.yaml` workflow has been updated to use `gersemi --in-place`. The new implementation simplifies the workflow scripts by removing the need for a manual file search, relying instead on `gersemi`'s built-in directory traversal. --- .gersemirc | 4 ++++ .github/workflows/cmake-format-check.yaml | 28 ++++------------------- .github/workflows/cmake-format-fix.yaml | 20 +++------------- 3 files changed, 12 insertions(+), 40 deletions(-) create mode 100644 .gersemirc diff --git a/.gersemirc b/.gersemirc new file mode 100644 index 00000000..88c0e857 --- /dev/null +++ b/.gersemirc @@ -0,0 +1,4 @@ +# gersemi is an opinionated formatter and does not support the same +# level of configuration as cmake-format. The previous settings from +# .cmake-format.json (dangle_align and dangle_parens) are not +# supported and have no direct equivalents. diff --git a/.github/workflows/cmake-format-check.yaml b/.github/workflows/cmake-format-check.yaml index 69fb0fab..998f4f89 100644 --- a/.github/workflows/cmake-format-check.yaml +++ b/.github/workflows/cmake-format-check.yaml @@ -74,33 +74,15 @@ jobs: with: python-version: '3.x' - - name: Install cmake-format - run: pip install cmakelang + - name: Install gersemi + run: pip3 install gersemi - name: Check CMake formatting run: | echo "➡️ Checking CMake file formatting..." - cd phlex-src - - cmake_files=$(find . -type f \( -name "CMakeLists.txt" -o -name "CMakeLists.txt.in" -o -name "*.cmake" -o -name "*.cmake.in" \) ! -path "*/build/*" ! -path "*/_deps/*") - - if [ -z "$cmake_files" ]; then - echo "No CMake files found to check" - exit 0 - fi - - echo "::group::Running cmake-format --check" - format_errors=0 - for file in $cmake_files; do - if ! cmake-format --check "$file"; then - format_errors=$((format_errors + 1)) - fi - done - echo "::endgroup::" - - if [ $format_errors -gt 0 ]; then - echo "::error::Found $format_errors file(s) with formatting issues." - echo "::error::Run 'cmake-format -i ' locally or comment '@phlexbot format' on the PR to auto-fix." + if ! gersemi --check phlex-src; then + echo "::error::Found files with formatting issues." + echo "::error::Run 'gersemi -i ' locally or comment '@phlexbot format' on the PR to auto-fix." exit 1 else echo "✅ All CMake files are properly formatted." diff --git a/.github/workflows/cmake-format-fix.yaml b/.github/workflows/cmake-format-fix.yaml index 53cbab5b..53fd1418 100644 --- a/.github/workflows/cmake-format-fix.yaml +++ b/.github/workflows/cmake-format-fix.yaml @@ -46,27 +46,13 @@ jobs: with: python-version: '3.x' - - name: Install cmake-format - run: pip install cmakelang + - name: Install gersemi + run: pip3 install gersemi - name: Apply CMake formatting run: | - cd phlex-src echo "Applying CMake formatting..." - - # Find all CMake files - cmake_files=$(find . -type f \( -name "CMakeLists.txt" -o -name "CMakeLists.txt.in" -o -name "*.cmake" -o -name "*.cmake.in" \) ! -path "*/build/*" ! -path "*/_deps/*") - - if [ -z "$cmake_files" ]; then - echo "No CMake files found to format" - exit 0 - fi - - # Format each file - for file in $cmake_files; do - echo "Formatting $file..." - cmake-format -i "$file" - done + gersemi --in-place phlex-src - name: Handle fix commit uses: ./phlex-src/.github/actions/handle-fix-commit From 1f48b32563a62fa913676754e3ad2a8c310e3bbf Mon Sep 17 00:00:00 2001 From: Chris Green Date: Mon, 8 Dec 2025 16:26:31 -0600 Subject: [PATCH 2/3] Address https://github.com/Framework-R-D/phlex/pull/169#discussion_r2599636468 --- .github/workflows/cmake-format-check.yaml | 2 +- .github/workflows/cmake-format-fix.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake-format-check.yaml b/.github/workflows/cmake-format-check.yaml index 998f4f89..07fc9d40 100644 --- a/.github/workflows/cmake-format-check.yaml +++ b/.github/workflows/cmake-format-check.yaml @@ -75,7 +75,7 @@ jobs: python-version: '3.x' - name: Install gersemi - run: pip3 install gersemi + run: pip install gersemi - name: Check CMake formatting run: | diff --git a/.github/workflows/cmake-format-fix.yaml b/.github/workflows/cmake-format-fix.yaml index 53fd1418..14e22ee8 100644 --- a/.github/workflows/cmake-format-fix.yaml +++ b/.github/workflows/cmake-format-fix.yaml @@ -47,7 +47,7 @@ jobs: python-version: '3.x' - name: Install gersemi - run: pip3 install gersemi + run: pip install gersemi - name: Apply CMake formatting run: | From be633c5b1e8ef65b0d15962d537bdc1967c45fbf Mon Sep 17 00:00:00 2001 From: Chris Green Date: Mon, 8 Dec 2025 16:29:02 -0600 Subject: [PATCH 3/3] Address https://github.com/Framework-R-D/phlex/pull/169#discussion_r2599636440 --- .github/workflows/cmake-format-fix.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake-format-fix.yaml b/.github/workflows/cmake-format-fix.yaml index 14e22ee8..088e72c1 100644 --- a/.github/workflows/cmake-format-fix.yaml +++ b/.github/workflows/cmake-format-fix.yaml @@ -52,7 +52,7 @@ jobs: - name: Apply CMake formatting run: | echo "Applying CMake formatting..." - gersemi --in-place phlex-src + gersemi -i phlex-src - name: Handle fix commit uses: ./phlex-src/.github/actions/handle-fix-commit