File tree Expand file tree Collapse file tree 3 files changed +36
-2
lines changed
Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: Copyright (c) 2025 Infineon Technologies AG
2+ #
3+ # SPDX-License-Identifier: BSD-2-Clause
4+
5+ name : Clang Format Checker
6+ on :
7+ [push, pull_request]
8+ jobs :
9+ clang-format-checking :
10+ runs-on : ubuntu-latest
11+ container :
12+ image : ghcr.io/tpm2-software/ubuntu-24.04
13+ steps :
14+ - name : Check out repository
15+ uses : actions/checkout@v4
16+ with :
17+ fetch-depth : 1
18+ - name : Run clang-format
19+ run : clang-format -i $(find -name '*.h' -or -name '*.c' | xargs realpath)
20+ - name : Check for diffs
21+ run : |
22+ git config --global --add safe.directory $PWD
23+ git diff --exit-code && echo "No formatting issues found."
24+ - name : failure
25+ if : ${{ failure() }}
26+ run : |
27+ echo "Clang format check failed. Please run clang-format on your code or see the diff in the step above."
28+ echo "docker run -u $UID -v $PWD:$PWD ghcr.io/tpm2-software/ubuntu-24.04 clang-format -i $(find -name '*.h' -or -name '*.c' | xargs realpath)"
Original file line number Diff line number Diff line change @@ -44,6 +44,13 @@ full text of the DCO is here: https://developercertificate.org/. Contributors
4444must add a 'Signed-off-by' line to their commits. This indicates the
4545submitters acceptance of the DCO.
4646
47+ Please note that we now require REUSE and clang-format to also pass on PRs.
48+ You may run
49+ ``` sh
50+ docker run -u $UID -v $PWD :$PWD ghcr.io/tpm2-software/ubuntu-24.04 clang-format -i $( find -name ' *.h' -or -name ' *.c' | xargs realpath)
51+ ```
52+ before submitting in order to align with our format requirements.
53+
4754## Guideline for merging changes
4855
4956Pull Requests MUST be assigned to an upcoming release tag. If a release milestone does
Original file line number Diff line number Diff line change @@ -9,8 +9,7 @@ check the surrounding code and imitate its style [1].
99For simplicity, we use clang-format for all files (also as part of the CI).
1010Thus before commiting any code, we recommend you run
1111``` sh
12- docker run -u 1000 -v $PWD :$PWD xianpengshen/clang-tools:17 clang-format -i $( find -name ' *.c' | xargs realpath)
13- docker run -u 1000 -v $PWD :$PWD xianpengshen/clang-tools:17 clang-format -i $( find -name ' *.h' | xargs realpath)
12+ docker run -u $UID -v $PWD :$PWD ghcr.io/tpm2-software/ubuntu-24.04 clang-format -i $( find -name ' *.h' -or -name ' *.c' | xargs realpath)
1413```
1514This ensures that the code will not break during your pull request.
1615
You can’t perform that action at this time.
0 commit comments