forked from p34709852/monkey
parent
77702fcfbd
commit
f9c4112c21
180
.travis.yml
180
.travis.yml
|
@ -4,95 +4,131 @@
|
||||||
|
|
||||||
group: travis_latest
|
group: travis_latest
|
||||||
|
|
||||||
language: python
|
jobs:
|
||||||
|
include:
|
||||||
|
- name: "Monkey Linux"
|
||||||
|
language: python
|
||||||
|
python:
|
||||||
|
- 3.7
|
||||||
|
os: linux
|
||||||
|
vm:
|
||||||
|
size: x-large
|
||||||
|
env:
|
||||||
|
- PIP_CACHE_DIR=$HOME/.cache/pip PIPENV_CACHE_DIR=$HOME/.cache/pipenv LIBSODIUM_MAKE_ARGS=-j8
|
||||||
|
|
||||||
env:
|
cache:
|
||||||
- PIP_CACHE_DIR=$HOME/.cache/pip PIPENV_CACHE_DIR=$HOME/.cache/pipenv LIBSODIUM_MAKE_ARGS=-j8
|
- pip: true
|
||||||
|
- npm: true
|
||||||
|
- directories:
|
||||||
|
- "$HOME/.npm"
|
||||||
|
- $PIP_CACHE_DIR
|
||||||
|
- $PIPENV_CACHE_DIR
|
||||||
|
|
||||||
cache:
|
install:
|
||||||
- pip: true
|
# Python
|
||||||
- npm: true
|
- nproc
|
||||||
- directories:
|
- pip install pipenv --upgrade
|
||||||
- "$HOME/.npm"
|
|
||||||
- $PIP_CACHE_DIR
|
|
||||||
- $PIPENV_CACHE_DIR
|
|
||||||
|
|
||||||
python:
|
# Install island and monkey requirements as they are needed by UT's
|
||||||
- 3.7
|
- 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
|
||||||
|
|
||||||
os: linux
|
# node + npm + eslint
|
||||||
vm:
|
- node --version
|
||||||
size: x-large
|
- 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.92.0/hugo_0.92.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
|
||||||
|
|
||||||
install:
|
script:
|
||||||
# Python
|
# check python code
|
||||||
- nproc
|
## check syntax errors and fail the build if any are found.
|
||||||
- pip install pipenv --upgrade
|
- flake8 .
|
||||||
# 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
|
## check import order
|
||||||
- node --version
|
- python -m isort ./monkey --check-only
|
||||||
- npm --version
|
|
||||||
- nvm --version
|
|
||||||
- nvm install 16
|
|
||||||
- nvm use node
|
|
||||||
- npm i -g eslint
|
|
||||||
- node --version
|
|
||||||
- npm --version
|
|
||||||
|
|
||||||
# hugo (for documentation)
|
## check that all python is properly formatted. fail otherwise.
|
||||||
- curl -L https://github.com/gohugoio/hugo/releases/download/v0.92.0/hugo_0.92.0_Linux-64bit.tar.gz --output hugo.tar.gz
|
- python -m black --check .
|
||||||
# print hugo version (useful for debugging documentation build errors)
|
|
||||||
- tar -zxf hugo.tar.gz
|
|
||||||
- ./hugo version
|
|
||||||
|
|
||||||
script:
|
## check that there is no dead python code
|
||||||
# Check Python code
|
- python -m vulture .
|
||||||
## Check syntax errors and fail the build if any are found.
|
|
||||||
- flake8 .
|
|
||||||
|
|
||||||
## Check import order
|
## run unit tests and generate coverage data
|
||||||
- python -m isort ./monkey --check-only
|
- 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 that all python is properly formatted. Fail otherwise.
|
# check js code. the npm install must happen after the flake8 because the node_modules folder will cause a lot of errors.
|
||||||
- python -m black --check .
|
- 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
|
||||||
|
|
||||||
## Check that there is no dead python code
|
# build documentation
|
||||||
- python -m vulture .
|
- cd $TRAVIS_BUILD_DIR/docs
|
||||||
|
- ../hugo --verbose --environment staging
|
||||||
|
|
||||||
## Run unit tests and generate coverage data
|
# verify swimm
|
||||||
- cd monkey # This is our source dir
|
- cd $TRAVIS_BUILD_DIR
|
||||||
- pip install pytest-xdist
|
- curl -l https://releases.swimm.io/ci/latest/packed-swimm-linux-cli --output swimm-cli
|
||||||
- python -m pytest -n auto --cov=. # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path.
|
- chmod u+x swimm-cli
|
||||||
|
- ./swimm-cli --version
|
||||||
|
- ./swimm-cli verify
|
||||||
|
|
||||||
# Check JS code. The npm install must happen AFTER the flake8 because the node_modules folder will cause a lot of errors.
|
after_success:
|
||||||
- cd monkey_island/cc/ui
|
# Upload code coverage results to codecov.io, see https://github.com/codecov/codecov-bash for more information
|
||||||
- npm ci # See https://docs.npmjs.com/cli/ci.html
|
- bash <(curl -s https://codecov.io/bash)
|
||||||
- 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
|
- name: "Monkey Windows"
|
||||||
- cd $TRAVIS_BUILD_DIR/docs
|
language: bash
|
||||||
- ../hugo --verbose --environment staging
|
os: windows
|
||||||
|
vm:
|
||||||
|
size: x-large
|
||||||
|
before_install:
|
||||||
|
- choco install python --version=3.7.7
|
||||||
|
- python -m pip install -U pip setuptools virtualenv
|
||||||
|
- python -m virtualenv $HOME/venv
|
||||||
|
- source $HOME/venv/Scripts/activate
|
||||||
|
env:
|
||||||
|
PATH=/c/Python37:/c/Python37/Scripts:$PATH
|
||||||
|
cache:
|
||||||
|
pip: true
|
||||||
|
directories:
|
||||||
|
- $LOCALAPPDATA/pip/Cache
|
||||||
|
- $LOCALAPPDATA/pipenv/Cache
|
||||||
|
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
|
||||||
|
|
||||||
# verify swimm
|
script:
|
||||||
- cd $TRAVIS_BUILD_DIR
|
## run unit tests and generate coverage data
|
||||||
- curl -L https://releases.swimm.io/ci/latest/packed-swimm-linux-cli --output swimm-cli
|
- cd monkey # this is our source dir
|
||||||
- chmod u+x swimm-cli
|
- pip install pytest-xdist
|
||||||
- ./swimm-cli --version
|
- python -m pytest -n auto
|
||||||
- ./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:
|
notifications:
|
||||||
slack: # Notify to slack
|
slack: # Notify to slack
|
||||||
|
|
Loading…
Reference in New Issue