-
Notifications
You must be signed in to change notification settings - Fork 10
/
.travis.yml
113 lines (102 loc) · 3.23 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
# Travis CI configuration file for webruntime
# Validate this at http://lint.travis-ci.org/
language: python
# use container-based infrastructure
sudo : false
# Only run travis build on push for master branch
branches:
only:
- master
matrix:
include:
- python: "3.6"
env: TEST_UNIT=0 TEST_STYLE=1
- python: "3.6"
env: TEST_UNIT=0 TEST_DOCS=1
#
- python: "pypy3"
env: TEST_UNIT=1
- python: "3.6"
env: TEST_UNIT=1 TEST_INSTALL=1
- python: "3.7"
env: TEST_UNIT=1
- python: "3.8"
env: TEST_UNIT=1
before_install:
- SRC_DIR=$(pwd)
- REDIRECT_TO=/dev/stdout # change to /dev/null to silence Travis
# file size checks run on minimal build for time
- if [ "${TEST_STYLE}" == "1" ]; then
if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
GIT_TARGET_EXTRA="+refs/heads/${TRAVIS_BRANCH}";
GIT_SOURCE_EXTRA="+refs/pull/${TRAVIS_PULL_REQUEST}/merge";
else
GIT_TARGET_EXTRA="";
GIT_SOURCE_EXTRA="";
fi;
cd ~;
mkdir target-size-clone && cd target-size-clone;
git init &> ${REDIRECT_TO} && git remote add -t ${TRAVIS_BRANCH} origin git://github.com/${TRAVIS_REPO_SLUG}.git &>${REDIRECT_TO};
git fetch origin ${GIT_TARGET_EXTRA} &> ${REDIRECT_TO} && git checkout -qf FETCH_HEAD &> ${REDIRECT_TO};
git tag travis-merge-target &> ${REDIRECT_TO};
git gc --aggressive &> ${REDIRECT_TO};
TARGET_SIZE=`du -s . | sed -e "s/\t.*//"`;
git pull origin ${GIT_SOURCE_EXTRA} &> ${REDIRECT_TO};
git gc --aggressive &> ${REDIRECT_TO};
MERGE_SIZE=`du -s . | sed -e "s/\t.*//"`;
if [ "${MERGE_SIZE}" != "${TARGET_SIZE}" ]; then
SIZE_DIFF=`expr \( ${MERGE_SIZE} - ${TARGET_SIZE} \)`;
else
SIZE_DIFF=0;
fi;
fi;
# Install dependencies
install:
- cd ${SRC_DIR}
- pip install -U dialite invoke
- if [ "${TEST_UNIT}" == "1" ]; then
pip install pytest-cov;
pip install selenium;
fi;
- if [ "${TEST_INSTALL}" == "1" ]; then
python setup.py install;
fi;
- if [ "${TEST_DOCS}" == "1" ]; then
pip install sphinx;
fi;
- if [ "${TEST_STYLE}" == "1" ]; then
pip install pycodestyle;
pip install flake8;
fi;
before_script:
# Enable fake display so that we can run firefox
# -> Does not work anymore
#- "export DISPLAY=:99.0"
#- "sh -e /etc/init.d/xvfb start"
#- sleep 3 # give xvfb some time to start
# Run the tests
script:
- cd ${SRC_DIR};
- python -c "import sys; print(sys.version, '\n', sys.prefix)"
- if [ "${TEST_UNIT}" == "1" ]; then
invoke test --unit;
fi;
- if [ "${TEST_DOCS}" == "1" ]; then
invoke docs --build;
fi;
- if [ "${TEST_STYLE}" == "1" ]; then
invoke test --style;
fi;
- if [ "${TEST_STYLE}" == "1" ]; then
echo "Size difference ${SIZE_DIFF} kB";
if git log --format=%B -n 2 | grep -q "\[size skip\]"; then
echo "Skipping size test";
else
test ${SIZE_DIFF} -lt 100;
fi;
fi;
after_success:
- echo SUCCESS!
after_failure:
- echo FAIL!
after_script: