Skip to content

Commit da2107f

Browse files
committed
Add clang-format workflow
1 parent c3b4941 commit da2107f

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

.github/workflows/clang-format.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Clang-Format Workflow
2+
3+
on:
4+
push:
5+
branches: '**'
6+
pull_request:
7+
8+
env:
9+
LLVM_VERSION: 18
10+
11+
jobs:
12+
format:
13+
name: Check the formatting
14+
runs-on: windows-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Pin to a specific version
23+
run: |
24+
$latestChocoVersion = (Resolve-ChocoPackageVersion -PackageName "llvm" -TargetVersion $env:LLVM_VERSION)
25+
Install-ChocoPackage -PackageName llvm -ArgumentList '--allow-downgrade', '--version', $latestChocoVersion
26+
27+
- name: Run clang-format
28+
env:
29+
RED4EXT_COMMIT_BEFORE: ${{ github.event.pull_request.base.sha || github.event.before }}
30+
RED4EXT_COMMIT_AFTER: ${{ github.sha }}
31+
run: |
32+
git `
33+
-c core.autocrlf=false `
34+
-c core.eol=lf `
35+
-c color.ui=always `
36+
clang-format `
37+
--style file `
38+
--diff $env:RED4EXT_COMMIT_BEFORE $env:RED4EXT_COMMIT_AFTER `

0 commit comments

Comments
 (0)