Skip to content

Commit f698dd4

Browse files
committed
CI: add format job
1 parent e329269 commit f698dd4

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.github/workflows/format.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Format
2+
3+
on: [ push, pull_request ]
4+
5+
permissions:
6+
contents: read # to fetch code (actions/checkout)
7+
8+
env:
9+
CCACHE_DIR: "${{ github.workspace }}/.ccache"
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
format:
17+
name: Check formatting
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
environment: [lint]
23+
steps:
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
- uses: prefix-dev/setup-pixi@92815284c57faa15cd896c4d5cfb2d59f32dc43d # v0.8.3
26+
with:
27+
pixi-version: v0.48.2
28+
cache: true
29+
environments: ${{ matrix.environment }}
30+
- name: Check for formatting violations
31+
run: pixi run format-dry-error

pixi.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ clang-format = "*"
7474

7575
[feature.clang-format.tasks]
7676
format = "git ls-files '*.cpp' '*.h' | xargs clang-format -i --style=file"
77+
format-dry-error = "git ls-files '*.cpp' '*.h' | xargs clang-format --style=file --Werror --dry-run"
7778

7879
## Coverage
7980

0 commit comments

Comments
 (0)