From 651195ea7e0f821b6c43a800b997c55ed1298f2c Mon Sep 17 00:00:00 2001 From: Yuuichi Asahi Date: Sat, 22 Feb 2025 00:26:55 +0900 Subject: [PATCH] use cmake-format instead of gersemi in CI --- .cmake-format.py | 32 ++++++++++++++++++++ .github/workflows/__clang-format-check.yaml | 22 ++++++++++++++ .github/workflows/__cmake-format-check.yaml | 23 ++++++++++++++ .github/workflows/build_test.yaml | 18 +++++------ .github/workflows/pytest.yml | 33 --------------------- python/.gersemirc | 9 ------ python/pyproject.toml | 24 --------------- 7 files changed, 84 insertions(+), 77 deletions(-) create mode 100644 .cmake-format.py create mode 100644 .github/workflows/__clang-format-check.yaml create mode 100644 .github/workflows/__cmake-format-check.yaml delete mode 100644 .github/workflows/pytest.yml delete mode 100644 python/.gersemirc delete mode 100644 python/pyproject.toml diff --git a/.cmake-format.py b/.cmake-format.py new file mode 100644 index 00000000..702cfe2c --- /dev/null +++ b/.cmake-format.py @@ -0,0 +1,32 @@ +# SPDX-FileCopyrightText: (C) The kokkos-fft development team, see COPYRIGHT.md file +# +# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +# ----------------------------- +# Options affecting formatting. +# ----------------------------- +with section("format"): + +# How wide to allow formatted cmake files +line_width = 120 + +# If an argument group contains more than this many sub-groups (parg or kwarg +# groups) then force it to a vertical layout. +max_subgroups_hwrap = 3 + +# If a statement is wrapped to more than one line, than dangle the closing +# parenthesis on its own line. +dangle_parens = True + +# If the trailing parenthesis must be 'dangled' on its on line, then align it +# to this reference: `prefix`: the start of the statement, `prefix-indent`: +# the start of the statement, plus one indentation level, `child`: align to +# the column of the arguments +dangle_align = 'prefix' + +# ------------------------------------------------ +# Options affecting comment reflow and formatting. +# ------------------------------------------------ +with section("markup"): + # enable comment markup parsing and reflow + enable_markup = False diff --git a/.github/workflows/__clang-format-check.yaml b/.github/workflows/__clang-format-check.yaml new file mode 100644 index 00000000..054f60f8 --- /dev/null +++ b/.github/workflows/__clang-format-check.yaml @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: (C) The kokkos-fft development team, see COPYRIGHT.md file +# +# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +name: clang-format check + +on: + workflow_call: + +permissions: read-all + +jobs: + clang-formatting-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DoozyX/clang-format-lint-action@v0.18 + with: + source: 'common/ fft/ examples/ install_test/' + exclude: '' + extensions: 'hpp,cpp' + clangFormatVersion: 17 diff --git a/.github/workflows/__cmake-format-check.yaml b/.github/workflows/__cmake-format-check.yaml new file mode 100644 index 00000000..93efa98c --- /dev/null +++ b/.github/workflows/__cmake-format-check.yaml @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: (C) The kokkos-fft development team, see COPYRIGHT.md file +# +# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +name: cmake-format check + +on: + workflow_call: + +permissions: read-all + +jobs: + cmake-formatting-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: cmake-format lint action + uses: puneetmatharu/cmake-format-lint-action@2ac346e79e7ceac958bc637c1391285fb335ed7c # v1.0.5 + with: + args: --config-files .cmake-format.py --in-place + file-regex: '(.*\.cmake$|.*\.cmake\.in$|CMakeLists.txt$)' + - name: check + run: git diff --exit-code diff --git a/.github/workflows/build_test.yaml b/.github/workflows/build_test.yaml index 61754f91..21894a8d 100644 --- a/.github/workflows/build_test.yaml +++ b/.github/workflows/build_test.yaml @@ -19,19 +19,15 @@ env: jobs: # run linter on the code - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: DoozyX/clang-format-lint-action@v0.18 - with: - source: 'common/ fft/ examples/ install_test/' - exclude: '' - extensions: 'hpp,cpp' - clangFormatVersion: 17 + clang-format-check: + uses: ./.github/workflows/__clang-format-check.yaml + + # run cmake format check + cmake-format-check: + uses: ./.github/workflows/__cmake-format-check.yaml # run typos for spell check - spell_check: + spell-check: name: spell check with typos runs-on: ubuntu-latest steps: diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml deleted file mode 100644 index 1ea92ff3..00000000 --- a/.github/workflows/pytest.yml +++ /dev/null @@ -1,33 +0,0 @@ -# SPDX-FileCopyrightText: (C) The kokkos-fft development team, see COPYRIGHT.md file -# -# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception - -name: CI (python) - -on: - pull_request: - branches: [ "main" ] - -jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.12"] - - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies and package with test extras - run: | - python -m pip install --upgrade pip - pip install hatch - cd python && hatch build && pip install . - - - name: Run gersemi - run: | - find CMakeLists.txt common/ examples/ fft/ -name 'CMakeLists.txt' -exec gersemi --check --diff '{}' '+' diff --git a/python/.gersemirc b/python/.gersemirc deleted file mode 100644 index f3919f6e..00000000 --- a/python/.gersemirc +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-FileCopyrightText: (C) The kokkos-fft development team, see COPYRIGHT.md file -# -# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception - -# yaml-language-server: $schema=https://raw.githubusercontent.com/BlankSpruce/gersemi/0.17.0/gersemi/configuration.schema.json - -definitions: ["cmake"] -indent: 4 -line_length: 100 diff --git a/python/pyproject.toml b/python/pyproject.toml deleted file mode 100644 index 82ae710f..00000000 --- a/python/pyproject.toml +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-FileCopyrightText: (C) The kokkos-fft development team, see COPYRIGHT.md file -# -# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception - -[build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" - -[project] -name = "kokkos-fft" -version = "0.2.1" -readme = "../README.md" -requires-python = ">=3.8" -dependencies = [ - "gersemi>=0.17" -] -license = { text = "MIT OR Apache-2.0 licence with LLVM exception" } - -[project.urls] -Homepage = "https://github.com/kokkos/kokkos-fft" -Issues = "https://github.com/kokkos/kokkos-fft/issues" - -[tool.hatch.build.targets.wheel] -packages = ["python"]