Skip to content

[doc] Adjust scripts options #383

[doc] Adjust scripts options

[doc] Adjust scripts options #383

name: Sysop write test CI
# Run Pywikibot write tests on test wiki using sysop rights
on:
push:
branches: [ master ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PYWIKIBOT_TEST_RUNNING: 1
PYWIKIBOT_USERNAME: Pywikibot-test
jobs:
build:
# ubuntu-22.04 required for Python 3.7
runs-on: "ubuntu-22.04"
continue-on-error: ${{ matrix.experimental || false }}
timeout-minutes: 100
strategy:
fail-fast: false
matrix:
python-version: [ "3.7" ]
site: [ "wikipedia:test" ]
attr: [ "write and not rights", "write and rights", "rights and not write" ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip --version
if [ -f dev-requirements.txt ]; then pip install -r dev-requirements.txt; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Generate user files
run: |
python -Werror::UserWarning -m pwb generate_user_files -site:${{matrix.site}} -user:${{ env.PYWIKIBOT_USERNAME }} -v -debug;
echo "usernames['wikipedia']['test'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> user-config.py
echo "usernames['wikidata']['test'] = '${{ 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: Sysop and write tests with pytest
id: ci_test
continue-on-error: true
timeout-minutes: 90
env:
PYWIKIBOT_TEST_WRITE: ${{ matrix.site == 'wikipedia:test' && 1 || 0 }}
run: |
python pwb.py version
pytest -s -r A -a "${{ matrix.attr }}" --cov=.;
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Check on failure
if: steps.ci_test.outcome == 'failure'
run: exit 1