forked from certtools/intelmq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
71 lines (71 loc) · 4.45 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
sudo: required
dist: xenial
language: python
env:
- requirements=true
- requirements=false
python:
- 3.5
- 3.6
- 3.7
- 3.8
matrix:
include:
- python: 3.5
env: mode=debian
- python: 3.8
env: mode=codestyle
before_install:
- if [[ -v requirements ]]; then curl -s -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.1-amd64.deb; fi
- if [[ -v requirements ]]; then sudo dpkg -i --force-confnew elasticsearch-7.6.1-amd64.deb; fi
- if [[ -v requirements ]]; then sudo sed -i.old 's/-Xms1g/-Xms128m/' /etc/elasticsearch/jvm.options; fi
- if [[ -v requirements ]]; then sudo sed -i.old 's/-Xmx1g/-Xmx128m/' /etc/elasticsearch/jvm.options; fi
- if [[ -v requirements ]]; then echo -e '-XX:+DisableExplicitGC\n-Djdk.io.permissionsUseCanonicalPath=true\n-Dlog4j.skipJansi=true\n-server\n' | sudo tee -a /etc/elasticsearch/jvm.options; fi
- if [[ -v requirements ]]; then sudo chown -R elasticsearch:elasticsearch /etc/default/elasticsearch; fi
- if [[ -v requirements ]]; then sudo systemctl start elasticsearch; fi
install:
- set -e
- if [[ -v requirements ]]; then sudo apt-get install polipo lighttpd; fi
- if [[ $mode == debian ]]; then sudo apt-get install dpkg-dev dh-python python-setuptools python3-setuptools python3-all debhelper quilt fakeroot dh-systemd safe-rm; pip3 install requests; pip3 install redis; pip3 install dnspython; pip3 install psutil; pip3 install python-dateutil; pip3 install termstyle; pip3 install pytz; pip3 install typing; fi
- if [[ $requirements == true ]]; then for file in intelmq/bots/*/*/REQUIREMENTS.txt; do pip install -r $file; done; fi
- if [[ -v requirements ]]; then pip install Cerberus!=1.3 codecov pyyaml requests_mock; fi
- if [[ $mode == codestyle ]]; then pip install pycodestyle; fi
- if [[ -v requirements ]]; then sudo sed -i '/^Defaults\tsecure_path.*$/ d' /etc/sudoers; fi
- if [[ -v requirements ]]; then sudo pip install .; fi
- if [[ -v requirements ]]; then sudo intelmqsetup --skip-ownership; fi
before_script:
- if [[ $requirements == true ]] ; then psql -c "CREATE USER intelmq WITH SUPERUSER" -U postgres; fi
- if [[ $requirements == true ]] ; then psql -c "CREATE DATABASE intelmq" -U intelmq template1; fi
- if [[ $requirements == true ]] ; then psql -c "GRANT ALL PRIVILEGES ON DATABASE intelmq TO intelmq" -U intelmq; fi
- if [[ $requirements == true ]] ; then intelmq_psql_initdb; fi
- if [[ $requirements == true ]] ; then sed -i 's/events/tests/g' /tmp/initdb.sql; fi
- if [[ $requirements == true ]] ; then psql -v ON_ERROR_STOP=on -f /tmp/initdb.sql intelmq -U intelmq; fi
- if [[ $mode == debian ]]; then regex="\(([a-z0-9.~-]+)\)" && [[ $(head -n 1 debian/changelog) =~ $regex ]] && debversion=${BASH_REMATCH[1]} && version=${debversion%-?}; fi
- if [[ $mode == debian ]]; then git archive --format=tar.gz HEAD > ../intelmq_$version.orig.tar.gz; fi
- if [[ $mode == debian ]]; then git archive --format=tar.gz --prefix=debian/ HEAD:debian/ > ../intelmq_$debversion.debian.tar.gz; fi
- if [[ $mode == debian ]]; then pushd ..; fi
- if [[ $mode == debian ]]; then mkdir build; fi
- if [[ $mode == debian ]]; then cd build; fi
- if [[ $mode == debian ]]; then tar -xzf ../intelmq_$version.orig.tar.gz; fi
- if [[ $mode == debian ]]; then tar -xzf ../intelmq_$debversion.debian.tar.gz; fi
- if [[ $mode == debian ]]; then popd; fi
- if [[ -v requirements ]]; then sudo cp intelmq/tests/assets/* /var/www/html/ && sudo touch /var/www/html/$(date +%Y).txt; fi
- if [[ $requirements == true ]]; then sudo bash -c 'echo "[rabbitmq_management]." > /etc/rabbitmq/enabled_plugins' && sudo systemctl restart rabbitmq-server; fi
script:
- if [[ $requirements == true ]]; then TZ=utc INTELMQ_TEST_DATABASES=1 INTELMQ_TEST_LOCAL_WEB=1 INTELMQ_TEST_EXOTIC=1 nosetests --with-coverage --cover-package=intelmq --cover-branches; find contrib/ -name "test*.py" -exec nosetests {} \+; elif [[ $requirements == false ]]; then INTELMQ_TEST_LOCAL_WEB=1 nosetests --with-coverage --cover-package=intelmq --cover-branches; fi
- if [[ $mode == codestyle ]]; then pycodestyle intelmq/{bots,lib,bin}; fi
- if [[ $mode == debian ]]; then pushd ../build; fi
- if [[ $mode == debian ]]; then DEB_BUILD_OPTIONS='nocheck' dpkg-buildpackage -us -uc -d; fi
- if [[ $mode == debian ]]; then popd; fi
services:
- redis-server
- postgresql
- mongodb
- rabbitmq
after_success:
- if [[ -v requirements ]]; then codecov; fi
addons:
postgresql: "9.4"
apt:
packages:
- rabbitmq-server