Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

Commit 60a2aaf

Browse files
committed
Install clang-format 3.8 in travis.
1 parent 409c185 commit 60a2aaf

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

.travis.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dist: trusty
66
os:
77
- linux
88
env:
9-
- JOB=PRE_COMMIT
9+
- JOB=pre_commit
1010

1111
addons:
1212
apt:
@@ -15,23 +15,26 @@ addons:
1515
- python
1616
- python-pip
1717
- python2.7-dev
18+
- clang-format-3.8
1819
ssh_known_hosts: 52.76.173.135
1920

2021
before_install:
2122
- sudo pip install -U virtualenv pre-commit pip
2223

2324
script:
24-
- exit_code=0
25-
- .travis/pre_commit.sh || exit_code=$(( exit_code | $? ))
25+
- if [[ "$JOB" == "pre_commit" ]]; then sudo ln -s /usr/bin/clang-format-3.8 /usr/bin/clang-format; fi
26+
- |
27+
function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; }
28+
- |
29+
timeout 600 .travis/${JOB}.sh # 10min timeout
30+
RESULT=$?; if [ $RESULT -eq 0 ] || [ $RESULT -eq 142 ]; then true; else exit 1; fi;
2631
- |
2732
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi;
2833
if [[ "$TRAVIS_BRANCH" != "develop" && ! "$TRAVIS_BRANCH" =~ ^v[[:digit:]]+\.[[:digit:]]+(\.[[:digit:]]+)?(-\S*)?$ ]]; then echo "not develop branch, no deploy"; exit 0; fi;
2934
export DEPLOY_DOCS_SH=https://raw.githubusercontent.com/PaddlePaddle/PaddlePaddle.org/master/scripts/deploy/deploy_docs.sh
3035
export MOBILE_DIR=`pwd`
3136
cd ..
3237
curl $DEPLOY_DOCS_SH | bash -s $CONTENT_DEC_PASSWD $TRAVIS_BRANCH $MOBILE_DIR
33-
exit_code=$(( exit_code | $? ))
34-
exit $exit_code
3538
3639
notifications:
3740
email:

.travis/pre_commit.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
#!/bin/bash
22
function abort(){
3-
echo "Your commit not fit PaddlePaddle code style" 1>&2
4-
echo "Please use pre-commit scripts to auto-format your code" 1>&2
5-
echo "Install pre-commit following 2 steps:" 1>&2
6-
echo "1> pip install pre-commit" 1>&2
7-
echo "2> pre-commit install (under the Mobile repo)" 1>&2
3+
echo "Your change doesn't follow PaddlePaddle's code style" 1>&2
4+
echo "Please use pre-commit to auto-format your code." 1>&2
85
exit 1
96
}
107

@@ -14,6 +11,7 @@ cd `dirname $0`
1411
cd ..
1512
export PATH=/usr/bin:$PATH
1613
pre-commit install
14+
clang-format --version
1715

1816
if ! pre-commit run -a ; then
1917
ls -lh

0 commit comments

Comments
 (0)