forked from wikimedia/pywikibot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
174 lines (149 loc) · 6.3 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
# See tests/README.rst for instructions for using Travis with developer builds.
language: python
python:
- '3.5'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10-dev'
# OSX builds do not yet support Python
os: linux
dist: xenial # required for Python >= 3.7
addons:
apt:
packages:
- djvulibre-bin
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
printf "# Empty requirements with PYSETUP_TEST_EXTRA" > requirements.txt ;
fi
# PYTEST is taken as the default
- if [[ "$PYSETUP_TEST_EXTRAS" != '1' ]]; then
export USE_PYTEST=1 ;
fi
- if [[ "$PYWIKIBOT_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 PYWIKIBOT_TEST_WRITE_FAIL=1 ;
fi
install:
- pip install -U setuptools
- pip install -r dev-requirements.txt
- pip install -r requirements.txt
before_script:
- if [[ "$PYSETUP_TEST_EXTRAS" != '1' ]]; then
pip install -e .[mwoauth];
fi
script:
- 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
- if [[ $FAMILY == 'portalwiki' ]]; then
python -m generate_family_file 'https://theportalwiki.com/wiki/Main_Page' 'portalwiki' 'y' 'y';
fi
- python -W error::UserWarning -m generate_user_files -dir:~/.pywikibot/ -family:$FAMILY -lang:$LANGUAGE -v -user:"$PYWIKIBOT_USERNAME"
- if [[ -n "$USER_PASSWORD" && -n "$PYWIKIBOT_USERNAME" ]]; then
printf "usernames['wikipedia']['en'] = '%q'\n" "$PYWIKIBOT_USERNAME" >> ~/.pywikibot/user-config.py ;
printf "usernames['wikipedia']['test'] = '%q'\n" "$PYWIKIBOT_USERNAME" >> ~/.pywikibot/user-config.py ;
printf "usernames['wikidata']['test'] = '%q'\n" "$PYWIKIBOT_USERNAME" >> ~/.pywikibot/user-config.py ;
printf "usernames['commons']['commons'] = '%q'\n" "$PYWIKIBOT_USERNAME" >> ~/.pywikibot/user-config.py ;
printf "usernames['meta']['meta'] = '%q'\n" "$PYWIKIBOT_USERNAME" >> ~/.pywikibot/user-config.py ;
printf "usernames['wikisource']['zh'] = '%q'\n" "$PYWIKIBOT_USERNAME" >> ~/.pywikibot/user-config.py ;
printf "('%q', '%q')\n" "$PYWIKIBOT_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_PYWIKIBOT_USERNAME" ]]; then
printf "usernames['${FAMILY}']['${LANGUAGE}'] = '%q'\n" "$OAUTH_PYWIKIBOT_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 ;
- echo "max_retries = 3" >> ~/.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_PYTEST" == "1" ]]; then
if [[ "$PYWIKIBOT_SITE_ONLY" == "1" ]]; then
python setup.py pytest --addopts="-vvv -s --timeout=$TEST_TIMEOUT --cov=. -rsxX -a \"family=='$FAMILY' and code=='$LANGUAGE'\"" ;
else
python setup.py pytest --addopts="-vvv -s --timeout=$TEST_TIMEOUT --cov=. -rsxX" ;
fi
else
coverage run -m unittest discover -vv -p "*_tests.py" ;
fi
after_script:
codecov
env:
global:
- TEST_TIMEOUT=300
- PYWIKIBOT_NO_L10N_TESTS=1
- PYWIKIBOT_TESTS_RUNNING=1
matrix:
- LANGUAGE=en FAMILY=wikipedia PYWIKIBOT_TEST_PROD_ONLY=1
- LANGUAGE=zh FAMILY=wikisource PYSETUP_TEST_EXTRAS=1 PYWIKIBOT_TEST_PROD_ONLY=1 PYWIKIBOT_TEST_NO_RC=1
matrix:
include:
- python: '3.5_with_system_site_packages'
env: LANGUAGE=nb FAMILY=wikipedia PYSETUP_TEST_EXTRAS=1 PYWIKIBOT_TEST_NO_RC=1
addons:
apt:
packages:
- djvulibre-bin
- graphviz
- python: '3.6'
env: LANGUAGE=en FAMILY=wpbeta PYWIKIBOT_SITE_ONLY=1 OAUTH_DOMAIN="en.wikipedia.beta.wmflabs.org"
- python: '3.6'
env: LANGUAGE=zh FAMILY=wpbeta PYWIKIBOT_SITE_ONLY=1 OAUTH_DOMAIN="zh.wikipedia.beta.wmflabs.org"
- python: '3.5'
env: LANGUAGE=en FAMILY=wsbeta PYWIKIBOT_SITE_ONLY=1
- python: '3.5'
env: LANGUAGE=en FAMILY=musicbrainz PYWIKIBOT_SITE_ONLY=1
- python: '3.7'
env: LANGUAGE=test FAMILY=wikipedia PYWIKIBOT_SITE_ONLY=1 OAUTH_DOMAIN="test.wikipedia.org"
- python: '3.7'
env: LANGUAGE=test FAMILY=wikidata PYWIKIBOT_SITE_ONLY=1
- python: '3.9'
env: LANGUAGE=ar FAMILY=wiktionary PYWIKIBOT_TEST_NO_RC=1
- python: '3.6'
env: LANGUAGE=wikidata FAMILY=wikidata PYWIKIBOT_SITE_ONLY=1
- python: '3.8'
env: LANGUAGE=uk FAMILY=wowwiki PYWIKIBOT_TEST_NO_RC=1
- python: '3.8'
env: LANGUAGE=en FAMILY=portalwiki
allow_failures:
- python: '3.6'
env: LANGUAGE=en FAMILY=wpbeta PYWIKIBOT_SITE_ONLY=1 OAUTH_DOMAIN="en.wikipedia.beta.wmflabs.org"
- python: '3.8'
env: LANGUAGE=uk FAMILY=wowwiki PYWIKIBOT_TEST_NO_RC=1
notifications:
email:
recipients:
on_success: always
on_failure: always
irc:
channels:
- "libera.chat#pywikibot"
on_success: change
on_failure: change
template:
- "%{repository_slug}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} %{build_url}"