Skip to content

Commit

Permalink
Run black on each commit with travis
Browse files Browse the repository at this point in the history
  • Loading branch information
kinnou02 committed Oct 9, 2018
1 parent 2dab3f9 commit 5aa81ee
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/ambv/black
rev: stable
rev: 18.9b0
hooks:
- id: black
language_version: python3.6
Expand Down
13 changes: 9 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

language: cpp
language: python
python:
- "2.7"
- "3.6"
sudo: required

services:
Expand All @@ -10,13 +13,15 @@ git:
submodules: false

before_install:
- sudo apt update && sudo apt install -y python-pip python-dev protobuf-compiler
- sudo apt update && sudo apt install -y protobuf-compiler
- sed -i 's,git\@github.com:\([^/]*\)/\(.*\).git,https://github.com/\1/\2,' .gitmodules
- git submodule update --init --recursive
- sudo pip install -r source/tyr/requirements_dev.txt
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install -r source/tyr/requirements_dev.txt; fi
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then python3.6 -m pip install black==18.9b0; fi
- bash source/scripts/build_protobuf.sh

script:
# Make sure submodules references are merged in !
- bash source/scripts/check_submodules.sh
- pushd source/tyr && PYTHONPATH=.:../navitiacommon/ py.test && popd
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pushd source/tyr && PYTHONPATH=.:../navitiacommon/ py.test && popd; fi
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then black --check --diff .; fi
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ exclude = '''
| debug
| debian
| source/third_party
)/
| .*_pb2\.py
)
'''

0 comments on commit 5aa81ee

Please sign in to comment.