cleanup: Drop support for MediaWiki < 1.31 #1574
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Oauth CI | |
# Run login tests using OAuth and non-sysop tests on test wiki | |
on: | |
push: | |
branches: [ master ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
PYWIKIBOT_TEST_RUNNING: 1 | |
PYWIKIBOT_USERNAME: Pywikibot-oauth | |
jobs: | |
build: | |
runs-on: ${{ matrix.os || 'ubuntu-latest' }} | |
continue-on-error: ${{ matrix.experimental || false }} | |
timeout-minutes: 5 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "pypy3.8", "pypy3.10", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14-dev" ] | |
family: [ wikipedia ] | |
code: [ test ] | |
domain: [ "test.wikipedia.org" ] | |
include: | |
- python-version: "3.8" | |
family: wpbeta | |
code: en | |
domain: en.wikipedia.beta.wmflabs.org | |
- python-version: "3.8" | |
family: wpbeta | |
code: zh | |
domain: zh.wikipedia.beta.wmflabs.org | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
if: "!endsWith(matrix.python-version, '-dev')" | |
with: | |
python-version: ${{ matrix.python-version }} | |
# use deadsnakes/action for development releases | |
- name: Set up development Python ${{ matrix.python-version }} | |
uses: deadsnakes/[email protected] | |
if: "endsWith(matrix.python-version, '-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@v6 | |
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 coverage | |
# tomli required for coverage due to T380697 | |
pip install "tomli; python_version < '3.11'" | |
pip install mwparserfromhell | |
# PyJWT added due to T380270 | |
pip install "PyJWT != 2.10.0, != 2.10.1 ; python_version > '3.8'" | |
pip install mwoauth | |
pip install packaging | |
pip install requests | |
- 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 "usernames['commons']['beta'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> user-config.py | |
echo "authenticate['${{ matrix.domain }}'] = ('${{ steps.split.outputs._0 }}', '${{ steps.split.outputs._1 }}', '${{ steps.split.outputs._2 }}', '${{ steps.split.outputs._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 | |
timeout-minutes: 2 | |
env: | |
PYWIKIBOT_TEST_WRITE: 1 | |
PYWIKIBOT_TEST_OAUTH: ${{ secrets[format('{0}', steps.token.outputs.uppercase)] }} | |
PYWIKIBOT_TEST_MODULES: edit_failure,file,oauth | |
run: | | |
python pwb.py version | |
coverage run -m unittest -vv | |
- name: Show coverage statistics | |
run: | | |
coverage report | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |