travis_tests.sh 955 Bytes
Newer Older
1
2
#!/bin/bash

3
4
5
set -e
set -u

6
7
8
echo "Running setup.py install"
python setup.py install

David Trudgian's avatar
David Trudgian committed
9
10
11
12
echo "Running tests that don't need Clair"
pytest tests/ -v -m "not needs_clair" --cov clair_singularity --cov-report term-missing

if [[ $TRAVIS_PYTHON_VERSION == "3.5"* ]]; then
13
14
15
16
17
18
19
    echo "Python 3.5 - running docker tests with Clair"
    docker pull arminc/clair-db:2017-08-21
    docker run -d --name db arminc/clair-db:2017-08-21
    docker pull arminc/clair-local-scan:v2.0.0
    docker run -p 6060:6060 --link db:postgres -d --name clair arminc/clair-local-scan:v2.0.0
    docker ps
    docker build -t clair_singularity .
20
21
22
23

    # Clear out any old .pyc from the local tests
    find . -name *.pyc -delete

24
25
26
27
28
    docker run -v $TRAVIS_BUILD_DIR:/app --privileged --name clair-singularity --link clair:clair clair_singularity pytest tests/ -v --cov clair_singularity --cov-report term-missing
    if [ $? -eq 0 ]; then
        coveralls -b $TRAVIS_BUILD_DIR
    fi
fi