forked from p34709852/monkey
101 lines
2.9 KiB
YAML
101 lines
2.9 KiB
YAML
# Infection Monkey travis.yml. See Travis documentation for information about this file structure.
|
|
|
|
# If you change this file, you can validate using Travis CI's Build Config Explorer https://config.travis-ci.com/explore
|
|
|
|
group: travis_latest
|
|
|
|
language: python
|
|
|
|
cache:
|
|
- pip
|
|
- directories:
|
|
- "$HOME/.npm"
|
|
|
|
python:
|
|
- 3.7
|
|
|
|
os: linux
|
|
|
|
before_install:
|
|
# Init server_config.json to default
|
|
- cp monkey/monkey_island/cc/server_config.json.develop monkey/monkey_island/cc/server_config.json
|
|
|
|
install:
|
|
# Python
|
|
- pip freeze
|
|
- pip install -r monkey/monkey_island/requirements.txt # for unit tests
|
|
- pip install black==20.8b1 flake8==3.9.0 pytest pytest-cov isort==5.8.0 # for next stages
|
|
- pip install coverage # for code coverage
|
|
- pip install -r monkey/infection_monkey/requirements.txt # for unit tests
|
|
- pip install pipdeptree
|
|
# Fail builds on possible conflicting dependencies.
|
|
- pipdeptree --warn fail
|
|
|
|
# node + npm + eslint
|
|
- node --version
|
|
- npm --version
|
|
- nvm --version
|
|
- nvm install node
|
|
- nvm use node
|
|
- npm i -g eslint
|
|
- node --version
|
|
- npm --version
|
|
|
|
# linuxbrew (for hugo)
|
|
- git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew
|
|
- mkdir ~/.linuxbrew/bin
|
|
- ln -s ~/.linuxbrew/Homebrew/bin/brew ~/.linuxbrew/bin
|
|
- eval $(~/.linuxbrew/bin/brew shellenv)
|
|
|
|
# hugo (for documentation)
|
|
- brew install hugo
|
|
# print hugo version (useful for debugging documentation build errors)
|
|
- hugo version
|
|
|
|
script:
|
|
# Check Python code
|
|
## Check syntax errors and fail the build if any are found.
|
|
- flake8 .
|
|
|
|
## Check import order
|
|
- python -m isort ./monkey --check-only
|
|
|
|
## Check that all python is properly formatted. Fail otherwise.
|
|
- python -m black --check .
|
|
|
|
## Run unit tests and generate coverage data
|
|
- 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.
|
|
|
|
# Check JS code. The npm install must happen AFTER the flake8 because the node_modules folder will cause a lot of errors.
|
|
- cd monkey_island/cc/ui
|
|
- npm ci # See https://docs.npmjs.com/cli/ci.html
|
|
- eslint ./src --quiet # Test for errors
|
|
- JS_WARNINGS_AMOUNT_UPPER_LIMIT=7
|
|
- eslint ./src --max-warnings $JS_WARNINGS_AMOUNT_UPPER_LIMIT # Test for max warnings
|
|
|
|
# Build documentation
|
|
- cd $TRAVIS_BUILD_DIR/docs
|
|
- hugo --verbose --environment staging
|
|
|
|
# verify swimm
|
|
- cd $TRAVIS_BUILD_DIR
|
|
- curl -s https://api.github.com/repos/swimmio/SwimmReleases/releases/latest | grep 'browser_download_url.*swimm-cli' | cut -d '"' -f 4 | wget -O swimm_cli -qi -
|
|
- chmod +x swimm_cli
|
|
- node swimm_cli --version
|
|
- node swimm_cli verify
|
|
|
|
after_success:
|
|
# Upload code coverage results to codecov.io, see https://github.com/codecov/codecov-bash for more information
|
|
- bash <(curl -s https://codecov.io/bash)
|
|
|
|
notifications:
|
|
slack: # Notify to slack
|
|
rooms:
|
|
- infectionmonkey:QaXbsx4g7tHFJW0lhtiBmoAg#ci # room: #ci
|
|
on_success: change
|
|
on_failure: always
|
|
email:
|
|
on_success: change
|
|
on_failure: always
|