-
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.
Add code format check as GitHub workflow. (#31)
* Add code format check as GitHub workflow. * Run format_code.sh. * Rename workflow to "ci".
- Loading branch information
Showing
6 changed files
with
58 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
[[ ! $(git --version) ]] && exit 1 | ||
|
||
output=$(git diff) | ||
|
||
if [[ "$output" != "" ]]; then | ||
echo "One or more source files are not formatted!" | ||
exit 1 | ||
fi | ||
|
||
echo "All source files are formatted" | ||
exit |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: ci | ||
on: [push] | ||
jobs: | ||
format-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: format code | ||
run: tools/format_code.sh | ||
- name: check diff | ||
run: .github/format_check_diff.sh |
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
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
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
[[ ! $(clang-format --version) ]] && exit 1 | ||
|
||
script_path=${0%/*} | ||
tools_root=${script_path%/*} | ||
project_root=$tools_root/.. | ||
|
||
if [[ "$0" != "$project_root" ]] && [[ "$project_root" != "" ]]; then | ||
cd "$project_root" || exit 1 | ||
echo "-- Changed pwd to $(pwd)" | ||
fi | ||
|
||
files=$(find DogTales -name "*.?pp") | ||
if [[ "$files" == "" ]]; then | ||
echo "-- No source files found" | ||
exit | ||
fi | ||
|
||
clang-format -i $files | ||
echo -e "-- Formatted Files:\n$files\n" | ||
|
||
exit |