-
Notifications
You must be signed in to change notification settings - Fork 220
131 lines (127 loc) · 4.78 KB
/
login_tests-ci.yml
File metadata and controls
131 lines (127 loc) · 4.78 KB
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
---
# Run login/logout tests
name: Login CI
on:
workflow_run:
workflows: [Pywikibot CI]
branches: [master]
types: [completed]
env:
PYWIKIBOT_TEST_RUNNING: 1
PYWIKIBOT_TEST_LOGOUT: 1
PYWIKIBOT_USERNAME: Pywikibot-test
jobs:
wait_for_all:
name: Wait for other workflows to finish
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Wait for all workflows to complete excluding this one
uses: kachick/wait-other-jobs@v3.8.1
with:
skip-same-workflow: true
skip-list: |
[
{
"workflowFile": "login_tests-ci.yml",
"jobName": "Wait for other workflows to finish"
}
]
warmup-delay: PT1M
minimum-interval: PT5M
run_tests:
name: Run Login/Logout Tests
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
needs: wait_for_all
timeout-minutes: 45
strategy:
fail-fast: false
max-parallel: 1
matrix:
python-version: [pypy3.9, pypy3.11, '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', 3.15-dev]
site: ['wikipedia:en', 'wikisource:zh', 'wikipedia:test']
include:
- python-version: '3.9'
site: false
family: wpbeta
code: en
os: ubuntu-22.04
- python-version: '3.9'
site: false
family: wpbeta
code: zh
os: ubuntu-22.04
- python-version: '3.10'
site: wsbeta:en
- python-version: '3.9'
site: wikidata:test
os: ubuntu-22.04
- python-version: '3.11'
site: wiktionary:ar
- python-version: '3.9'
site: wikidata:wikidata
os: ubuntu-22.04
- python-version: '3.10'
site: wowwiki:uk
- python-version: 3
site: wikipedia:de
os: macOS-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v6
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: ${{ endsWith(matrix.python-version, '-dev') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip --version
pip install coverage
pip install "tomli; python_version < '3.11'"
pip install mwparserfromhell
pip install packaging
pip install requests
- name: Generate family files
run: |
if [ ${{matrix.family || 0}} == wpbeta ]; then
python pwb.py generate_family_file http://${{matrix.code}}.wikipedia.beta.wmcloud.org/ wpbeta y
fi
if [ ${{matrix.site || 0}} == 'wsbeta:en' ]; then
python pwb.py generate_family_file http://en.wikisource.beta.wmcloud.org/ wsbeta n
fi
- name: Generate user files
run: |
if [ ${{matrix.site}} != false ]; then
python -Werror::UserWarning -m pwb generate_user_files -site:${{matrix.site}} -user:${{ env.PYWIKIBOT_USERNAME }} -v -debug;
else
python -Werror::UserWarning -m pwb generate_user_files -family:${{matrix.family}} -code:${{matrix.code}} -user:${{ env.PYWIKIBOT_USERNAME }} -v -debug;
fi
echo "usernames['wikipedia']['en'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> user-config.py
echo "usernames['wikisource']['zh'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> user-config.py
echo "usernames['wikipedia']['test'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> user-config.py
echo "usernames['wikidata']['test'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> user-config.py
echo "usernames['commons']['commons'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> user-config.py
echo "usernames['meta']['meta'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> 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
echo "import os" >> user-config.py
echo "password_file = os.path.expanduser('passwordfile')" >> user-config.py
echo "('${{ env.PYWIKIBOT_USERNAME }}', '${{ secrets.PYWIKIBOT_USERPWD }}')" > passwordfile
- name: Login test with unittest
timeout-minutes: 2
run: |
python pwb.py version
coverage run -m unittest -vv tests/site_login_logout_tests.py
- name: Show coverage statistics
run: |
coverage combine || true
coverage report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}