Login CI #2064
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: Login CI | |
# Run login/logout tests | |
on: | |
workflow_run: | |
workflows: [ "Pywikibot CI" ] | |
branches: [ master ] | |
types: | |
- completed | |
env: | |
PYWIKIBOT_TEST_RUNNING: 1 | |
PYWIKIBOT_USERNAME: Pywikibot-test | |
PYWIKIBOT_LOGIN_LOGOUT: 1 | |
jobs: | |
build: | |
runs-on: ${{ matrix.os || 'ubuntu-latest' }} | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
max-parallel: 1 | |
matrix: | |
python-version: ["pypy3.7", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12.0-alpha - 3.12.0"] | |
site: ['wikipedia:en', 'wikisource:zh'] | |
include: | |
# ubuntu-20.04 required for Python 3.6 | |
- python-version: 3.6 | |
site: False | |
family: wpbeta | |
code: en | |
os: ubuntu-20.04 | |
- python-version: 3.6 | |
site: False | |
family: wpbeta | |
code: zh | |
os: ubuntu-20.04 | |
- python-version: 3.8 | |
site: wsbeta:en | |
- python-version: 3.7 | |
site: wikipedia:test | |
- python-version: 3.7 | |
site: wikidata:test | |
- python-version: 3.9 | |
site: wiktionary:ar | |
- python-version: 3.6 | |
site: wikidata:wikidata | |
os: ubuntu-20.04 | |
- python-version: 3.8 | |
site: wowwiki:uk | |
- python-version: "3.12.0-alpha - 3.12.0" | |
site: wikipedia:test | |
- python-version: 3 | |
site: wikipedia:de | |
os: macOS-latest | |
- python-version: 3.6 | |
site: wikipedia:en | |
os: ubuntu-20.04 | |
- python-version: 3.6 | |
site: wikisource:zh | |
os: ubuntu-20.04 | |
- python-version: "3.13-dev" | |
site: wikipedia:test | |
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: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip --version | |
pip install -U setuptools | |
pip install requests | |
pip install mwparserfromhell | |
pip install coverage | |
python -c "import setuptools; print('setuptools:', setuptools.__version__)" | |
- name: Generate family files | |
run: | | |
if [ ${{matrix.family || 0}} == wpbeta ]; then | |
python pwb.py generate_family_file http://${{matrix.code}}.wikipedia.beta.wmflabs.org/ wpbeta y | |
fi | |
if [ ${{matrix.site || 0}} == 'wsbeta:en' ]; then | |
python pwb.py generate_family_file http://en.wikisource.beta.wmflabs.org/ wsbeta y | |
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}} -lang:${{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 "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 | |
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: 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 report | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 |