-
Notifications
You must be signed in to change notification settings - Fork 793
/
.travis.yml
147 lines (127 loc) · 5.32 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# 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
branches:
only:
- develop
- master
- fix-travis
jobs:
include:
- name: "Monkey Linux"
language: python
python:
- 3.11
os: linux
dist: focal
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
install:
# Python
- nproc
- pip install pip --upgrade
- pipenv --version
# Install island and monkey requirements as they are needed by UT's
- pushd monkey/agent_plugins
- find . -name 'Pipfile' -execdir pipenv sync --dev \;
- popd
- 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 20
- nvm use node
- npm -g i eslint-cli
- 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
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
- python -m pytest -n auto --dist worksteal --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
# check NextJS code.
- cd ../next_ui
- npm ci # see https://docs.npmjs.com/cli/ci.html
- npm run build # tests for typescript errors and makes sure the code can be built
- npm run lint
# Run unit tests
- npm test
# build documentation
- cd $TRAVIS_BUILD_DIR/docs
- ../hugo --verbose --environment staging
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)
- name: "Monkey Windows"
language: bash
os: windows
before_install:
- choco install python --version=3.11
- python -m pip install -U pip setuptools virtualenv
- python -m virtualenv $HOME/venv
- source $HOME/venv/Scripts/activate
env:
PATH=/c/Python311:/c/Python311/Scripts:$PATH
cache:
pip: true
directories:
- $LOCALAPPDATA/pip/Cache
- $LOCALAPPDATA/pipenv/Cache
install:
# Python
- nproc
- pip install pipenv
# Install island and monkey requirements as they are needed by UT's
- pushd monkey/agent_plugins
- find . -name 'Pipfile' -execdir pipenv sync --dev \;
- popd
- 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
script:
## run unit tests and generate coverage data
- cd monkey # this is our source dir
- python -m pytest -n auto --dist worksteal
notifications:
slack: # Notify to slack
rooms:
- secure: "Qd3uu9YiaLXnZJsBWEyt/n0jLKuC8ULjllY8i09ZejQ2mR9XWWu+lqMNUd6h+T2ukSao0+Hgvuz2CKmTJtKla0HFMsc3r/V65XXAaMINVoek7+rZFzuqTC0jcUYX0jyxjExaJoFfz1ue2JZTHJLPNvLcnuwP3xxXscxrgppki8MO28T17aIbnxNA/hUpb5byW1BTF30z9raUe/Z/Z02cUrqNFkrEHKnsg7QRJkO5wp8eh8ZYYytd7vtZoiZjlTPLh5yTmUTL4MW2Fet2+x6UBCYqcVSG2rOlh69aVtVpg4YAB7YJABb28ZXu1VG7W+1qiCZA1Ol8G2GzU3dNB+pG8Zvk0dfQ56QdK6LX55tW3biTB6dyknyMp1ZCqbsh4GeOQ3RW8O24PZ/jwIV8Y2fSzSylgWnZd58gMnhDgmQFZbGJSWUvkUFoAFdf/E/XyXS4cKe0RyQfdRGVCHdQ2HfeGqSHt2D905KjQb/Sc2y199hRFZJ3eq6bSeOt4sKJpD0eMQKQMO9NSxNP59lHAMlFfQSNx1qPr/zQ3n2NvXPjhS7aEcnkhSgT5FmeUTB3vWILGyHYS1OdASDBGCsG/bxtUmgVUers7XSltwnjjAqbew7aER9b/flX6SAsbSowKXNDVL85HbWwvzQ0XC9I0aBBdzKESXfUktCzxyLiF/Ddb1s="
on_success: change
on_failure: always
email:
on_success: change
on_failure: always