Skip to content

Enable Debug Builds (#364) #306

Enable Debug Builds (#364)

Enable Debug Builds (#364) #306

Workflow file for this run

name: Check Code Formatting
on:
pull_request:
paths:
- '**.c'
- '**.h'
- '**.cpp'
- '**.hpp'
push:
branches:
- master
paths:
- '**.c'
- '**.h'
- '**.cpp'
- '**.hpp'
jobs:
clang-format:
name: clang-format
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
- name: Run clang-format
shell: bash
working-directory: ${{ github.workspace }}
run: |
cf_vers=14
echo -n "Checking coding style with clang-format ${cf_vers}..."
fail=0
while read -r i; do
if ! clang-format-${cf_vers} --Werror --dry-run "${i}" > /dev/null 2>&1;
then
if [ "${fail}" == "0" ]; then
echo "[FAIL]"
echo "::group::Required Fix-up Commands"
fi
fail=1
msg="::warning file=${i}::Please run clang-format-${cf_vers} "
msg+="-i ${i}"
echo "${msg}"
fi
done < <(find NFIQ2 \( -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" \) -a \! -path '*wsq*' \
-a \! -name 'RandomForestTrainedParams.h')
if [ "${fail}" == "1" ]; then
echo "::endgroup::"
msg="Please run the above files through clang-format ${cf_vers} "
msg+="using the .clang-format configuration and push your changes "
msg+="to the same branch. See CONTRIBUTING.md for more information."
echo "::error ::${msg}"
exit 1
else
echo "[OKAY]"
fi