From da7c1b3498a94d9df283f71a8803b6328785a5aa Mon Sep 17 00:00:00 2001 From: James Price Date: Wed, 15 Apr 2020 17:05:00 -0400 Subject: [PATCH] Use clang-format-9 for Travis CI formatting checks (#736) --- .travis.yml | 5 +++++ check-format.sh | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 39f86eed..98984d8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,12 @@ os: jobs: include: - os: linux + dist: bionic env: JOB_CHECK_FORMAT=1 + addons: + apt: + packages: + - clang-format-9 - os: linux env: JOB_ARCHITECTURE=arm - os: linux diff --git a/check-format.sh b/check-format.sh index 9bfb41a9..509de621 100755 --- a/check-format.sh +++ b/check-format.sh @@ -1,7 +1,10 @@ #!/usr/bin/env bash # Run git-clang-format to check for violations -CLANG_FORMAT_OUTPUT=$(git-clang-format --diff origin/master --extensions c,cpp,h,hpp) +if [ "$TRAVIS" == "true" ]; then + EXTRA_OPTS="--binary `which clang-format-9`" +fi +CLANG_FORMAT_OUTPUT=$(git-clang-format --diff origin/master --extensions c,cpp,h,hpp $EXTRA_OPTS) # Check for no-ops grep '^no modified files to format$' <<<"$CLANG_FORMAT_OUTPUT" && exit 0