-
Notifications
You must be signed in to change notification settings - Fork 51
59 lines (52 loc) · 1.72 KB
/
style.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Style
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Install more recent clang-format from LLVM (match Homebrew v16)
- name: Install clang-format
run: |
wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main'
sudo apt-get update -q
sudo apt-get install -y clang-format-18
- name: Check style
run: |
./scripts/format-source --clang-format clang-format-18
if [[ `git status -s | wc -l` -ne 0 ]]; then
echo 'Error: Commit is not formatted!'
echo 'Run '\`'./scripts/format-source'\`' in the source root directory'
echo 'Summary of required changes:'
echo "`git diff --stat`"
echo 'Repository status:'
echo "`git status`"
exit 1
else
echo 'Commit is correctly formatted'
exit 0
fi
check-config:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check JSON Schema
run: |
OUTPUT=$(find examples -name *.json -maxdepth 2 -print0 | xargs -0 -n1 ./scripts/validate-config)
if echo $OUTPUT | grep -q 'Validation failed'; then
echo 'Error: Configuration file validation failed!'
echo 'Summary of output:'
echo $OUTPUT
exit 1
else
echo 'Configuration file validation passed'
exit 0
fi