forked from PaddlePaddle/Paddle2ONNX
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configuration for pre-commit and travis CI.
- Loading branch information
Showing
5 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.DS_Store | ||
|
||
*~ | ||
|
||
*.pyc | ||
.pydevproject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
- repo: https://github.com/pre-commit/mirrors-yapf.git | ||
sha: v0.16.0 | ||
hooks: | ||
- id: yapf | ||
files: \.py$ | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
sha: a11d9314b22d8f8c7556443875b731ef05965464 | ||
hooks: | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: detect-private-key | ||
files: (?!.*paddle)^.*$ | ||
- id: end-of-file-fixer | ||
files: \.md$ | ||
- id: trailing-whitespace | ||
files: \.md$ | ||
- repo: https://github.com/Lucas-C/pre-commit-hooks | ||
sha: v1.0.1 | ||
hooks: | ||
- id: forbid-crlf | ||
files: \.md$ | ||
- id: remove-crlf | ||
files: \.md$ | ||
- id: forbid-tabs | ||
files: \.md$ | ||
- id: remove-tabs | ||
files: \.md$ | ||
- repo: local | ||
hooks: | ||
- id: clang-format | ||
name: clang-format | ||
description: Format files with ClangFormat | ||
entry: bash .clang_format.hook -i | ||
language: system | ||
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
language: cpp | ||
cache: ccache | ||
sudo: required | ||
dist: trusty | ||
services: | ||
- docker | ||
os: | ||
- linux | ||
env: | ||
- JOB=PRE_COMMIT | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- git | ||
- python | ||
- python-pip | ||
- python2.7-dev | ||
|
||
before_install: | ||
- sudo pip install -U virtualenv pre-commit pip | ||
- docker pull paddlepaddle/paddle:latest | ||
|
||
script: | ||
- exit_code=0 | ||
- .travis/precommit.sh || exit_code=$(( exit_code | $? )) | ||
- docker run -i --rm -v "$PWD:/py_unittest" paddlepaddle/paddle:latest /bin/bash -c | ||
'cd /py_unittest; sh .travis/unittest.sh' || exit_code=$(( exit_code | $? )) | ||
exit $exit_code | ||
|
||
notifications: | ||
email: | ||
on_success: change | ||
on_failure: always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
abort(){ | ||
echo "Run unittest failed" 1>&2 | ||
echo "Please check your code" 1>&2 | ||
exit 1 | ||
} | ||
|
||
unittest(){ | ||
cd $1 > /dev/null | ||
if [ -f "setup.sh" ]; then | ||
sh setup.sh | ||
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH | ||
fi | ||
if [ $? != 0 ]; then | ||
exit 1 | ||
fi | ||
find . -name 'tests' -type d -print0 | \ | ||
xargs -0 -I{} -n1 bash -c \ | ||
'python -m unittest discover -v -s {}' | ||
cd - > /dev/null | ||
} | ||
|
||
trap 'abort' 0 | ||
set -e | ||
|
||
unittest . | ||
|
||
trap : 0 |