Changed structure - everything is the same job

This commit is contained in:
Shay Nehmad 2019-11-07 16:24:36 +02:00
parent 54fd1d7744
commit c2ba6ce46c
1 changed files with 44 additions and 57 deletions

View File

@ -1,69 +1,56 @@
# Infection Monkey travis.yml. See Travis documentation for information about this file structure. # Infection Monkey travis.yml. See Travis documentation for information about this file structure.
jobs:
include:
# The python job
-
group: travis_latest
language: python group: travis_latest
cache: pip language: python
python: cache: pip
- 3.7
os: linux python:
- 3.7
install: os: linux
- pip install -r monkey/monkey_island/requirements.txt # for unit tests
- pip install flake8 pytest dlint # for next stages
- pip install -r monkey/infection_monkey/requirements_linux.txt # for unit tests
before_script: install:
# Check syntax errors and fail the build if any are found. - pip install -r monkey/monkey_island/requirements.txt # for unit tests
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics - pip install flake8 pytest dlint # for next stages
- pip install -r monkey/infection_monkey/requirements_linux.txt # for unit tests
# Warn about linter issues. before_script:
# --exit-zero forces Flake8 to use the exit status code 0 even if there are errors, which means this will NOT fail the build. # Set the server config to `testing`, for the UTs to use mongomaock and pass.
# --count will print the total number of errors. - python monkey/monkey_island/cc/set_server_config.py testing
# --statistics Count the number of occurrences of each error/warning code and print a report.
# The output is redirected to a file.
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics > flake8_warnings.txt
# Display the linter issues
- cat flake8_warnings.txt
# Make sure that we haven't increased the amount of warnings.
- WARNINGS_AMOUNT_UPPER_LIMIT=190
- if [ $(tail -n 1 flake8_warnings.txt) -gt $WARNINGS_AMOUNT_UPPER_LIMIT ]; then echo "Too many warnings! Failing this build. Lower the amount of linter errors in this and try again. " && exit 1; fi
# Set the server config to `testing`, for the UTs to use mongomaock and pass. script:
- python monkey/monkey_island/cc/set_server_config.py testing # Check Python code
# Check syntax errors and fail the build if any are found.
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
script: # Warn about linter issues.
- cd monkey # This is our source dir # --exit-zero forces Flake8 to use the exit status code 0 even if there are errors, which means this will NOT fail the build.
- python -m pytest # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path. # --count will print the total number of errors.
# --statistics Count the number of occurrences of each error/warning code and print a report.
# The output is redirected to a file.
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics > flake8_warnings.txt
# Display the linter issues
- cat flake8_warnings.txt
# Make sure that we haven't increased the amount of warnings.
- WARNINGS_AMOUNT_UPPER_LIMIT=190
- if [ $(tail -n 1 flake8_warnings.txt) -gt $WARNINGS_AMOUNT_UPPER_LIMIT ]; then echo "Too many warnings! Failing this build. Lower the amount of linter errors in this and try again. " && exit 1; fi
notifications: - cd monkey # This is our source dir
slack: # Notify to slack - python -m pytest # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path.
rooms:
- infectionmonkey:QaXbsx4g7tHFJW0lhtiBmoAg#ci # room: #ci
on_success: change
on_failure: always
email:
on_success: change
on_failure: always
# The JS job # Check JS code
- - cd monkey_island/cc/ui
group: travis_latest - eslint ./src --quiet
language: node_js - eslint ./src --max-warnings 100
cache:
directories: notifications:
- "node_modules" slack: # Notify to slack
sudo: false rooms:
script: - infectionmonkey:QaXbsx4g7tHFJW0lhtiBmoAg#ci # room: #ci
- pwd on_success: change
- cd monkey_island/cc/ui on_failure: always
- pwd email:
- npm i -g eslint on_success: change
- eslint ./src --quiet on_failure: always
- eslint ./src --max-warnings 100