-
Notifications
You must be signed in to change notification settings - Fork 32
81 lines (76 loc) · 2.85 KB
/
clang-format.yml
File metadata and controls
81 lines (76 loc) · 2.85 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: clang-format
on:
# Triggers the workflow when called by a top-level workflow
workflow_call:
inputs:
upload_artefacts:
type: boolean
required: false
default: false
build_type: # "release" | "debug"
type: string
required: false
default: "release"
debug_level: # "full" | "minimal" | "release"
type: string
required: false
default: "release"
new_release_version:
type: string
required: false
jobs:
clang-format:
runs-on: ubuntu-latest
name: Format sources
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
mkdir bin
wget https://github.com/muttleyxd/clang-tools-static-binaries/releases/download/master-8f72ab3c/clang-format-17_linux-amd64 -O bin/clang-format-17
chmod +x bin/clang-format-17
- name: Run clang-format
run: |
.github/scripts/run-clang-format.py \
--clang-format-executable bin/clang-format-17 \
-i \
-r Source Data/Base.rte/Shaders \
--exclude Source/System/Base64 \
--exclude Source/System/BitMask \
--exclude Source/System/glad \
--exclude Source/System/MicroPather \
--exclude Source/System/Semver200 \
--exclude Source/System/StackWalker
- name: Add missing newlines
run: |
.github/scripts/run-clang-format.py \
--clang-format-executable .github/scripts/add-eol.sh \
-i \
-r Source Data/Base.rte/Shaders \
--exclude Source/System/Base64 \
--exclude Source/System/BitMask \
--exclude Source/System/glad \
--exclude Source/System/MicroPather \
--exclude Source/System/Semver200 \
--exclude Source/System/StackWalker
- name: Report changes
run: |
# Store the changes in a patch file first
git diff > clang-format-changes.patch
# if any changes were made, fail the build
if ! git diff --quiet ; then
echo "::error::Code misformatted. Run clang-format or apply the patch (printed below and attached to job summary) to fix."
# Print the changes to the console
cat clang-format-changes.patch
exit 1
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
# Only upload the patch file if the build failed, meaning that the code was not properly formatted
if: failure()
with:
name: clang-format-changes.patch
path: |
clang-format-changes.patch