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

Commit 887aebd

Browse files
authored
Add PRE_COMMIT job on travis. (#60)
* Add PRE_COMMIT job on travis. * Update the main README to triger the travis-ci.
1 parent 925c440 commit 887aebd

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ dist: trusty
55

66
os:
77
- linux
8+
env:
9+
- JOB=PRE_COMMIT
810

911
addons:
1012
apt:
@@ -15,14 +17,22 @@ addons:
1517
- python2.7-dev
1618
ssh_known_hosts: 52.76.173.135
1719

20+
before_install:
21+
- sudo pip install -U virtualenv pre-commit pip
22+
1823
script:
24+
- exit_code=0
25+
- .travis/pre_commit.sh || exit_code=$(( exit_code | $? ))
1926
- |
2027
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi;
2128
if [[ "$TRAVIS_BRANCH" != "develop" && ! "$TRAVIS_BRANCH" =~ ^v[[:digit:]]+\.[[:digit:]]+(\.[[:digit:]]+)?(-\S*)?$ ]]; then echo "not develop branch, no deploy"; exit 0; fi;
2229
export DEPLOY_DOCS_SH=https://raw.githubusercontent.com/PaddlePaddle/PaddlePaddle.org/master/scripts/deploy/deploy_docs.sh
2330
export MOBILE_DIR=`pwd`
2431
cd ..
2532
curl $DEPLOY_DOCS_SH | bash -s $CONTENT_DEC_PASSWD $TRAVIS_BRANCH $MOBILE_DIR
33+
exit_code=$(( exit_code | $? ))
34+
exit $exit_code
35+
2636
notifications:
2737
email:
2838
on_success: change

.travis/pre_commit.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
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
8+
exit 1
9+
}
10+
11+
trap 'abort' 0
12+
set -e
13+
cd `dirname $0`
14+
cd ..
15+
export PATH=/usr/bin:$PATH
16+
pre-commit install
17+
18+
if ! pre-commit run -a ; then
19+
ls -lh
20+
git diff --exit-code
21+
exit 1
22+
fi
23+
24+
trap : 0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Here mainly describes how to deploy PaddlePaddle to the mobile end, as well as s
1010
- [How to build PaddlePaddle mobile inference library with minimum size.](./deployment/library/build_for_minimum_size.md)
1111

1212
## Demo
13-
- [An inference demo program based on the Paddle C API.](./benchmark/tool/C/README.md)
13+
- [A command-line inference demo.](./benchmark/tool/C/README.md)
1414
- [iOS demo of AICamera](./Demo/iOS/AICamera/README.md)
1515

1616
## Deployment optimization methods

0 commit comments

Comments
 (0)