Merge "[IMPR] Add hints if an account is member of bot group but has … #1315
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 | |
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' }} | |
timeout-minutes: 5 | |
strategy: | |
fail-fast: false | |
max-parallel: 8 | |
matrix: | |
python-version: [ "pypy3.7", "pypy3.10", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13.0-alpha - 3.13.0", "3.14-dev" ] | |
family: [ wikipedia ] | |
code: [ test ] | |
domain: [ "test.wikipedia.org" ] | |
include: | |
- python-version: "3.7" | |
family: wpbeta | |
code: en | |
domain: en.wikipedia.beta.wmflabs.org | |
- python-version: "3.7" | |
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/action@v3.1.0 | |
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 | |
pip install "importlib_metadata ; python_version < '3.8'" | |
pip install "mwparserfromhell ; python_version != '3.13'" | |
pip install "wikitextparser ; python_version == '3.13'" | |
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: 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 }} |