Skip to content

Commit

Permalink
Merge pull request PaddlePaddle#20 from lcy-seso/add_travis_config
Browse files Browse the repository at this point in the history
add travis config.
  • Loading branch information
lcy-seso committed May 3, 2017
2 parents 7629cf6 + c9f3edf commit 367e123
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
language: cpp
cache: ccache
sudo: required
dist: trusty
os:
- linux
env:
- JOB=PRE_COMMIT

addons:
apt:
packages:
- git
- python
- python-pip
- python2.7-dev
before_install:
- pip install -U virtualenv pre-commit pip
script:
- .travis/precommit.sh
notifications:
email:
on_success: change
on_failure: always
21 changes: 21 additions & 0 deletions .travis/precommit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
function abort(){
echo "Your commit not fit PaddlePaddle code style" 1>&2
echo "Please use pre-commit scripts to auto-format your code" 1>&2
exit 1
}

trap 'abort' 0
set -e
cd `dirname $0`
cd ..
export PATH=/usr/bin:$PATH
pre-commit install

if ! pre-commit run -a ; then
ls -lh
git diff --exit-code
exit 1
fi

trap : 0

0 comments on commit 367e123

Please sign in to comment.