Travis: Use clang-format 8.0, update script

Cf. https://github.com/godotengine/godot/pull/36350
pull/409/head
Rémi Verschelde 2020-06-02 14:33:10 +02:00
parent 165f1f30e8
commit eedda8beec
2 changed files with 17 additions and 10 deletions

View File

@ -19,10 +19,9 @@ matrix:
env: TARGET=debug STATIC_CHECKS=yes
addons:
apt:
sources:
- llvm-toolchain-xenial-6.0
packages:
[scons, pkg-config, build-essential, p7zip-full, clang-format-6.0]
- clang-format-8
- [scons, pkg-config, build-essential, p7zip-full]
- name: Linux Release
os: linux
@ -30,7 +29,7 @@ matrix:
addons:
apt:
packages:
[scons, pkg-config, build-essential, p7zip-full]
- [scons, pkg-config, build-essential, p7zip-full]
env: TARGET=release
- name: macOS Debug

View File

@ -1,17 +1,25 @@
#!/bin/sh
CLANG_FORMAT=clang-format-6.0
CLANG_FORMAT=clang-format-8
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
# Check the whole commit range against $TRAVIS_BRANCH, the base merge branch
# We could use $TRAVIS_COMMIT_RANGE but it doesn't play well with force pushes
RANGE="$(git rev-parse $TRAVIS_BRANCH) HEAD"
# Travis only clones the PR branch and uses its HEAD commit as detached HEAD,
# so it's problematic when we want an exact commit range for format checks.
# We fetch upstream to ensure that we have the proper references to resolve.
# Ideally we would use $TRAVIS_COMMIT_RANGE but it doesn't play well with PR
# updates, as it only includes changes since the previous state of the PR.
if [ -z "$(git remote | grep upstream)" ]; then
git remote add upstream https://github.com/godotengine/godot-cpp \
--no-tags -f -t $TRAVIS_BRANCH
fi
RANGE="upstream/$TRAVIS_BRANCH HEAD"
else
# Test only the last commit
# Test only the last commit, since $TRAVIS_COMMIT_RANGE wouldn't support
# force pushes.
RANGE=HEAD
fi
FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/ | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc|java|glsl)$")
FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc|java|glsl)$")
echo "Checking files:\n$FILES"
# create a random filename to store our generated patch