forked from cBioPortal/cbioportal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
134 lines (128 loc) · 4.62 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
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
sudo: required
language: java
jdk: oraclejdk7
services:
- docker
cache:
directories:
- $HOME/.m2
- $HOME/maven
env:
- MAVEN_VERSION=3.3.3 TEST=core
- MAVEN_VERSION=3.3.3 TEST=python-validator
- MAVEN_VERSION=3.3.3 TEST=end-to-end
install:
# install maven
- |
if [[ "${TEST}" == core || "${TEST}" == end-to-end ]]
then
mkdir -p ~/maven
test -d ~/maven/$MAVEN_VERSION/bin || { \
find ~/maven -mindepth 1 -delete && \
mkdir -p ~/maven/$MAVEN_VERSION && \
wget -O - http://www.eu.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | \
tar -C ~/maven/$MAVEN_VERSION --strip-components=1 -xzf -; }
fi
# install dependencies for the python unit tests
- |
if [[ "${TEST}" == python-validator ]]
then
sudo -H pip install -r requirements.txt
fi
before_script:
# run mysql db for core tests
- |
if [[ "${TEST}" == core ]]
then
docker run \
--name core-tests-mysql \
--net=host \
-p 3306:3306 \
-e MYSQL_USER=cbio_user \
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
-e MYSQL_PASSWORD=somepassword \
-e MYSQL_DATABASE=cgds_test \
-d \
mysql:5.7.12
fi
script:
- export PORTAL_HOME=$(pwd)
# run the python unit tests (for the dataset validation scripts)
- |
if [[ "${TEST}" == python-validator ]]
then
export PYTHONPATH=$PYTHONPATH:$PORTAL_HOME/core/src/main/scripts:/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages && \
cd $PORTAL_HOME/core/src/test/scripts/ && \
$PORTAL_HOME/core/src/test/scripts/./unit_tests_validate_data.py && \
$PORTAL_HOME/core/src/test/scripts/./system_tests_validate_data.py && \
cd $PORTAL_HOME
fi
# use .travis/settings.xml for core tests
- |
if [[ "${TEST}" == core ]]
then
mkdir -p ~/.m2 && \
cp .travis/settings.xml ~/.m2
fi
# use EXAMPLE properties files
- |
if [[ "${TEST}" == core || "${TEST}" == end-to-end ]]
then
cp $PORTAL_HOME/src/main/resources/portal.properties.EXAMPLE $PORTAL_HOME/src/main/resources/portal.properties && \
cp $PORTAL_HOME/src/main/resources/log4j.properties.EXAMPLE $PORTAL_HOME/src/main/resources/log4j.properties
fi
# make sure mysql container is running
- |
if [[ "${TEST}" == core ]]
then
while [[ 1 != $(echo 'select 1;' | \
mysql --user cbio_user -P 3306 -h 127.0.0.1 --password=somepassword cgds_test | head -1 2> /dev/null) ]]
do
sleep 5s
done
fi
# core tests
- |
if [[ "${TEST}" == core ]]
then
~/maven/$MAVEN_VERSION/bin/mvn \
-e \
-DPORTAL_HOME=$PORTAL_HOME \
-Ppublic \
-Dfinal.war.name=cbioportal \
-Ddb.user=cbio_user \
-Ddb.password=somepassword \
-Ddb.host=127.0.0.1 \
-Ddb.connection_string=jdbc:mysql://127.0.0.1:3306/ \
clean test
fi
# end-to-end tests
# compile war to use amazon db
- |
if [[ "${TEST}" == end-to-end ]]
then
~/maven/$MAVEN_VERSION/bin/mvn \
-e -DPORTAL_HOME=$PORTAL_HOME \
-Ppublic -DskipTests \
-Dfinal.war.name=cbioportal \
-Ddb.user=cbio_user \
-Ddb.password=cbio_pass \
-Ddb.portal_db_name=public_test \
-Ddb.connection_string=jdbc:mysql://cbioportal-public.c1xhhbwn8izk.us-east-1.rds.amazonaws.com:3306/ \
-Ddb.host=cbioportal-public.c1xhhbwn8izk.us-east-1.rds.amazonaws.com \
clean install
fi
# spin up selenium docker grid
- |
if [[ "${TEST}" == end-to-end ]]
then
cd test/end-to-end && \
docker-compose up -d && \
sleep 30s && \
cd ../.. && \
# spot visual regression by comparing screenshots in the repo with
# screenshots of this portal loaded with the data from the amazon db
bash test/end-to-end/test_make_screenshots.sh test/end-to-end/screenshots.yml
fi
notifications:
slack: cbioportal:S2qVTFTFMtizONhCOe8BYxS6