forked from wikimedia/pywikibot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
178 lines (152 loc) · 6.44 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# See tests/README.rst for instructions for using travis with developer builds.
language: python
sudo: false
python:
- '2.6'
- '2.7'
- '3.3'
- '3.4'
- '3.5'
- '3.6'
# OSX builds do not yet support Python
os: linux
addons:
apt:
sources:
- lucid
packages:
- libssl1.0.0
- djvulibre-bin
- liblua5.1-0-dev
before_install:
# When PYSETUP_TEST_EXTRAS is not enabled, do not allow the
# default 'install' step to install all dependencies listed in
# requirements.txt to verify that a minimal install works as expected.
# Instead install requests in the before_script step below.
- if [[ "$PYSETUP_TEST_EXTRAS" != '1' ]]; then rm requirements.txt ; fi
# When the env variable USE_NOSE or USE_PYTEST is set, the appropriate
# tool is used, else PYTEST is taken as the default
- if [[ "$PYSETUP_TEST_EXTRAS" != '1' && "$USE_NOSE" != '1' && "$USE_PYTEST" != '1' ]]; then
export USE_PYTEST=1 ;
fi
- if [[ "$SITE_ONLY" == '1' ]]; then
echo "Running site tests only code ${LANGUAGE} on family ${FAMILY}" ;
fi
- export GITHUB_USER=`echo $TRAVIS_REPO_SLUG | cut -d '/' -f 1`
- mkdir ~/.python-eggs
- chmod 700 ~/.python-eggs
- if [[ "$GITHUB_USER" != "wikimedia" ]]; then
export PYWIKIBOT2_TEST_WRITE_FAIL=1 ;
fi
before_script:
- pip install -r dev-requirements.txt
script:
# Install security packages for requests to support HTTPS in site_detect
- if [[ "$PYSETUP_TEST_EXTRAS" != '1' ]]; then
pip install mwoauth!=0.3.1 -r requests-requirements.txt ;
fi
- mkdir ~/.pywikibot
- python pwb.py generate_family_file 'https://wiki.musicbrainz.org/' musicbrainz 'n'
- if [[ $FAMILY == 'wpbeta' ]]; then
python -m generate_family_file 'http://'$LANGUAGE'.wikipedia.beta.wmflabs.org/' 'wpbeta' 'y' ;
fi
- if [[ $FAMILY == 'wsbeta' ]]; then
python -m generate_family_file 'http://'$LANGUAGE'.wikisource.beta.wmflabs.org/' 'wsbeta' 'y' ;
fi
- python -W error::UserWarning -m generate_user_files -dir:~/.pywikibot/ -family:$FAMILY -lang:$LANGUAGE -v -user:"$PYWIKIBOT2_USERNAME"
- if [[ -n "$USER_PASSWORD" && -n "$PYWIKIBOT2_USERNAME" ]]; then
printf "usernames['wikipedia']['en'] = '%q'\n" "$PYWIKIBOT2_USERNAME" >> ~/.pywikibot/user-config.py ;
printf "usernames['wikipedia']['test'] = '%q'\n" "$PYWIKIBOT2_USERNAME" >> ~/.pywikibot/user-config.py ;
printf "usernames['wikidata']['test'] = '%q'\n" "$PYWIKIBOT2_USERNAME" >> ~/.pywikibot/user-config.py ;
printf "usernames['commons']['commons'] = '%q'\n" "$PYWIKIBOT2_USERNAME" >> ~/.pywikibot/user-config.py ;
printf "('%q', '%q')\n" "$PYWIKIBOT2_USERNAME" "$USER_PASSWORD" > ~/.pywikibot/passwordfile ;
echo "import os" >> ~/.pywikibot/user-config.py ;
echo "password_file = os.path.expanduser('~/.pywikibot/passwordfile')" >> ~/.pywikibot/user-config.py ;
fi
- if [[ -n "$OAUTH_DOMAIN" ]]; then
if [[ -n "$OAUTH_PYWIKIBOT2_USERNAME" ]]; then
printf "usernames['${FAMILY}']['${LANGUAGE}'] = '%q'\n" "$OAUTH_PYWIKIBOT2_USERNAME" >> ~/.pywikibot/user-config.py ;
fi ;
oauth_token_var="OAUTH_TOKENS_${FAMILY^^}_${LANGUAGE^^}" ;
if [[ -n "${!oauth_token_var}" ]]; then
printf "authenticate['${OAUTH_DOMAIN}'] = ('%s')\n" "${!oauth_token_var//:/', '}" >> ~/.pywikibot/user-config.py ;
fi ;
fi
- echo "authenticate['wiki.musicbrainz.org'] = ('NOTSPAM', 'NOTSPAM')" >> ~/.pywikibot/user-config.py ;
- python -c "from __future__ import print_function;from pywikibot import config as c; a=c.authenticate; [(print('authenticate_key:', i), print('authenticate_value_type:', type(a[i])), print('authenticate_value_length:', len(a[i]))) for i in a]" # T173498
- echo "max_retries = 2" >> ~/.pywikibot/user-config.py
- echo "maximum_GET_length = 5000" >> ~/.pywikibot/user-config.py
- echo "console_encoding = 'utf8'" >> ~/.pywikibot/user-config.py
- python -c "import setuptools; print(setuptools.__version__)"
- if [[ "$USE_NOSE" == "1" ]]; then
nosetests --version ;
if [[ "$SITE_ONLY" == "1" ]]; then
python setup.py nosetests --tests tests --verbosity=2 -a "family=$FAMILY,code=$LANGUAGE" --with-trim --with-coverage --cover-package=. ;
else
python setup.py nosetests --tests tests --verbosity=2 --with-trim --with-coverage --cover-package=. ;
fi ;
elif [[ "$USE_PYTEST" == "1" ]]; then
if [[ "$SITE_ONLY" == "1" ]]; then
python setup.py pytest --addopts="-vvv -s --timeout=$TEST_TIMEOUT --cov=. -a \"family=='$FAMILY' and code=='$LANGUAGE'\"" ;
else
python setup.py pytest --addopts="-vvv -s --timeout=$TEST_TIMEOUT --cov=." ;
fi
else
coverage run setup.py test ;
fi
after_success:
codecov
after_failure:
codecov
env:
global:
- TEST_TIMEOUT=300
matrix:
- LANGUAGE=en FAMILY=wikipedia PYWIKIBOT2_TEST_PROD_ONLY=1
- LANGUAGE=zh FAMILY=wikisource PYSETUP_TEST_EXTRAS=1 PYWIKIBOT2_TEST_PROD_ONLY=1 PYWIKIBOT2_TEST_NO_RC=1
matrix:
include:
- python: '2.7_with_system_site_packages'
env: LANGUAGE=nb FAMILY=wikipedia DIST=trusty PYSETUP_TEST_EXTRAS=1
dist: trusty
sudo: required
addons:
apt:
packages:
- djvulibre-bin
- graphviz
- liblua5.1-0-dev
- python-ipaddr
# Disabled due to T173498
#- python: '2.7'
# env: LANGUAGE=en FAMILY=wpbeta SITE_ONLY=1 OAUTH_DOMAIN="en.wikipedia.beta.wmflabs.org"
#- python: '3.3'
# env: LANGUAGE=zh FAMILY=wpbeta SITE_ONLY=1 OAUTH_DOMAIN="zh.wikipedia.beta.wmflabs.org"
- python: '3.4'
env: LANGUAGE=en FAMILY=wsbeta SITE_ONLY=1
- python: '2.7'
env: LANGUAGE=wikia FAMILY=wikia PYWIKIBOT2_TEST_NO_RC=1
- python: '3.3'
env: LANGUAGE=en FAMILY=musicbrainz SITE_ONLY=1
# Disabled due to T173498
#- python: '3.4'
# env: LANGUAGE=test FAMILY=wikipedia SITE_ONLY=1 OAUTH_DOMAIN="test.wikipedia.org"
- python: '3.4'
env: LANGUAGE=test FAMILY=wikidata SITE_ONLY=1
- python: '3.4'
env: LANGUAGE=ar FAMILY=wiktionary PYWIKIBOT2_TEST_NO_RC=1
- python: '2.6'
env: LANGUAGE=wikidata FAMILY=wikidata SITE_ONLY=1
notifications:
email:
recipients:
on_success: always
on_failure: always
irc:
channels:
- "chat.freenode.net#pywikibot"
on_success: change
on_failure: change
template:
- "%{repository_slug}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} %{build_url}"