forked from pysam-developers/pysam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests_travis.sh
executable file
·150 lines (115 loc) · 3.86 KB
/
run_tests_travis.sh
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
#!/usr/bin/env bash
pushd .
WORKDIR=`pwd`
#Install miniconda python
if [ $TRAVIS_OS_NAME == "osx" ]; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O Miniconda3.sh
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O Miniconda3.sh --no-check-certificate # Default OS versions are old and have SSL / CERT issues
fi
bash Miniconda3.sh -b
# Create a new conda environment with the target python version
~/miniconda3/bin/conda install conda-build -y
~/miniconda3/bin/conda create -q -y --name testenv python=$CONDA_PY cython numpy nose psutil pip
# activate testenv environment
source ~/miniconda3/bin/activate testenv
# Need to make C compiler and linker use the anaconda includes and libraries:
export PREFIX=~/miniconda3/
export CFLAGS="-I${PREFIX}/include -L${PREFIX}/lib"
export HTSLIB_CONFIGURE_OPTIONS="--disable-libcurl"
# create a new folder to store external tools
mkdir -p $WORKDIR/external-tools
# install htslib
cd $WORKDIR/external-tools
curl --retry-delay 60 --retry 5 -L https://github.com/samtools/htslib/releases/download/1.3.1/htslib-1.3.1.tar.bz2 > htslib-1.3.1.tar.bz2
tar xjvf htslib-1.3.1.tar.bz2
cd htslib-1.3.1
make
PATH=$PATH:$WORKDIR/external-tools/htslib-1.3.1
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$WORKDIR/external-tools/htslib-1.3.1
# install samtools, compile against htslib
cd $WORKDIR/external-tools
curl --retry-delay 60 --retry 5 -L http://downloads.sourceforge.net/project/samtools/samtools/1.3.1/samtools-1.3.1.tar.bz2 > samtools-1.3.1.tar.bz2
tar xjvf samtools-1.3.1.tar.bz2
cd samtools-1.3.1
./configure --with-htslib=../htslib-1.3.1
make
PATH=$PATH:$WORKDIR/external-tools/samtools-1.3.1
echo "installed samtools"
samtools --version
if [ $? != 0 ]; then
exit 1
fi
# install bcftools
cd $WORKDIR/external-tools
curl --retry-delay 60 --retry 5 -L https://github.com/samtools/bcftools/releases/download/1.3.1/bcftools-1.3.1.tar.bz2 > bcftools-1.3.1.tar.bz2
tar xjf bcftools-1.3.1.tar.bz2
cd bcftools-1.3.1
./configure --with-htslib=../htslib-1.3.1
make
PATH=$PATH:$WORKDIR/external-tools/bcftools-1.3.1
echo "installed bcftools"
bcftools --version
if [ $? != 0 ]; then
exit 1
fi
popd
# Try building conda recipe first
~/miniconda3/bin/conda-build ci/conda-recipe/ --python=$CONDA_PY
# install code from the repository
python setup.py install
# find build/
# change into tests directory. Otherwise,
# 'import pysam' will import the repository,
# not the installed version. This causes
# problems in the compilation test.
cd tests
# create auxilliary data
echo
echo 'building test data'
echo
make -C pysam_data
make -C cbcf_data
# run nosetests
# -s: do not capture stdout, conflicts with pysam.dispatch
# -v: verbose output
nosetests -s -v
if [ $? != 0 ]; then
exit 1
fi
# build source tar-ball. Make sure to build so that .pyx files
# are cythonized.
cd ..
python setup.py build sdist
if [ $? != 0 ]; then
exit 1
fi
# check for presence of config.h files
echo "checking for presence of config.h files in tar-ball"
tar -tvzf dist/pysam-*.tar.gz | grep "config.h$"
if [ $? != 1 ]; then
exit 1
fi
# test pip installation from tar-ball with cython
echo "pip installing with cython"
pip install --verbose --no-deps --no-binary=:all: dist/pysam-*.tar.gz
if [ $? != 0 ]; then
exit 1
fi
# attempt pip installation without cython
echo "pip installing without cython"
~/miniconda3/bin/conda remove -y cython
~/miniconda3/bin/conda list
echo "python is" `which python`
pip install --verbose --no-deps --no-binary=:all: --force-reinstall --upgrade dist/pysam-*.tar.gz
if [ $? != 0 ]; then
exit 1
fi
# attempt pip installation without cython and without
# command line options
echo "pip installing without cython and no configure options"
export HTSLIB_CONFIGURE_OPTIONS=""
pip install --verbose --no-deps --no-binary=:all: --force-reinstall --upgrade dist/pysam-*.tar.gz
if [ $? != 0 ]; then
exit 1
fi