mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-22 17:35:55 +03:00
a33c7d23d6
Previously we were running clang-format across multiple operating system versions and hence clang versions, and it turns out clang has changed the preferred formatting multiple times. We could *probably* dig in and try to pin things more strongly but eh...for now let's arbitrarily just use whatever's in the default GH Action ubuntu-latest runner as that should be equally painful for everyone. Signed-off-by: Colin Walters <walters@verbum.org>
21 lines
629 B
Bash
Executable File
21 lines
629 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Tests that validate structure of the source code;
|
|
# can be run without building it.
|
|
set -euo pipefail
|
|
|
|
clang_ver=$(clang-format --version)
|
|
clang_min_ver=15
|
|
version_re=" version ([0-9]+)."
|
|
if [[ $clang_ver =~ $version_re ]]; then
|
|
if test "${BASH_REMATCH[1]}" -ge "${clang_min_ver}"; then
|
|
echo -n "checking clang-format... "
|
|
git ls-files '**.c' '**.cxx' '**.h' '**.hpp' | xargs clang-format --Werror --dry-run
|
|
echo "ok"
|
|
else
|
|
echo "notice: clang-format ${clang_ver}" is too old
|
|
fi
|
|
else
|
|
echo "failed to parse clang-format version ${clang_ver}" 1>&2
|
|
exit 1
|
|
fi
|