ci: fail the build if code is not formatted with black

This commit is contained in:
Mike Salvatore 2021-04-01 12:50:49 -04:00
parent c7a241e776
commit d0e1239b27
1 changed files with 4 additions and 1 deletions

View File

@ -24,7 +24,7 @@ install:
# Python # Python
- pip freeze - pip freeze
- pip install -r monkey/monkey_island/requirements.txt # for unit tests - pip install -r monkey/monkey_island/requirements.txt # for unit tests
- pip install flake8 pytest pytest-cov isort # for next stages - pip install black flake8 pytest pytest-cov isort # for next stages
- pip install coverage # for code coverage - pip install coverage # for code coverage
- pip install -r monkey/infection_monkey/requirements.txt # for unit tests - pip install -r monkey/infection_monkey/requirements.txt # for unit tests
- pip install pipdeptree - pip install pipdeptree
@ -60,6 +60,9 @@ script:
## Check import order ## Check import order
- python -m isort ./monkey --settings-file ./ci_scripts/isort.cfg - python -m isort ./monkey --settings-file ./ci_scripts/isort.cfg
## Check that all python is properly formatted. Fail otherwise.
- python -m black --check .
## Run unit tests and generate coverage data ## Run unit tests and generate coverage data
- cd monkey # This is our source dir - cd monkey # This is our source dir
- python -m pytest --cov=. # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path. - python -m pytest --cov=. # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path.