-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be9fb6a
commit 60bd24e
Showing
1 changed file
with
32 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,36 @@ | ||
name: QuIC Organization Repolinter | ||
name: Cpp Code Style Checker | ||
|
||
on: [push, pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
repolinter: | ||
cpp-code-style-check: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
- name: Verify repolinter config file is present | ||
id: check_files | ||
uses: andstor/file-existence-action@v1 | ||
with: | ||
files: "repolint.json" | ||
- name: Run Repolinter with local repolint.json | ||
if: steps.check_files.outputs.files_exists == true | ||
uses: todogroup/repolinter-action@v1 | ||
with: | ||
config_file: "repolint.json" | ||
- name: Run Repolinter with default ruleset | ||
if: steps.check_files.outputs.files_exists == false | ||
uses: todogroup/repolinter-action@v1 | ||
with: | ||
config_url: "https://raw.githubusercontent.com/quic/.github/main/repolint.json" | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install clang-format | ||
run: sudo apt install -y clang-format | ||
|
||
- name: Setup clang-format configuration | ||
run: | | ||
if [ ! -f ./.clang-format ]; then | ||
echo "No .clang-format found, will use default configuration" | ||
curl -o .clang-format https://raw.githubusercontent.com/quic-qrb-ros/.github/main/code-style-profiles/.clang-format | ||
fi | ||
- name: Check code style | ||
run: | | ||
SRC=$(git ls-tree --full-tree -r HEAD | grep -e "\.\(c\|h\|hpp\|cpp\)\$" | cut -f 2) | ||
echo -e "Check source files: \n$SRC\n" | ||
clang-format -style=file -i $SRC | ||
if ! git diff --exit-code; then | ||
echo -e "\nCode does not match required style !!!" | ||
echo "Please use clang-format to format your code." | ||
exit 1 | ||
else | ||
echo "All files are properly formatted." | ||
fi |