Added codecov tests to travis yml and updated readme
This commit is contained in:
parent
a716204b0f
commit
bff9cc36b1
27
.travis.yml
27
.travis.yml
|
@ -15,6 +15,7 @@ install:
|
||||||
# Python
|
# Python
|
||||||
- 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 dlint # for next stages
|
- pip install flake8 pytest dlint # for next stages
|
||||||
|
- 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
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
|
@ -23,24 +24,28 @@ before_script:
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# Check Python code
|
# Check Python code
|
||||||
# Check syntax errors and fail the build if any are found.
|
## Check syntax errors and fail the build if any are found.
|
||||||
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
|
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
|
||||||
|
|
||||||
# Warn about linter issues.
|
## Warn about linter issues.
|
||||||
# --exit-zero forces Flake8 to use the exit status code 0 even if there are errors, which means this will NOT fail the build.
|
### --exit-zero forces Flake8 to use the exit status code 0 even if there are errors, which means this will NOT fail the build.
|
||||||
# --count will print the total number of errors.
|
### --count will print the total number of errors.
|
||||||
# --statistics Count the number of occurrences of each error/warning code and print a report.
|
### --statistics Count the number of occurrences of each error/warning code and print a report.
|
||||||
# The output is redirected to a file.
|
### The output is redirected to a file.
|
||||||
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics > flake8_warnings.txt
|
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics > flake8_warnings.txt
|
||||||
# Display the linter issues
|
## Display the linter issues
|
||||||
- cat flake8_warnings.txt
|
- cat flake8_warnings.txt
|
||||||
# Make sure that we haven't increased the amount of warnings.
|
## Make sure that we haven't increased the amount of warnings.
|
||||||
- PYTHON_WARNINGS_AMOUNT_UPPER_LIMIT=190
|
- PYTHON_WARNINGS_AMOUNT_UPPER_LIMIT=190
|
||||||
- if [ $(tail -n 1 flake8_warnings.txt) -gt $PYTHON_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
|
- if [ $(tail -n 1 flake8_warnings.txt) -gt $PYTHON_WARNINGS_AMOUNT_UPPER_LIMIT ]; then echo "Too many python linter warnings! Failing this build. Lower the amount of linter errors in this and try again. " && exit 1; fi
|
||||||
|
|
||||||
|
## Run unit tests
|
||||||
- cd monkey # This is our source dir
|
- cd monkey # This is our source dir
|
||||||
- python -m pytest # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path.
|
- python -m pytest # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path.
|
||||||
|
|
||||||
|
## Calculate Code Coverage
|
||||||
|
- coverage run -m pytest discover
|
||||||
|
|
||||||
# Check JS code. The npm install must happen AFTER the flake8 because the node_modules folder will cause a lot of errors.
|
# 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
|
- cd monkey_island/cc/ui
|
||||||
- npm i
|
- npm i
|
||||||
|
@ -51,6 +56,10 @@ script:
|
||||||
- JS_WARNINGS_AMOUNT_UPPER_LIMIT=37
|
- JS_WARNINGS_AMOUNT_UPPER_LIMIT=37
|
||||||
- eslint ./src --max-warnings $JS_WARNINGS_AMOUNT_UPPER_LIMIT
|
- eslint ./src --max-warnings $JS_WARNINGS_AMOUNT_UPPER_LIMIT
|
||||||
|
|
||||||
|
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
|
||||||
rooms:
|
rooms:
|
||||||
|
|
24
README.md
24
README.md
|
@ -1,6 +1,9 @@
|
||||||
# Infection Monkey
|
# Infection Monkey
|
||||||
[![Build Status](https://travis-ci.com/guardicore/monkey.svg?branch=develop)](https://travis-ci.com/guardicore/monkey)
|
|
||||||
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/guardicore/monkey)](https://github.com/guardicore/monkey/releases)
|
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/guardicore/monkey)](https://github.com/guardicore/monkey/releases)
|
||||||
|
|
||||||
|
[![Build Status](https://travis-ci.com/guardicore/monkey.svg?branch=develop)](https://travis-ci.com/guardicore/monkey)
|
||||||
|
[![codecov](https://codecov.io/gh/guardicore/monkey/branch/master/graph/badge.svg)](https://codecov.io/gh/guardicore/monkey)
|
||||||
|
|
||||||
![GitHub stars](https://img.shields.io/github/stars/guardicore/monkey)
|
![GitHub stars](https://img.shields.io/github/stars/guardicore/monkey)
|
||||||
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/guardicore/monkey)
|
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/guardicore/monkey)
|
||||||
|
|
||||||
|
@ -14,14 +17,15 @@ The Infection Monkey is an open source security tool for testing a data center's
|
||||||
|
|
||||||
<img src=".github/Security-overview.png" width="800" height="500">
|
<img src=".github/Security-overview.png" width="800" height="500">
|
||||||
|
|
||||||
|
|
||||||
The Infection Monkey is comprised of two parts:
|
The Infection Monkey is comprised of two parts:
|
||||||
* Monkey - A tool which infects other machines and propagates to them
|
|
||||||
* Monkey Island - A dedicated server to control and visualize the Infection Monkey's progress inside the data center
|
|
||||||
|
|
||||||
To read more about the Monkey, visit http://infectionmonkey.com
|
* **Monkey** - A tool which infects other machines and propagates to them.
|
||||||
|
* **Monkey Island** - A dedicated server to control and visualize the Infection Monkey's progress inside the data center.
|
||||||
|
|
||||||
|
To read more about the Monkey, visit [infectionmonkey.com](https://infectionmonkey.com).
|
||||||
|
|
||||||
## Main Features
|
## Main Features
|
||||||
|
|
||||||
The Infection Monkey uses the following techniques and exploits to propagate to other machines.
|
The Infection Monkey uses the following techniques and exploits to propagate to other machines.
|
||||||
|
|
||||||
* Multiple propagation techniques:
|
* Multiple propagation techniques:
|
||||||
|
@ -42,13 +46,11 @@ Check out the [Setup](https://github.com/guardicore/monkey/wiki/setup) page in t
|
||||||
|
|
||||||
The Infection Monkey supports a variety of platforms, documented [in the wiki](https://github.com/guardicore/monkey/wiki/OS-compatibility).
|
The Infection Monkey supports a variety of platforms, documented [in the wiki](https://github.com/guardicore/monkey/wiki/OS-compatibility).
|
||||||
|
|
||||||
|
|
||||||
## Building the Monkey from source
|
## Building the Monkey from source
|
||||||
To deploy development version of monkey you should refer to readme in the [deployment scripts](deployment_scripts) folder.
|
To deploy development version of monkey you should refer to readme in the [deployment scripts](deployment_scripts) folder.
|
||||||
If you only want to build the monkey from source, see [Setup](https://github.com/guardicore/monkey/wiki/Setup#compile-it-yourself)
|
If you only want to build the monkey from source, see [Setup](https://github.com/guardicore/monkey/wiki/Setup#compile-it-yourself)
|
||||||
and follow the instructions at the readme files under [infection_monkey](infection_monkey) and [monkey_island](monkey_island).
|
and follow the instructions at the readme files under [infection_monkey](infection_monkey) and [monkey_island](monkey_island).
|
||||||
|
|
||||||
|
|
||||||
### Build status
|
### Build status
|
||||||
| Branch | Status |
|
| Branch | Status |
|
||||||
| ------ | :----: |
|
| ------ | :----: |
|
||||||
|
@ -56,13 +58,21 @@ and follow the instructions at the readme files under [infection_monkey](infecti
|
||||||
| Master | [![Build Status](https://travis-ci.com/guardicore/monkey.svg?branch=master)](https://travis-ci.com/guardicore/monkey) |
|
| Master | [![Build Status](https://travis-ci.com/guardicore/monkey.svg?branch=master)](https://travis-ci.com/guardicore/monkey) |
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
### Unit Tests
|
### Unit Tests
|
||||||
|
|
||||||
In order to run all of the Unit Tests, run the command `python -m pytest` in the `monkey` directory.
|
In order to run all of the Unit Tests, run the command `python -m pytest` in the `monkey` directory.
|
||||||
|
|
||||||
|
To get a coverage report, first make sure the `coverage` package is installed using `pip install coverage`. Run the command
|
||||||
|
`coverage run -m unittest discover` in the `monkey` directory and then `coverage html`. The coverage report can be found in
|
||||||
|
`htmlcov.index`.
|
||||||
|
|
||||||
### Blackbox tests
|
### Blackbox tests
|
||||||
|
|
||||||
In order to run the Blackbox tests, refer to `envs/monkey_zoo/blackbox/README.md`.
|
In order to run the Blackbox tests, refer to `envs/monkey_zoo/blackbox/README.md`.
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
||||||
Copyright (c) Guardicore Ltd
|
Copyright (c) Guardicore Ltd
|
||||||
|
|
||||||
See the [LICENSE](LICENSE) file for license rights and limitations (GPLv3).
|
See the [LICENSE](LICENSE) file for license rights and limitations (GPLv3).
|
||||||
|
|
Loading…
Reference in New Issue