From c9f3edfe4db85e1814f9fd4dc8215186333ea040 Mon Sep 17 00:00:00 2001 From: caoying03 Date: Wed, 3 May 2017 10:54:36 +0800 Subject: [PATCH] add travis configuration. --- .travis.yml | 24 ++++++++++++++++++++++++ .travis/precommit.sh | 21 +++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .travis.yml create mode 100755 .travis/precommit.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..42c07b39 --- /dev/null +++ b/.travis.yml @@ -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 diff --git a/.travis/precommit.sh b/.travis/precommit.sh new file mode 100755 index 00000000..bcbfb2bb --- /dev/null +++ b/.travis/precommit.sh @@ -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 -- GitLab