-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.travis.yml
92 lines (89 loc) · 3.06 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
language: python
matrix:
include:
- python: 2.7
env:
- TO_TEST=CONDA
- ENV_BRANCH=master
- CARD=broadstreet-v2.0.1.tar.gz
- python: 2.7
env: TO_TEST=DOCKER
- python: 2.7
env: TO_TEST=BASH
sudo: required
services:
- docker
before_install:
- sudo apt-get update
# Check Python version.
- python --version
# Turn off O_NONBLOCK. See https://github.com/travis-ci/travis-ci/issues/4704#issuecomment-348435959
- python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);'
# Increase workers for NODE DNS resolution. https://stackoverflow.com/questions/35387264/node-js-request-module-getting-etimedout-and-esockettimedout
- export UV_THREADPOOL_SIZE=16
#### miniconda install:
- if [ "$TO_TEST" = "CONDA" ]; then
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
bash miniconda.sh -b -p $HOME/miniconda;
export PATH="$HOME/miniconda/bin:$PATH";
hash -r;
conda config --set always_yes yes --set changeps1 no;
conda config --add channels bioconda;
conda config --add channels conda-forge;
conda update -q conda;
conda info -a;
fi
- if [ "$TO_TEST" = "DOCKER" ]; then
docker-compose up -d;
docker ps -a;
docker-compose logs webserver;
ls;
fi
install:
- if [ "$TO_TEST" = "CONDA" ] || [ "$TO_TEST" = "DOCKER" ]; then
cd app/;
fi
#### Recreate our Conda env for testing
- if [ "$TO_TEST" = "CONDA" ]; then
wget https://raw.githubusercontent.com/superphy/docker-flask-conda/$ENV_BRANCH/app/environment.yml;
conda env create -q -f environment.yml -n backend;
source activate backend;
wget https://raw.githubusercontent.com/superphy/docker-flask-conda/webserver/app/environment.yml -O environment-webserver.yml;
conda env update -q -f environment-webserver.yml;
wget https://raw.githubusercontent.com/superphy/docker-flask-conda/$ENV_BRANCH/app/requirements.txt;
pip install -r requirements.txt;
fi
# Additional setup for conda.
- if [ "$TO_TEST" = "CONDA" ]; then
wget https://card.mcmaster.ca/download/0/$CARD;
tar -xf $CARD;
rgi load --afile card.json;
fi
# Install pytest and any additional requirements for tests.
- if [ "$TO_TEST" = "CONDA" ] || [ "$TO_TEST" = "DOCKER" ]; then
pip install pytest;
pip install -r tests/test_requirements.txt;
fi
script:
#### Run Pytest
- if [ "$TO_TEST" = "CONDA" ]; then
python -m pytest -v --ignore modules/ectyper/ecoli_serotyping --ignore tests/docker/;
fi
- if [ "$TO_TEST" = "DOCKER" ]; then
python -m pytest -v tests/docker/;
fi
- if [ "$TO_TEST" = "BASH" ]; then
bash production.sh;
fi
after_failure:
- if [ "$TO_TEST" = "CONDA" ]; then
rgi -h;
ectyper -h;
fi
# Check the logs if tests fail.
- if [ "$TO_TEST" = "DOCKER" ]; then
docker-compose logs webserver;
docker-compose logs blazegraph;
fi
notifications:
email: false