Skip to content

Commit

Permalink
Uncrustify PR Check Update (FreeRTOS#969)
Browse files Browse the repository at this point in the history
* 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
---------
  • Loading branch information
Skptak authored Jul 20, 2023
1 parent af743b9 commit ecd1307
Show file tree
Hide file tree
Showing 47 changed files with 1,831 additions and 1,832 deletions.
34 changes: 6 additions & 28 deletions .github/workflows/ci.yml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -61,43 +61,21 @@ jobs:
PATH=$PATH:main/tools/spell
# Make sure that the portable directory is not included in the spellcheck.
sed -i 's/find $DIRNAME/find $DIRNAME -not -path '*portable*'/g' main/tools/spell/find-unknown-comment-words
find-unknown-comment-words --directory tcp/ --lexicon tcp/.github/lexicon.txt
find-unknown-comment-words --directory tcp/ --lexicon tcp/lexicon.txt
if [ "$?" = "0" ]; then
exit 0
else
exit 1
fi
formatting:
# Use only 18.04 since we want the uncrustify version to
# be 0.66.1_f to ensure proper formatting.
runs-on: ubuntu-20.04
container: ubuntu:18.04
steps:
- uses: actions/checkout@v3
- name: Install Uncrustify
run: apt-get update && apt-get install uncrustify
- name: Run Uncrustify
run: |
uncrustify --version
find . -iname "*.[hc]" -exec uncrustify --check -c tools/uncrustify.cfg {} +
if [ "$?" = "0" ]; then
exit 0
else
echo -e "\033[31;1;43mFormatting check (using Uncrustify) failed...\033[0m"
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"
exit 1
fi
- name: Check For Trailing Whitespace
run: |
set +e
grep --exclude="README.md" -rnI -e "[[:blank:]]$" .
if [ "$?" = "0" ]; then
echo "Files have trailing whitespace."
exit 1
else
exit 0
fi
- uses: actions/checkout@v2
- name: Check formatting
uses: FreeRTOS/CI-CD-Github-Actions/formatting@main
with:
path: ./

doxygen:
runs-on: ubuntu-latest
Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/uncrustify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ jobs:
Uncrustify:
name: Run_Uncrustify
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/bot run uncrustify' }}
runs-on: ubuntu-20.04
container: ubuntu:18.04
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
Expand Down Expand Up @@ -41,16 +40,35 @@ jobs:
repository: ${{ steps.upstreamrepo.outputs.RemoteRepo }}
ref: ${{ steps.upstreambranch.outputs.branchname }}
- name: Install Uncrustify
run: apt-get update && apt-get --assume-yes install uncrustify
run: |
: # Install Uncrustify
echo "::group::Install Uncrustify"
sudo apt-get update && apt-get --assume-yes install uncrustify
echo "::endgroup::"
- name: Run Uncrustify
run: |
: # Uncrustify on C files while ignoring symlinks.
: # Make a collapsible section in the log to run uncrustify
echo "::group::Uncrustify Check"
uncrustify --version
find . -iname "*.[hc]" -exec uncrustify -c tools/uncrustify.cfg --no-backup --replace {} +
echo "::endgroup::"
echo -e "\033[32;3mUncrustify Formatting Applied\033[0m"
- name: Push changes to upstream repository
run: |
: # Push changes to upstream repository
echo "::group::Push changes to upstream repository"
git config --global --add safe.directory '*'
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git add -A
git commit -m "Uncrustify: triggered by comment."
echo "::endgroup::"
git push
if [ "$?" = "0" ]; then
echo -e "\033[32;3mPushed formatting changes, don't forget to run 'git pull'!\033[0m"
exit 0
else
echo -e "\033[32;31mFailed to push the formatting changes\033[0m"
exit 1
fi
File renamed without changes.
Loading

0 comments on commit ecd1307

Please sign in to comment.