* Force a fixed required version of clang-format * Update github action to install clang-format 12 instead of 10 * Update GitHub actions agent OS to Ubuntu 20.04 instead of 18.04 * More verbose CI script
39 lines
628 B
Bash
Executable file
39 lines
628 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
source "$(dirname "$BASH_SOURCE")/common.sh"
|
|
|
|
cd "$REPO_ROOT"
|
|
|
|
retval='1'
|
|
|
|
rm -f .clang-format
|
|
cp .clang-format.base .clang-format
|
|
for try in {1..10}; do
|
|
errors="$(clang-format -dump-config 2>&1 >/dev/null)" || :
|
|
if [ -z "${errors}" ]; then
|
|
retval='0'
|
|
|
|
break
|
|
fi
|
|
|
|
errors_line="$(echo "${errors}" | awk '
|
|
/^YAML:/{
|
|
sub(/^YAML:/, "");
|
|
sub(/:.*/, "");
|
|
print;
|
|
exit;
|
|
}
|
|
')"
|
|
|
|
if ! [ "${errors_line}" -gt -1 ] 2>/dev/null; then
|
|
break
|
|
fi
|
|
|
|
rm -f .clang-format.new
|
|
sed "${errors_line} d" .clang-format >.clang-format.new
|
|
mv .clang-format.new .clang-format
|
|
done
|
|
|
|
exit "${retval}"
|