From f698dd4ac68434a9837791f64f3b08e64da5f687 Mon Sep 17 00:00:00 2001 From: Lucas Colley Date: Tue, 17 Jun 2025 01:08:52 +0100 Subject: [PATCH 1/4] CI: add format job --- .github/workflows/format.yml | 31 +++++++++++++++++++++++++++++++ pixi.toml | 1 + 2 files changed, 32 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..bacfb79 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,31 @@ +name: Format + +on: [ push, pull_request ] + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + CCACHE_DIR: "${{ github.workspace }}/.ccache" + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + format: + name: Check formatting + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + environment: [lint] + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: prefix-dev/setup-pixi@92815284c57faa15cd896c4d5cfb2d59f32dc43d # v0.8.3 + with: + pixi-version: v0.48.2 + cache: true + environments: ${{ matrix.environment }} + - name: Check for formatting violations + run: pixi run format-dry-error diff --git a/pixi.toml b/pixi.toml index 3782888..3cb973b 100644 --- a/pixi.toml +++ b/pixi.toml @@ -74,6 +74,7 @@ clang-format = "*" [feature.clang-format.tasks] format = "git ls-files '*.cpp' '*.h' | xargs clang-format -i --style=file" +format-dry-error = "git ls-files '*.cpp' '*.h' | xargs clang-format --style=file --Werror --dry-run" ## Coverage From f2d3f7dd143fd3c2a9dc1a96025d1dadd5e387f5 Mon Sep 17 00:00:00 2001 From: Lucas Colley Date: Tue, 17 Jun 2025 01:11:19 +0100 Subject: [PATCH 2/4] dummy typo --- include/xsf/alg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/xsf/alg.h b/include/xsf/alg.h index 8983d6c..88eb7a2 100644 --- a/include/xsf/alg.h +++ b/include/xsf/alg.h @@ -4,7 +4,7 @@ namespace xsf { -XSF_HOST_DEVICE inline double cbrt(double x) { return cephes::cbrt(x); } +XSF_HOST_DEVICE inline double cbrt(double x) { return cephes::cbrt(x); } XSF_HOST_DEVICE inline float cbrt(float x) { return cbrt(static_cast(x)); } From 9620daa3c4688daee0afbb5bcc2fe2fa04010738 Mon Sep 17 00:00:00 2001 From: Lucas Colley Date: Tue, 17 Jun 2025 01:14:28 +0100 Subject: [PATCH 3/4] pixi run format --- .github/workflows/format.yml | 4 +++- include/xsf/alg.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index bacfb79..c2f95ab 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -28,4 +28,6 @@ jobs: cache: true environments: ${{ matrix.environment }} - name: Check for formatting violations - run: pixi run format-dry-error + run: | + pixi run format-dry-error + echo "Please execute `pixi run format` to fix any errors." diff --git a/include/xsf/alg.h b/include/xsf/alg.h index 88eb7a2..8983d6c 100644 --- a/include/xsf/alg.h +++ b/include/xsf/alg.h @@ -4,7 +4,7 @@ namespace xsf { -XSF_HOST_DEVICE inline double cbrt(double x) { return cephes::cbrt(x); } +XSF_HOST_DEVICE inline double cbrt(double x) { return cephes::cbrt(x); } XSF_HOST_DEVICE inline float cbrt(float x) { return cbrt(static_cast(x)); } From 8e5996eb5cffcfae1b7c400aca836896a3d6ae3b Mon Sep 17 00:00:00 2001 From: Lucas Colley Date: Tue, 17 Jun 2025 01:15:19 +0100 Subject: [PATCH 4/4] try to fix echo --- .github/workflows/format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index c2f95ab..ed62ae0 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -30,4 +30,4 @@ jobs: - name: Check for formatting violations run: | pixi run format-dry-error - echo "Please execute `pixi run format` to fix any errors." + echo "Please execute 'pixi run format' to fix any errors."