Skip to content

Commit ecd1307

Browse files
authored
Uncrustify PR Check Update (#969)
* Update uncrustify to use version other repos use, clean up the way it runs, formatting changes to needed files * Moving the lexicon.txt to where it lives in all other repos * Removing executable permissions from .c files ---------
1 parent af743b9 commit ecd1307

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1831
-1832
lines changed

.github/workflows/ci.yml

100755100644
+6-28
Original file line numberDiff line numberDiff line change
@@ -61,43 +61,21 @@ jobs:
6161
PATH=$PATH:main/tools/spell
6262
# Make sure that the portable directory is not included in the spellcheck.
6363
sed -i 's/find $DIRNAME/find $DIRNAME -not -path '*portable*'/g' main/tools/spell/find-unknown-comment-words
64-
find-unknown-comment-words --directory tcp/ --lexicon tcp/.github/lexicon.txt
64+
find-unknown-comment-words --directory tcp/ --lexicon tcp/lexicon.txt
6565
if [ "$?" = "0" ]; then
6666
exit 0
6767
else
6868
exit 1
6969
fi
7070
7171
formatting:
72-
# Use only 18.04 since we want the uncrustify version to
73-
# be 0.66.1_f to ensure proper formatting.
7472
runs-on: ubuntu-20.04
75-
container: ubuntu:18.04
7673
steps:
77-
- uses: actions/checkout@v3
78-
- name: Install Uncrustify
79-
run: apt-get update && apt-get install uncrustify
80-
- name: Run Uncrustify
81-
run: |
82-
uncrustify --version
83-
find . -iname "*.[hc]" -exec uncrustify --check -c tools/uncrustify.cfg {} +
84-
if [ "$?" = "0" ]; then
85-
exit 0
86-
else
87-
echo -e "\033[31;1;43mFormatting check (using Uncrustify) failed...\033[0m"
88-
echo -e "\033[32;3mTo have the code uncrustified for you, please comment '/bot run uncrustify' (without the quotes) on the Pull Request.\033[0m"
89-
exit 1
90-
fi
91-
- name: Check For Trailing Whitespace
92-
run: |
93-
set +e
94-
grep --exclude="README.md" -rnI -e "[[:blank:]]$" .
95-
if [ "$?" = "0" ]; then
96-
echo "Files have trailing whitespace."
97-
exit 1
98-
else
99-
exit 0
100-
fi
74+
- uses: actions/checkout@v2
75+
- name: Check formatting
76+
uses: FreeRTOS/CI-CD-Github-Actions/formatting@main
77+
with:
78+
path: ./
10179

10280
doxygen:
10381
runs-on: ubuntu-latest

.github/workflows/uncrustify.yml

+21-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ jobs:
88
Uncrustify:
99
name: Run_Uncrustify
1010
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/bot run uncrustify' }}
11-
runs-on: ubuntu-20.04
12-
container: ubuntu:18.04
11+
runs-on: ubuntu-latest
1312
steps:
1413
- name: Dump GitHub context
1514
env:
@@ -41,16 +40,35 @@ jobs:
4140
repository: ${{ steps.upstreamrepo.outputs.RemoteRepo }}
4241
ref: ${{ steps.upstreambranch.outputs.branchname }}
4342
- name: Install Uncrustify
44-
run: apt-get update && apt-get --assume-yes install uncrustify
43+
run: |
44+
: # Install Uncrustify
45+
echo "::group::Install Uncrustify"
46+
sudo apt-get update && apt-get --assume-yes install uncrustify
47+
echo "::endgroup::"
4548
- name: Run Uncrustify
4649
run: |
50+
: # Uncrustify on C files while ignoring symlinks.
51+
: # Make a collapsible section in the log to run uncrustify
52+
echo "::group::Uncrustify Check"
4753
uncrustify --version
4854
find . -iname "*.[hc]" -exec uncrustify -c tools/uncrustify.cfg --no-backup --replace {} +
55+
echo "::endgroup::"
56+
echo -e "\033[32;3mUncrustify Formatting Applied\033[0m"
4957
- name: Push changes to upstream repository
5058
run: |
59+
: # Push changes to upstream repository
60+
echo "::group::Push changes to upstream repository"
5161
git config --global --add safe.directory '*'
5262
git config --global user.name 'GitHub Action'
5363
git config --global user.email '[email protected]'
5464
git add -A
5565
git commit -m "Uncrustify: triggered by comment."
66+
echo "::endgroup::"
5667
git push
68+
if [ "$?" = "0" ]; then
69+
echo -e "\033[32;3mPushed formatting changes, don't forget to run 'git pull'!\033[0m"
70+
exit 0
71+
else
72+
echo -e "\033[32;31mFailed to push the formatting changes\033[0m"
73+
exit 1
74+
fi

.github/lexicon.txt lexicon.txt

File renamed without changes.

0 commit comments

Comments
 (0)