-
Notifications
You must be signed in to change notification settings - Fork 195
135 lines (117 loc) · 4.25 KB
/
oauth_tests-ci.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
name: Oauth CI
# Run login tests using OAuth
on:
push:
branches: [ master ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PYWIKIBOT_TEST_RUNNING: 1
PYWIKIBOT_USERNAME: Pywikibot-oauth
PYWIKIBOT_LOGIN_LOGOUT: 1
jobs:
build:
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
timeout-minutes: 5
strategy:
fail-fast: false
max-parallel: 7
matrix:
python-version: ["pypy3.7", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
family: ['wikipedia']
code: ['test']
domain: ['test.wikipedia.org']
include:
# ubuntu-20.04 required for Python 3.6
- python-version: 3.6
family: wpbeta
code: en
domain: en.wikipedia.beta.wmflabs.org
os: ubuntu-20.04
- python-version: 3.7
family: wpbeta
code: zh
domain: zh.wikipedia.beta.wmflabs.org
- python-version: 3.6
family: wikipedia
code: test
domain: test.wikipedia.org
os: ubuntu-20.04
- python-version: "3.13-dev"
family: wikipedia
code: test
domain: test.wikipedia.org
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
if: ${{ matrix.python-version != '3.13-dev' }}
with:
python-version: ${{ matrix.python-version }}
# use deadsnakes/action until actions/setup-python supports Python 3.13
- name: Set up development Python ${{ matrix.python-version }}
uses: deadsnakes/[email protected]
if: ${{ matrix.python-version == '3.13-dev' }}
with:
python-version: ${{ matrix.python-version }}
- name: Get token name
env:
_oauth_token: OAUTH_TOKEN_${{ matrix.family }}_${{ matrix.code }}
uses: ASzc/change-string-case-action@v5
id: token
with:
string: ${{ env._oauth_token }}
- name: Split OAuth Token
uses: jungwinter/split@v2
id: split
with:
msg: ${{ secrets[format('{0}', steps.token.outputs.uppercase)] }}
separator: ":"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip --version
pip install -U setuptools
pip install requests
pip install mwparserfromhell
pip install mwoauth
pip install coverage
python -c "import setuptools; print('setuptools:', setuptools.__version__)"
- name: Generate family files
if: ${{ matrix.family == 'wpbeta' }}
run: |
python pwb.py generate_family_file http://${{matrix.code}}.wikipedia.beta.wmflabs.org/ wpbeta y
- name: Generate user files
run: |
python -Werror::UserWarning -m pwb generate_user_files -family:${{matrix.family}} -lang:${{matrix.code}} -user:${{ env.PYWIKIBOT_USERNAME }} -v -debug;
echo "authenticate['${{ matrix.domain }}'] = ('${{ steps.split.outputs._0 }}', '${{ steps.split.outputs._1 }}', '${{ steps.split.outputs._2 }}', '${{ steps.split.outputs._3 }}')" >> user-config.py
echo "max_retries = 3" >> user-config.py
echo "noisysleep = float('inf')" >> user-config.py
echo "maximum_GET_length = 5000" >> user-config.py
echo "console_encoding = 'utf8'" >> user-config.py
- name: Oauth tests with unittest and coverage
if: ${{ matrix.python-version != '3.13-dev' }}
timeout-minutes: 2
env:
PYWIKIBOT_TEST_OAUTH: ${{ secrets[format('{0}', steps.token.outputs.uppercase)] }}
run: |
python pwb.py version
coverage run -m unittest -vv tests/oauth_tests.py
- name: Oauth test with unittest without coverage due to T346862
if: ${{ matrix.python-version == '3.13-dev' }}
timeout-minutes: 2
env:
PYWIKIBOT_TEST_OAUTH: ${{ secrets[format('{0}', steps.token.outputs.uppercase)] }}
run: |
python pwb.py version
unittest -vv tests/oauth_tests.py
- name: Show coverage statistics
if: ${{ matrix.python-version != '3.13-dev' }}
run: |
coverage report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3