AMD64
no language set
Git
language: ruby
sudo: required
install: skip
script:
- bin/travis-add-source -h
- bin/travis-add-all-sources-locally
- diff -u ubuntu.json <(jq 'sort_by(.alias)' < ubuntu.json)
cea-sec/ivre:.travis.yml@d18425e
# This file is part of IVRE.
# Copyright 2011 - 2021 Pierre LALET <pierre@droids-corp.org>
#
# IVRE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IVRE is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with IVRE. If not, see <http://www.gnu.org/licenses/>.

os: linux
dist: bionic

env:
  # TinyDB
  - DB=tinydb
  # PostgreSQL
  - DB=postgres POSTGRES_VERSION=12
  # MongoDB
  - DB=mongo MONGODB_VERSION=3.2.22
  - DB=mongo MONGODB_VERSION=4.4.2
  # MaxMind (& utils)
  - DB=maxmind
  # Elasticsearch
  - DB=elastic ELASTIC_VERSION=7.10.1
  # Sqlite
  - DB=sqlite

language: python

cache: pip

python:
  - 3.6
  - 3.9

# PhantomJS is supposed to be installed
# (https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-PhantomJS),
# but we need tesseract
addons:
  apt:
    packages:
    - tesseract-ocr
    - tesseract-ocr-osd
    - tesseract-ocr-eng
    - phantomjs

install:
  - source ./.travis/install_${DB}.sh
  # If you are experiencing issues with Rust for *this release only*
  # you may set the environment variable
  # `CRYPTOGRAPHY_DONT_BUILD_RUST=1`.
  - PYVERS=`python -c 'import sys;print("%d%d" % sys.version_info[:2])'`; if [ -f "requirements-$DB-$PYVERS.txt" ]; then CRYPTOGRAPHY_DONT_BUILD_RUST=1 pip install -U $PIP_INSTALL_OPTIONS -r "requirements-$DB-$PYVERS.txt"; else CRYPTOGRAPHY_DONT_BUILD_RUST=1 pip install -U $PIP_INSTALL_OPTIONS -r "requirements-$DB.txt"; fi
  - pip install $PIP_INSTALL_OPTIONS coverage codecov
  - pip install -U $PIP_INSTALL_OPTIONS --no-deps .
  # cleanup
  - mv ivre ivre.bak

# We need MongoDB many MongoDB versions
# https://github.com/travis-ci/travis-ci/issues/2246
#services: mongodb

before_script:
  # display version
  - ivre version
  # init DB
  - test "$DB" = "maxmind" || ivre ipinfo --init < /dev/null || echo "ERROR failed to init passive database."
  - test "$DB" = "maxmind" || ivre scancli --init < /dev/null || echo "ERROR failed to init nmap database."
  - test "$DB" = "maxmind" || ivre view --init < /dev/null || echo "ERROR failed to init view database."
  - test "$DB" != "tinydb" -a "$DB" != "mongo" || ivre flowcli --init < /dev/null || echo "ERROR failed to init flow database."
  - cat .travis/ivre.conf >> ~/.ivre.conf
  - echo "NMAP_SHARE_PATH = '`pwd`/usr/local/nmap/share/nmap'" >> ~/.ivre.conf
  - echo "WIRESHARK_SHARE_PATH = '`pwd`/usr/local/wireshark/share/wireshark'" >> ~/.ivre.conf
  # add wireshark manuf DB
  - mkdir -p usr/local/wireshark/share/wireshark
  - LD_LIBRARY_PATH= wget -q https://raw.githubusercontent.com/wireshark/wireshark/master/manuf -O usr/local/wireshark/share/wireshark/manuf
  - LD_LIBRARY_PATH= wget -q -O - https://github.com/ivre/ivre-test-samples/archive/0951ba6fc0eee158546e04fbce84c560950023d6.tar.gz | tar --transform='s#^ivre-test-samples-[^/]*/*#./#' -zxf -
  # install Zeek & Nmap (.tar files)
  # for some reason, wget on travis-ci won't accept letsencrypt certificate
  - ZEEK_VERSION="3.$((RANDOM % 2))"; echo "ZEEK_VERSION $ZEEK_VERSION"; for archive in tools-travis-ivre zeek-${ZEEK_VERSION}_ubuntu-`awk -F = '/^DISTRIB_RELEASE=/ {print $2}' /etc/lsb-release` nmap-7.60_ubuntu-precise nfdump-1.6.17; do wget -q --no-check-certificate https://ivre.rocks/data/tests/${archive}.tar.bz2 -O - | tar jxf - ; done
  # get GeoIP CSV files -- we are supposed to build them, but that's
  # disabled in Travis since that's too slow
  - mv tests/geoip/GeoLite2-{ASN,City,Country,RegisteredCountry}.dump-IPv4.csv.bz2 `python -c 'from ivre import config; print(config.GEOIP_PATH)'`; bunzip2 "/`python -c 'from ivre import config; print(config.GEOIP_PATH)'`/"GeoLite2-{ASN,City,Country,RegisteredCountry}.dump-IPv4.csv.bz2
  - export PATH="`pwd`/usr/local/zeek/bin:`pwd`/usr/local/nmap/bin:`pwd`/usr/local/nfdump/bin:$PATH"
  - export LD_LIBRARY_PATH="`pwd`/usr/local/zeek/lib:`pwd`/usr/local/nfdump/lib"
  - export ZEEKPATH=".:`pwd`/usr/local/zeek/share/zeek:`pwd`/usr/local/zeek/share/zeek/policy:`pwd`/usr/local/zeek/share/zeek/site"
  # install IVRE's Nmap scripts.
  - cp `python -c "import ivre.config; print(ivre.config.guess_prefix('nmap_scripts'))"`/*.nse `pwd`/usr/local/nmap/share/nmap/scripts/
  - for patch in `python -c "import ivre.config; print(ivre.config.guess_prefix('nmap_scripts'))"`/patches/*; do (cd `pwd`/usr/local/nmap/share/nmap && patch -p0 < $patch); done
  - nmap --script-updatedb
  - test "$DB" != "elastic" || tar jxf ./tests/mongodb_backup/backup_nmap_passive.tar.bz2
  - export ZEEK_SAMPLES=`pwd`/usr/local/zeek/testing
  - ivre --version; echo; zeek --version; echo; nmap --version

script: (test "$DB" != "maxmind" || test "$TRAVIS_PYTHON_VERSION" != 3.9 || (black -t py36 --check ./doc/conf.py ./setup.py ./bin/ivre ./tests/tests.py ./ivre.bak/ && echo "black OK")) && (test "$DB" != "maxmind" || (flake8 --ignore=E402,E501,F401 ./doc/conf.py && flake8 --ignore=E501,W503 ./setup.py ./bin/ivre && flake8 --ignore=E203,E402,E501,W503 ./tests/tests.py && flake8 --ignore=E203,E501,W503 ./ivre.bak/ && echo "flake8 OK")) && (test "$DB" != "maxmind" || test "$TRAVIS_PYTHON_VERSION" != 3.9 || (codespell  --ignore-words=.travis/codespell_ignore `git ls-files | grep -vE '^web/static/(doc|an|bs|d3|jq|lk)/|^data/|\.(png|gif|svg)$'` && echo "codespell OK")) && (test "$DB" != "maxmind" || test "$TRAVIS_PYTHON_VERSION" != 3.9 || (pylint -e all -d abstract-method,arguments-differ,attribute-defined-outside-init,broad-except,duplicate-code,fixme,function-redefined,global-statement,global-variable-undefined,import-error,invalid-name,locally-disabled,missing-docstring,no-absolute-import,no-member,protected-access,raise-missing-from,subprocess-popen-preexec-fn,super-init-not-called,suppressed-message,too-few-public-methods,too-many-ancestors,too-many-arguments,too-many-boolean-expressions,too-many-branches,too-many-instance-attributes,too-many-lines,too-many-locals,too-many-nested-blocks,too-many-public-methods,too-many-return-statements,too-many-statements,unsubscriptable-object,unused-argument,line-too-long,consider-using-with ivre ./doc/conf.py ./setup.py ./bin/ivre && echo "pylint OK")) && cd tests/ && coverage erase && coverage run --parallel-mode tests.py --coverage && coverage combine && coverage report -i

after_success:
  - codecov

after_failure:
  - cat /tmp/webserver.log
Build Config
{
  "os": [
    "linux"
  ],
  "sudo": true,
  "script": [
    "bin/travis-add-source -h",
    "bin/travis-add-all-sources-locally",
    "diff -u ubuntu.json <(jq 'sort_by(.alias)' < ubuntu.json)"
  ],
  "install": [
    "skip"
  ],
  "language": "ruby"
}