forked from flexxui/flexx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
120 lines (107 loc) · 3.4 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
# Travis CI configuration file for Flexx
# Validate this at http://lint.travis-ci.org/
language: python
# use container-based infrastructure
# sudo : false
# Trick to get 3.7 working for now
# https://github.com/travis-ci/travis-ci/issues/9815#issuecomment-405506964
dist: xenial
sudo: true
# Only run travis build on push for master branch
branches:
only:
- master
# https://benlimmer.com/2019/01/14/travis-ci-xvfb/
services:
- xvfb
matrix:
include:
- python: "3.6"
env: TEST_UNIT=0 TEST_STYLE=1
- python: "3.6"
env: TEST_UNIT=0 TEST_DOCS=1
#
- python: "pypy3.5"
env: TEST_UNIT=1
- python: "3.5"
env: TEST_UNIT=1 TEST_INSTALL=1
- python: "3.6"
env: TEST_UNIT=1
- python: "3.7"
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 invoke
- if [ "${TEST_UNIT}" == "1" ]; then
pip install pytest-cov;
pip install tornado pscript>=0.5.6 webruntime dialite;
pip install selenium;
fi;
- if [ "${TEST_INSTALL}" == "1" ]; then
python setup.py install;
fi;
- if [ "${TEST_DOCS}" == "1" ]; then
pip install sphinx;
pip install tornado pscript>=0.5.6 webruntime dialite;
fi;
- if [ "${TEST_STYLE}" == "1" ]; then
pip install pycodestyle;
pip install flake8;
fi;
before_script:
# 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
python -c 'import flexx.ui';
invoke docs --clean --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: