Merge pull request #409 from akien-mga/travis-clang-format-8

Travis: Use clang-format 8.0, update script
pull/410/head
Rémi Verschelde 2020-06-02 15:03:19 +02:00 committed by GitHub
commit 1dc8feaeee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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