From 2e37f05ce68e5ee6c1eb7a0cd1e48236967fb32f Mon Sep 17 00:00:00 2001 From: Zhigao Tong Date: Fri, 20 Aug 2021 09:17:40 +0800 Subject: [PATCH] optimize --- .ci/build.groovy | 2 +- release-centos7/build/build-tiflash-ci.sh | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.ci/build.groovy b/.ci/build.groovy index 139dec9317f..a40620c5838 100644 --- a/.ci/build.groovy +++ b/.ci/build.groovy @@ -43,7 +43,7 @@ catchError { stage("Build & Upload") { timeout(time: 70, unit: 'MINUTES') { container("builder") { - sh "NPROC=5 BUILD_BRANCH=${ghprbTargetBranch} release-centos7/build/build-tiflash-ci.sh" + sh "NPROC=5 BUILD_BRANCH=${ghprbTargetBranch} ENABLE_FORMAT_CHECK=true release-centos7/build/build-tiflash-ci.sh" sh "PULL_ID=${ghprbPullId} COMMIT_HASH=${ghprbActualCommit} release-centos7/build/upload-ci-build.sh" } } diff --git a/release-centos7/build/build-tiflash-ci.sh b/release-centos7/build/build-tiflash-ci.sh index fd92cd2f9f6..548e22e3f18 100755 --- a/release-centos7/build/build-tiflash-ci.sh +++ b/release-centos7/build/build-tiflash-ci.sh @@ -9,6 +9,14 @@ else echo "ccache has been installed" fi +command -v clang-format > /dev/null 2>&1 +if [[ $? != 0 ]]; then + curl -o "/usr/local/bin/clang-format" http://fileserver.pingcap.net/download/builds/pingcap/tiflash/ci-cache/clang-format + chmod +x "/usr/local/bin/clang-format" +else + echo "clang-format has been installed" +fi + set -ueox pipefail SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" @@ -16,11 +24,9 @@ SRCPATH=${1:-$(cd $SCRIPTPATH/../..; pwd -P)} CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug} BUILD_BRANCH=${BUILD_BRANCH:-master} -ENABLE_FORMAT_CHECK=${ENABLE_FORMAT_CHECK:-true} +ENABLE_FORMAT_CHECK=${ENABLE_FORMAT_CHECK:-false} -curl -o "/usr/local/bin/clang-format" http://fileserver.pingcap.net/download/builds/pingcap/tiflash/ci-cache/clang-format -chmod +x "/usr/local/bin/clang-format" -if [[ "${CMAKE_BUILD_TYPE}" == "Debug" && "${ENABLE_FORMAT_CHECK}" == "true" ]]; then +if [[ "${ENABLE_FORMAT_CHECK}" == "true" ]]; then python3 ${SRCPATH}/format-diff.py --repo_path "${SRCPATH}" --check_formatted --diff_from `git merge-base origin/${BUILD_BRANCH} HEAD` export ENABLE_FORMAT_CHECK=false fi