Uncrustify PR Check Changes (#1036)

* Changing uncrustify to print out git difference after fixing
* Updating workflow for freertos_demos to use echo groups, updating ci.yml formatting
---------
pull/1044/head^2
Soren Ptak 2 years ago committed by GitHub
parent e39bb188dd
commit c31cc9ba1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -33,26 +33,46 @@ jobs:
run: sudo apt-get install uncrustify=0.69.0+dfsg1-1build1
- 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"
# GitHub automtically use "set -e" which causes scripts to fail on the first exit code
# This would mean the first time a file fails the check that we exit without formatting all files.
set +e
uncrustify --version
find FreeRTOS/Demo/Common FreeRTOS/Test \( -name ethernet -o -name drivers -o -path 'FreeRTOS/Test/CMock/CMock' \) -prune -false -o -name "*.[hc]" -exec uncrustify --check -c tools/uncrustify.cfg {} +
find FreeRTOS/Demo/Common FreeRTOS/Test \( -name ethernet -o -name drivers -o -path 'FreeRTOS/Test/CMock/CMock' \) -prune -false -o -name "*.[hc]" | xargs uncrustify --no-backup --replace --if-changed -c tools/uncrustify.cfg -l C
echo "::endgroup::"
# Run a git diff to print the differences if any exist, return an error code if there are any
git diff --exit-code
if [ "$?" = "0" ]; then
echo -e "\033[32;3mUncrustify check passed\033[0m"
exit 0
else
echo -e "\033[32;31mFormatting check (using Uncrustify) failed...\033[0m"
# If there is an error, set this flag high again so the exit 1 fails the run
set -e
exit 1
fi
- name: Check For Trailing Whitespace
run: |
# Trailing Whitespace Check
set +e
ERROR=0
find . \( -name '.git' -o -path "./FreeRTOS/Test/CBMC/patches" -o -path "./FreeRTOS-Plus" -o -path "./FreeRTOS/Source" -o -path "./FreeRTOS/Test/CMock/CMock" -o -path "./FreeRTOS/Demo" \) -prune -false -o -type f -a -name "*" -exec grep -In -e "[[:blank:]]$" {} +
if [ "$?" = "0" ]; then
echo "Files have trailing whitespace."
ERROR=1
fi
find FreeRTOS/Demo/Common \( -name "ethernet" \) -prune -o -false -o -type f -a -name "*" -exec grep --color=yes -In -e "[[:blank:]]$" {} +
if [ "$?" = "0" ]; then
echo "Files have trailing whitespace."
echo -e "\033[32;31mFiles have trailing whitespace.\033[0m"
exit 1
else
if [ "$ERROR" -eq "1" ]; then
echo -e "\033[32;31mFiles have trailing whitespace.\033[0m"
exit 1
fi
echo -e "\033[32;3mTrailing whitespace check passed\033[0m"
exit 0
fi

@ -15,7 +15,17 @@ jobs:
- name: Fetch Kernel Submodule
shell: bash
run: |
# Fetch Kernel Submodule
echo "::group::Fetch Kernel Submodule"
git submodule update --checkout --init --depth 1 FreeRTOS/Source
echo "::engdroup::"
if [[ "$?" = "0" ]]
then
echo -e "\033[32;3mCloned the Kernel\033[0m"
else
echo -e "\033[32;31mKernel Clone Failed...\033[0m"
exit 1
fi
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
@ -24,10 +34,19 @@ jobs:
id: build-win32-msvs-full-demo
working-directory: FreeRTOS/Demo/WIN32-MSVC
run: |
# Build WIN32-MSVC Full Demo
echo "::group::Build WIN32-MSVC Full Demo"
$content = Get-Content -Path 'main.c' -Raw
$newContent = $content -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );'
$newContent | Set-Content -Path 'main.c'
msbuild WIN32.sln -t:rebuild
echo "::endgroup::"
if($? -eq 1) {
Write-Host -ForegroundColor green "Built the WIN32-MSVC Full Demo"
}else {
Write-Host -ForegroundColor red "Build WIN32-MSVC Full Demo Failed..."
exit 1
}
- name: Run and monitor WIN32-MSVC Full Demo
if: success() || failure() && steps.build-win32-msvs-full-demo.outcome == 'success'
@ -42,11 +61,20 @@ jobs:
id: build-win32-msvs-blinky-demo
working-directory: FreeRTOS/Demo/WIN32-MSVC
run: |
# Build WIN32-MSVC Blinky Demo
echo "::group::MSBuild of WIN32-MSVC Blinky Demo"
$content = Get-Content -Path 'main.c' -Raw
$newContent = $content -replace '#define\s+mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\s+0', '#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1'
$newContent = $newContent -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );'
$newContent | Set-Content -Path 'main.c'
# Perform MSBuild of WIN32-MSVC Blinky Demo
msbuild WIN32.sln -t:rebuild
echo "::endgroup::"
if($? -eq 1) {
Write-Host -ForegroundColor green "Built the WIN32-MSVC Blinky Demo"
}else {
Write-Host -ForegroundColor red "Build WIN32-MSVC Blinky Demo Failed..."
exit 1
}
- name: Run and monitor WIN32-MSVC Blinky Demo
if: success() || failure() && steps.build-win32-msvs-blinky-demo.outcome == 'success'
@ -61,10 +89,19 @@ jobs:
id: build-win32-msvs-static-allocation-only-demo
working-directory: FreeRTOS/Demo/WIN32-MSVC-Static-Allocation-Only
run: |
# Build WIN32-MSVC-Static-Allocation-Only Demo
echo "::group::Build WIN32-MSVC-Static-Allocation-Only Demo"
$content = Get-Content -Path 'main.c' -Raw
$newContent = $content -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );'
$newContent | Set-Content -Path 'main.c'
msbuild WIN32.sln -t:rebuild
echo "::endgroup::"
if($? -eq 1) {
Write-Host -ForegroundColor green "Built the WIN32-MSVC-Static-Allocation-Only Demo"
}else {
Write-Host -ForegroundColor red "Build WIN32-MSVC-Static-Allocation-Only Demo Failed..."
exit 1
}
- name: Run and monitor WIN32-MSVC-Static-Allocation-Only Demo
if: success() || failure() && steps.build-win32-msvs-static-allocation-only-demo.outcome == 'success'
@ -85,23 +122,38 @@ jobs:
- name: Fetch Kernel Submodule
shell: bash
run: |
# Fetch Kernel Submodule
echo "::group::Fetch Kernel Submodule"
git submodule update --checkout --init --depth 1 FreeRTOS/Source
echo "::engdroup::"
if [[ "$?" = "0" ]]
then
echo -e "\033[32;3mCloned the Kernel\033[0m"
else
echo -e "\033[32;31mKernel Clone Failed...\033[0m"
exit 1
fi
- name: Fetch Kernel Submodule
shell: bash
run: |
git submodule update --checkout --init --depth 1 FreeRTOS/Source
- name: Build WIN32-MingW Full Demo
id: build-win32-mingw-full-demo
working-directory: FreeRTOS/Demo/WIN32-MingW
run: |
# Build WIN32-MingW Full Demo
echo "::group::Build WIN32-MingW Full Demo"
$content = Get-Content -Path 'main.c' -Raw
$newContent = $content -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );'
$newContent | Set-Content -Path 'main.c'
gcc --version
make --version
make
echo "::endgroup::"
if($? -eq 1) {
Write-Host -ForegroundColor green "Built the WIN32-MingW Full Demo"
}else {
Write-Host -ForegroundColor red "Build WIN32-MingW Full Demo Failed..."
exit 1
}
- name: Run and monitor WIN32-MingW Full Demo
if: success() || failure() && steps.build-win32-mingw-full-demo.outcome == 'success'
@ -116,6 +168,8 @@ jobs:
id: build-win32-mingw-blinky-demo
working-directory: FreeRTOS/Demo/WIN32-MingW
run: |
# Build WIN32-MingW Blinky Demo
echo "::group::Build WIN32-MingW Blinky Demo"
$content = Get-Content -Path 'main.c' -Raw
$newContent = $content -replace '#define\s+mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\s+0', '#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1'
$newContent = $newContent -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );'
@ -123,6 +177,13 @@ jobs:
gcc --version
make --version
make
echo "::endgroup::"
if($? -eq 1) {
Write-Host -ForegroundColor green "Built the WIN32-MingW Blinky Demo"
}else {
Write-Host -ForegroundColor red "Build WIN32-MingW Blinky Demo Failed..."
exit 1
}
- name: Run and monitor WIN32-MingW Blinky Demo
if: success() || failure() && steps.build-win32-mingw-blinky-demo.outcome == 'success'
@ -142,21 +203,51 @@ jobs:
- name: Fetch Kernel Submodule
shell: bash
run: git submodule update --checkout --init --depth 1 FreeRTOS/Source
run: |
# Fetch Kernel Submodule
echo "::group::Fetch Kernel Submodule"
git submodule update --checkout --init --depth 1 FreeRTOS/Source
echo "::engdroup::"
if [ "$?" = "0" ]; then
echo -e "\033[32;3mCloned the Kernel\033[0m"
else
echo -e "\033[32;31mKernel Clone Failed...\033[0m"
exit 1
fi
- name: Install GCC
shell: bash
run: |
# Install GCC
echo "::group::Install GCC"
sudo apt-get -y update
sudo apt-get -y install build-essential
echo "::endgroup::"
if [ "$?" = "0" ]; then
echo -e "\e[0;32mInstall GCC Passed\e[0m"
else
echo -e "\e[0;32mInstall GCC Failed\e[0m"
# If there is an error, set this flag high again so the exit 1 fails the run
set -e
exit 1
fi
- name: Build Posix_GCC Full Demo
id: build-posix-gcc-full-demo
shell: bash
working-directory: FreeRTOS/Demo/Posix_GCC
run: |
# Build Posix_GCC Full Demo
echo "::group::Build Posix_GCC Full Demo"
sed -i -z "s/int[[:space:]]*main[[:space:]]*([[:space:]]*void[[:space:]]*)\n{/int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );/g" main.c
make -j
echo "::endgroup::"
if [ "$?" = "0" ]; then
echo -e "\033[32;3mBuild Posix_GCC Full Demo Passed\033[0m"
else
echo -e "\033[32;31mBuild Posix_GCC Full Demo Failed...\033[0m"
exit 1
fi
- name: Run and monitor Posix_GCC Full Demo
if: success() || failure() && steps.build-posix-gcc-full-demo.outcome == 'success'
@ -173,9 +264,17 @@ jobs:
shell: bash
working-directory: FreeRTOS/Demo/Posix_GCC
run: |
sed -i -z "s/int[[:space:]]*main[[:space:]]*([[:space:]]*void[[:space:]]*)\n{/int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );/g" main.c
# Build Posix_GCC Blinky Demo
echo "::group::Build Posix_GCC Blinky Demo"
rm -rf build
make -j USER_DEMO=BLINKY_DEMO
echo "::endgroup::"
if [ "$?" = "0" ]; then
echo -e "\033[32;3mBuilt the Posix_GCC Blinky Demo\033[0m"
else
echo -e "\033[32;31mBuild Posix_GCC Blinky Demo Failed...\033[0m"
exit 1
fi
- name: Run and monitor Posix_GCC Blinky Demo
if: success() || failure() && steps.build-posix-gcc-blinky-demo.outcome == 'success'
@ -195,18 +294,47 @@ jobs:
- name: Fetch Kernel Submodule
shell: bash
run: git submodule update --checkout --init --depth 1 FreeRTOS/Source
run: |
# Fetch Kernel Submodule
echo "::group::Fetch Kernel Submodule"
git submodule update --checkout --init --depth 1 FreeRTOS/Source
echo "::engdroup::"
if [ "$?" = "0" ]; then
echo -e "\033[32;3mCloned the Kernel\033[0m"
else
echo -e "\033[32;31mKernel Clone Failed...\033[0m"
exit 1
fi
- name: Install MSP430 Toolchain
shell: bash
run: |
# Install MSP430 Toolchain
echo "::group::Install MSP430 Toolchain"
sudo apt-get -y update
sudo apt-get -y install gcc-msp430 build-essential
echo "::endgroup::"
if [ "$?" = "0" ]; then
echo -e "\033[32;3mInstalled the MSP430 Toolchain\033[0m"
else
echo -e "\033[32;31mInstalling the MSP430 ToolchainFailed...\033[0m"
exit 1
fi
- name: Build msp430_GCC Demo
shell: bash
working-directory: FreeRTOS/Demo/msp430_GCC
run: make -j
run: |
# Build msp430_GCC Demo
echo "::group::Build msp430_GCC Demo"
make -j
echo "::endgroup::"
if [ "$?" = "0" ]; then
echo -e "\033[32;3mBuilt the msp430_GCC Demo\033[0m"
else
echo -e "\033[32;31mBuilding the msp430_GCC Demo Failed...\033[0m"
exit 1
fi
ARM-GCC:
name: GNU ARM Toolchain
@ -217,52 +345,138 @@ jobs:
- name: Fetch Kernel Submodule
shell: bash
run: git submodule update --checkout --init --depth 1 FreeRTOS/Source
run: |
# Fetch Kernel Submodule
echo "::group::Fetch Kernel Submodule"
git submodule update --checkout --init --depth 1 FreeRTOS/Source
echo "::engdroup::"
if [ "$?" = "0" ]; then
echo -e "\033[32;3mCloned the Kernel\033[0m"
else
echo -e "\033[32;31mKernel Clone Failed...\033[0m"
exit 1
fi
- name: Install GNU ARM Toolchain
shell: bash
run: |
# Install GNU ARM Toolchain
echo "::group::Install GNU ARM Toolchain"
sudo apt-get -y update
sudo apt-get -y install gcc-arm-none-eabi build-essential cmake git ninja-build python3-minimal
echo "::engdroup::"
if [ "$?" = "0" ]; then
echo -e "\033[32;3mInstalled the GNU ARM Toolchain\033[0m"
else
echo -e "\033[32;31mInstalling GNU ARM Toolchain Failed...\033[0m"
exit 1
fi
- name: Build CORTEX_MPU_M3_MPS2_QEMU_GCC Demo
shell: bash
working-directory: FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC
run: make -j
run: |
# Build CORTEX_MPU_M3_MPS2_QEMU_GCC Demo
echo "::group::Build CORTEX_MPU_M3_MPS2_QEMU_GCC Demo"
make -j
echo "::engdroup::"
if [ "$?" = "0" ]; then
echo -e "\033[32;3mBuild CORTEX_MPU_M3_MPS2_QEMU_GCC Demo\033[0m"
else
echo -e "\033[32;31mBuild CORTEX_MPU_M3_MPS2_QEMU_GCC Demo Failed...\033[0m"
exit 1
fi
- name: Build CORTEX_LM3S102_GCC Demo
shell: bash
working-directory: FreeRTOS/Demo/CORTEX_LM3S102_GCC
run: make -j
run: |
# Build CORTEX_LM3S102_GCC Demo
echo "::group::Build CORTEX_LM3S102_GCC Demo"
make -j
echo "::engdroup::"
if [ "$?" = "0" ]; then
echo -e "\033[32;3mBuilt the CORTEX_LM3S102_GCC Demo Kernel\033[0m"
else
echo -e "\033[32;31mBuild CORTEX_LM3S102_GCC Demo Failed...\033[0m"
exit 1
fi
- name: Build CORTEX_M3_MPS2_QEMU_GCC Demo
shell: bash
working-directory: FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC
run: |
# Build CORTEX_M3_MPS2_QEMU_GCC Demo
echo "::group::Build CORTEX_M3_MPS2_QEMU_GCC Demo"
make clean
make -j
- name: Build CORTEX_M3_MPS2_QEMU_GCC Demo
echo "::engdroup::"
if [ "$?" = "0" ]; then
echo -e "\033[32;3mBuilt the CORTEX_M3_MPS2_QEMU_GCC Demo\033[0m"
else
echo -e "\033[32;31mBuild CORTEX_M3_MPS2_QEMU_GCC Demo Failed...\033[0m"
exit 1
fi
- name: Build CORTEX_M3_MPS2_QEMU_GCC Full Demo
shell: bash
working-directory: FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC
run: |
# Build CORTEX_M3_MPS2_QEMU_GCC Full Demo
echo "::group::Build CORTEX_M3_MPS2_QEMU_GCC Full Demo"
make clean
make FULL_DEMO=1 -j
echo "::engdroup::"
if [ "$?" = "0" ]; then
echo -e "\033[32;3mBuilt the CORTEX_M3_MPS2_QEMU_GCC Full Demo\033[0m"
else
echo -e "\033[32;31mBuild CORTEX_M3_MPS2_QEMU_GCC Full Demo Failed...\033[0m"
exit 1
fi
- name: Build CORTEX_LM3S811_GCC Demo
shell: bash
working-directory: FreeRTOS/Demo/CORTEX_LM3S811_GCC
run: make -j
run: |
# Build CORTEX_LM3S811_GCC Demo
echo "::group::Build CORTEX_LM3S811_GCC Demo"
make -j
echo "::engdroup::"
if [ "$?" = "0" ]; then
echo -e "\033[32;3mBuilt the CORTEX_LM3S811_GCC Demo\033[0m"
else
echo -e "\033[32;31mBuild CORTEX_LM3S811_GCC Demo Failed...\033[0m"
exit 1
fi
- name: Build CORTEX_M0+_RP2040 Demos
shell: bash
working-directory: FreeRTOS/Demo/ThirdParty/Community-Supported/CORTEX_M0+_RP2040
run: |
# Build CORTEX_M0+_RP2040 Demos
echo "::group::Build CORTEX_M0+_RP2040 Demos"
git clone https://github.com/raspberrypi/pico-sdk.git
cmake -B build -DPICO_SDK_PATH=pico-sdk -GNinja
ninja -C build --verbose
echo "::engdroup::"
if [ "$?" = "0" ]; then
echo -e "\033[32;3mBuilt CORTEX_M0+_RP2040 Demos\033[0m"
else
echo -e "\033[32;31mBuild CORTEX_M0+_RP2040 Demos Failed...\033[0m"
exit 1
fi
- name: Build CORTEX_MPS2_QEMU_IAR_GCC Demo
shell: bash
working-directory: FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC
run: make -C build/gcc -j
run: |
# Build CORTEX_MPS2_QEMU_IAR_GCC Demo
echo "::group::Build CORTEX_MPS2_QEMU_IAR_GCC Demo"
make -C build/gcc -j
echo "::engdroup::"
if [ "$?" = "0" ]; then
echo -e "\033[32;3mBuilt the CORTEX_MPS2_QEMU_IAR_GCC Demo\033[0m"
else
echo -e "\033[32;31mBuild CORTEX_MPS2_QEMU_IAR_GCC Demo Failed...\033[0m"
exit 1
fi

Loading…
Cancel
Save