Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/formattingTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:

jobs:
uncrustify-formatting-success-cases:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1

Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
exclude-dirs: "fileWithErrorInclude, fileWithErrorSource"

uncrustify-formatting-error-cases:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ jobs:
branch-coverage-min: ${{ matrix.inputs.branch_coverage }}

PR-uncrustify-checks:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
if: ${{ github.event.pull_request }} || ${{ github.event.workflow }}
strategy:
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:

jobs:
test-format-check:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4.1.1
Expand Down
43 changes: 38 additions & 5 deletions formatting/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,53 @@ runs:
bashInfo: \033[33;1mINFO -
bashFail: \033[31;1mFAILED -
bashEnd: \033[0m
stepName: Install Uncrustify
stepName: Install Tools
name: ${{ env.stepName }}
shell: bash
run: |
# ${{ env.stepName }}
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"

sudo apt-get install uncrustify fd-find dos2unix
sudo apt-get install cmake build-essential fd-find dos2unix
echo "$GITHUB_ACTION_PATH" >> $GITHUB_PATH
export PATH="$PATH:$GITHUB_ACTION_PATH"

# Check that the commands installed correctly
fdfind --version
echo -e "::endgroup::"

echo -e "${{ env.bashInfo }} Using Uncrustify Version: "$(uncrustify --version)" ${{ env.bashEnd }}"
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"

- name: Cache uncrustify
uses: actions/cache@v4
id: cache-uncrustify_0_69_0
with:
path: |
~/uncrustify
key: ${{ runner.os }}-uncrustify-0.69.0

- env:
bashPass: \033[32;1mPASSED -
bashInfo: \033[33;1mINFO -
bashFail: \033[31;1mFAILED -
bashEnd: \033[0m
stepName: Build uncrustify version 0.69.0
name: ${{ env.stepName }}
shell: bash
if: steps.cache-uncrustify_0_69_0.outputs.cache-hit != 'true'
run: |
# ${{ env.stepName }}
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"

wget https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.69.0.tar.gz
tar xzvf uncrustify-0.69.0.tar.gz && cd uncrustify-uncrustify-0.69.0

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -- -j$(nproc) -s

mkdir ~/uncrustify
cd build && cp uncrustify ~/uncrustify/

echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"

- env:
Expand All @@ -58,6 +89,8 @@ runs:
# ${{ env.stepName }}
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"

echo -e "${{ env.bashInfo }} Using Uncrustify Version: "$(~/uncrustify/uncrustify --version)" ${{ env.bashEnd }}"

exitCode=0
export PATH="$PATH:$GITHUB_ACTION_PATH"

Expand Down Expand Up @@ -91,8 +124,8 @@ runs:
# Get all .c and .h files, as well as any other requested file types.
# Then run uncrustify with the common config file.

echo -e "${{ env.bashInfo }} fdfind -e c -e h ${args} --exec uncrustify --no-backup --replace --if-changed -c https://github.com/FreeRTOS/CI-CD-Github-Actions/blob/main/formatting/uncrustify.cfg -l C ${{ env.bashEnd }}"
fdfind -e c -e h ${args} --exec uncrustify -q --no-backup --replace --if-changed -c $GITHUB_ACTION_PATH/uncrustify.cfg -l C
echo -e "${{ env.bashInfo }} fdfind -e c -e h ${args} --exec ~/uncrustify/uncrustify --no-backup --replace --if-changed -c https://github.com/FreeRTOS/CI-CD-Github-Actions/blob/main/formatting/uncrustify.cfg -l C ${{ env.bashEnd }}"
fdfind -e c -e h ${args} --exec ~/uncrustify/uncrustify -q --no-backup --replace --if-changed -c $GITHUB_ACTION_PATH/uncrustify.cfg -l C

# Replace all trailing whitespace, exclude photo and binary files
echo -e "${{ env.bashInfo }} Check for Trailing Whitespace ${{ env.bashEnd }}"
Expand Down
Loading