forked from p15670423/monkey
106 lines
2.8 KiB
YAML
106 lines
2.8 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
|
|
|
|
env:
|
|
- PIP_CACHE_DIR=$HOME/.cache/pip PIPENV_CACHE_DIR=$HOME/.cache/pipenv LIBSODIUM_MAKE_ARGS=-j8
|
|
|
|
cache:
|
|
- pip: true
|
|
- npm: true
|
|
- directories:
|
|
- "$HOME/.npm"
|
|
- $PIP_CACHE_DIR
|
|
- $PIPENV_CACHE_DIR
|
|
|
|
python:
|
|
- 3.7
|
|
|
|
os: linux
|
|
vm:
|
|
size: x-large
|
|
|
|
|
|
install:
|
|
# Python
|
|
- nproc
|
|
- pip install pipenv --upgrade
|
|
# Install island and monkey requirements as they are needed by UT's
|
|
- pushd monkey/monkey_island
|
|
- pipenv sync --dev # This installs dependencies from lock
|
|
- popd
|
|
- pushd monkey/infection_monkey
|
|
- pipenv sync --dev # This installs dependencies from lock
|
|
- popd
|
|
|
|
# node + npm + eslint
|
|
- node --version
|
|
- npm --version
|
|
- nvm --version
|
|
- nvm install 16
|
|
- nvm use node
|
|
- npm i -g eslint
|
|
- node --version
|
|
- npm --version
|
|
|
|
# hugo (for documentation)
|
|
- curl -L https://github.com/gohugoio/hugo/releases/download/v0.85.0/hugo_0.85.0_Linux-64bit.tar.gz --output hugo.tar.gz
|
|
# print hugo version (useful for debugging documentation build errors)
|
|
- tar -zxf hugo.tar.gz
|
|
- ./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 .
|
|
|
|
## Check that there is no dead python code
|
|
- python -m vulture .
|
|
|
|
## Run unit tests and generate coverage data
|
|
- cd monkey # This is our source dir
|
|
- pip install pytest-xdist
|
|
- python -m pytest -n auto --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=0
|
|
- 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 -L https://releases.swimm.io/ci/latest/packed-swimm-linux-cli --output swimm-cli
|
|
- chmod u+x swimm-cli
|
|
- ./swimm-cli --version
|
|
- ./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
|