-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
159 lines (147 loc) · 5.07 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
148
149
150
151
152
153
154
155
156
157
158
159
language: php
php:
- 5.6
- 7.0
- 7.1
- nightly
services:
- redis
sudo: required
dist: trusty
group: edge
addons:
mariadb:
- '10.0'
hosts:
- misp.local
- localhost
apt:
packages:
- python3-dev
- python3-pip
- libxml2-dev
- zlib1g-dev
- apache2
- curl
- php5-mysql
- php5-dev
- php5-cli
- libapache2-mod-php5
before_install:
- git config --global user.name "TravisCI"
install:
- sudo apt-get install python3-pip python3-nose
- git pull --recurse-submodules && git submodule update
- pip3 install --user pip -U
- pip3 install --user pyzmq
- pip3 install --user coveralls
- pip3 install --user codecov
- pip3 install --user git+https://github.com/CybOXProject/python-cybox.git@v2.1.0.12#egg=Package
- pip3 install --user git+https://github.com/stixproject/python-stix.git@v1.2.0.0#egg=Package
- pip3 install --user git+https://github.com/MISP/PyMISP.git#egg=Package
- phpenv rehash
- pushd app
- composer install
- popd
- phpenv config-add travis/myphpconfig.ini
- cp -fa INSTALL/setup/config.php app/Plugin/CakeResque/Config/config.php
# Set perms
- sudo chown -R www-data:www-data `pwd`
- sudo chmod -R 755 `pwd`
- sudo chmod -R g+ws `pwd`/app/tmp
- sudo chmod -R g+ws `pwd`/app/tmp/cache
- sudo chmod -R g+ws `pwd`/app/tmp/cache/persistent
- sudo chmod -R g+ws `pwd`/app/tmp/cache/models
- sudo chmod -R g+ws `pwd`/app/tmp/logs
- sudo chmod -R g+ws `pwd`/app/files
- sudo chmod -R g+ws `pwd`/app/files/scripts/tmp
# Resque perms
- sudo chown -R www-data:www-data `pwd`/app/Plugin/CakeResque/tmp
- sudo chmod -R 755 `pwd`/app/Plugin/CakeResque/tmp
# install MySQL
- sudo chmod -R 777 `pwd`/INSTALL
- mysql -u root -e 'create database misp;'
- mysql -u root -e "grant usage on *.* to misp@localhost identified by 'blah'";
- mysql -u root -e "grant all privileges on misp.* to misp@localhost;"
- mysql -u misp -pblah misp < INSTALL/MYSQL.sql
# configure apache virtual hosts
- sudo chmod -R 777 `pwd`/build
- sudo cp -f build/travis-ci-apache /etc/apache2/sites-available/misp.local.conf
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/misp.local.conf
- sudo a2dissite 000-default
- sudo a2ensite misp.local.conf
- sudo a2enmod rewrite
- sudo service apache2 restart
# MISP configuration
- sudo chmod -R 777 `pwd`/travis
- sudo cp travis/bootstrap.php app/Config/bootstrap.php
- sudo cp travis/database.php app/Config/database.php
- sudo cp travis/core.php app/Config/core.php
- sudo cp travis/config.php app/Config/config.php
# Ensure the perms
- sudo chown -R www-data:www-data `pwd`/app/Config
- sudo chmod -R 750 `pwd`/app/Config
# GPG setup
- sudo mkdir `pwd`/.gnupg
# /!\ VERY INSECURE BUT FASTER ON THE BUILD ENV OF TRAVIS
- sudo cp -a /dev/urandom /dev/random
- sudo gpg --homedir `pwd`/.gnupg --gen-key --batch `pwd`/travis/gpg
- sudo chown www-data:www-data `pwd`/.gnupg
- sudo chmod 700 `pwd`/.gnupg
# Get authkey
- sudo usermod -a -G www-data $USER
- sudo -E su $USER -c 'app/Console/cake userInit -q | sudo tee ./key.txt'
- sudo chmod 777 ./key.txt
- sudo chmod -R 777 ./tests
- sudo chown -R www-data:www-data `pwd`
- sudo chmod +x /home/travis/build
- sudo chmod +x /home/travis
- sudo chmod +x /home
before_script:
- curl http://misp.local
- AUTH=`cat key.txt`
- sudo chmod -R 777 PyMISP
- pushd PyMISP
- echo 'url = "http://misp.local"' >> tests/keys.py
- echo 'key = "'${AUTH}'"' >> tests/keys.py
- cat tests/keys.py
- popd
script:
- pushd tests
- ./curl_tests.sh $AUTH
- popd
- pushd PyMISP
- pip3 install --user -U nose
- pip3 install --user coveralls
- pip3 install --user codecov
- pip3 install --user requests-mock
- pip3 install --user .
- nosetests --with-coverage --cover-package=pymisp tests/test_offline.py
- python3 tests/test.py
- popd
- cp PyMISP/tests/keys.py PyMISP/examples/events/
- pushd PyMISP/examples/events/
- python3 ./create_massive_dummy_events.py -l 5 -a 30
- popd
after_failure:
- curl http://misp.local
- cat /etc/apache2/sites-available/misp.local.conf
- sudo ls -l /var/log/apache2
- sudo cat `pwd`/app/tmp/logs/error.log
- sudo cat `pwd`/app/tmp/logs/debug.log
- sudo cat /var/log/apache2/error.log
- sudo cat /var/log/apache2/misp.local_error.log
- sudo cat /var/log/apache2/misp.local_access.log
- pwd
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/05e30284086a8e948d31
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # options: [always|never|change] default: always
after_success:
- coveralls
- coverage report
- coverage xml
- codecov