jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1164660?usp=email )
Change subject: fix: fix yaml format using yamlfix ......................................................................
fix: fix yaml format using yamlfix
Change-Id: I119d17464540a0d25d8fffd872a10dc447df2544 --- M .codecov.yml M .github/workflows/doctest.yml M .github/workflows/login_tests-ci.yml M .github/workflows/oauth_tests-ci.yml M .github/workflows/pre-commit.yml M .github/workflows/pywikibot-ci.yml M .github/workflows/sysop_write_tests-ci.yml M .github/workflows/windows_tests.yml M .pre-commit-config.yaml 9 files changed, 415 insertions(+), 467 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/.codecov.yml b/.codecov.yml index 0835193..322dcd0 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,3 +1,4 @@ +--- codecov: bot: jayvdb max_report_age: 48 @@ -10,14 +11,13 @@ status: project: default: - enabled: yes + enabled: true patch: default: - enabled: yes + enabled: true changes: default: - enabled: yes - + enabled: true ignore: - Users - pywikibot/daemonize.py @@ -28,7 +28,6 @@ - scripts/maintenance/make_i18n_dict.py - scripts/userscripts/ - tests/pwb/ - notify: irc: default: @@ -36,7 +35,6 @@ channel: pywikibot
component_management: - individual_components: - component_id: Framework paths: diff --git a/.github/workflows/doctest.yml b/.github/workflows/doctest.yml index ecfe729..6e2f854 100644 --- a/.github/workflows/doctest.yml +++ b/.github/workflows/doctest.yml @@ -1,9 +1,10 @@ -name: Doctest CI +--- # Run Pywikibot doctests with a variety of Python versions +name: Doctest CI
on: push: - branches: [ master ] + branches: [master]
concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -17,67 +18,58 @@ build: runs-on: ${{ matrix.os || 'ubuntu-latest' }} timeout-minutes: 10 - strategy: fail-fast: false max-parallel: 17 - matrix: - python-version: [ pypy3.8, pypy3.10, "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ] - os: [ windows-latest, macOS-latest, ubuntu-latest ] + python-version: [pypy3.8, pypy3.10, '3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + os: ['windows-latest', 'macOS-latest', 'ubuntu-latest'] include: - python-version: 3.14-dev - python-version: 3.15-dev - 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 }} + - 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.2.0 - if: endsWith(matrix.python-version, '-dev') - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip --version - pip install "coverage == 7.6.1; python_version < '3.9'" - pip install "coverage >= 7.6.10; python_version > '3.8'" - pip install "tomli; python_version < '3.11'" - pip install mwparserfromhell - pip install packaging - pip install "PyMySQL >= 1.0.0" - pip install pytest - pip install requests-sse - pip install wikitextparser - - - name: Generate user files - run: | - python -Werror::UserWarning -m pwb generate_user_files -site:wikipedia:test -user:${{ env.PYWIKIBOT_USERNAME }} -v -debug; - - - name: doctest with pytest - timeout-minutes: 5 - run: | - python pwb.py version - pytest --version - coverage run -m pytest pywikibot --doctest-modules --ignore-glob="*gui.py" --ignore-glob="*memento.py" - - - name: Show coverage statistics - run: | - coverage report - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - name: Set up development Python ${{ matrix.python-version }} + uses: deadsnakes/action@v3.2.0 + if: endsWith(matrix.python-version, '-dev') + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip --version + pip install "coverage == 7.6.1; python_version < '3.9'" + pip install "coverage >= 7.6.10; python_version > '3.8'" + pip install "tomli; python_version < '3.11'" + pip install mwparserfromhell + pip install packaging + pip install "PyMySQL >= 1.0.0" + pip install pytest + pip install requests-sse + pip install wikitextparser + - name: Generate user files + run: | + python -Werror::UserWarning -m pwb generate_user_files -site:wikipedia:test -user:${{ env.PYWIKIBOT_USERNAME }} -v -debug; + - name: doctest with pytest + timeout-minutes: 5 + run: | + python pwb.py version + pytest --version + coverage run -m pytest pywikibot --doctest-modules --ignore-glob="*gui.py" --ignore-glob="*memento.py" + - name: Show coverage statistics + run: | + coverage report + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/login_tests-ci.yml b/.github/workflows/login_tests-ci.yml index bcda450..9ce854b 100644 --- a/.github/workflows/login_tests-ci.yml +++ b/.github/workflows/login_tests-ci.yml @@ -1,10 +1,11 @@ -name: Login CI +--- # Run login/logout tests +name: Login CI
on: workflow_run: - workflows: [ Pywikibot CI ] - branches: [ master ] + workflows: [Pywikibot CI] + branches: [master] types: - completed
@@ -17,111 +18,101 @@ build: runs-on: ${{ matrix.os || 'ubuntu-latest' }} timeout-minutes: 30 - strategy: fail-fast: false max-parallel: 1 - matrix: - python-version: [ pypy3.8, pypy3.10, "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", 3.14-dev, 3.15-dev] - site: [ "wikipedia:en", "wikisource:zh", "wikipedia:test" ] + python-version: [pypy3.8, pypy3.10, '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', 3.14-dev, 3.15-dev] + site: ['wikipedia:en', 'wikisource:zh', 'wikipedia:test'] include: - - python-version: "3.8" - site: False + - python-version: '3.8' + site: false family: wpbeta code: en os: ubuntu-22.04 - - python-version: "3.8" - site: False + - python-version: '3.8' + site: false family: wpbeta code: zh os: ubuntu-22.04 - - python-version: "3.9" + - python-version: '3.9' site: wsbeta:en - - python-version: "3.8" + - python-version: '3.8' site: wikidata:test os: ubuntu-22.04 - - python-version: "3.10" + - python-version: '3.10' site: wiktionary:ar - - python-version: "3.8" + - python-version: '3.8' site: wikidata:wikidata os: ubuntu-22.04 - - python-version: "3.9" + - python-version: '3.9' site: wowwiki:uk - python-version: 3 site: wikipedia:de os: macOS-latest - 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 }} + - 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.2.0 - if: "endsWith(matrix.python-version, '-dev')" - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip --version - pip install "coverage == 7.6.1; python_version < '3.9'" - pip install "coverage >= 7.6.10; python_version > '3.8'" - pip install "tomli; python_version < '3.11'" - pip install mwparserfromhell - pip install packaging - pip install requests - - - name: Generate family files - run: | + - name: Set up development Python ${{ matrix.python-version }} + uses: deadsnakes/action@v3.2.0 + if: endsWith(matrix.python-version, '-dev') + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip --version + pip install "coverage == 7.6.1; python_version < '3.9'" + pip install "coverage >= 7.6.10; python_version > '3.8'" + 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://$%7B%7Bmatrix.code%7D%7D.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 "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 report - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - 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 "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 report + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/oauth_tests-ci.yml b/.github/workflows/oauth_tests-ci.yml index 122d48c..2006ca0 100644 --- a/.github/workflows/oauth_tests-ci.yml +++ b/.github/workflows/oauth_tests-ci.yml @@ -1,9 +1,10 @@ -name: Oauth CI +--- # Run login tests using OAuth and non-sysop tests on test wiki +name: Oauth CI
on: push: - branches: [ master ] + branches: [master]
concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -18,103 +19,91 @@ 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, 3.15-dev ] - family: [ wikipedia ] - code: [ test ] - domain: [ test.wikipedia.org ] + python-version: [pypy3.8, pypy3.10, '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', 3.14-dev, 3.15-dev] + family: [wikipedia] + code: [test] + domain: [test.wikipedia.org] include: - - python-version: "3.8" + - python-version: '3.8' family: wpbeta code: en domain: en.wikipedia.beta.wmflabs.org - - python-version: "3.8" + - 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 }} + - 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.2.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 == 7.6.1; python_version < '3.9'" - pip install "coverage >= 7.6.10; python_version > '3.8'" - # 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://$%7B%7Bmatrix.code%7D%7D.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@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - name: Set up development Python ${{ matrix.python-version }} + uses: deadsnakes/action@v3.2.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 == 7.6.1; python_version < '3.9'" + pip install "coverage >= 7.6.10; python_version > '3.8'" + # 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://$%7B%7Bmatrix.code%7D%7D.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@v5 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 5237b1b..cc99546 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,15 +1,20 @@ +--- name: pre-commit + on: push: branches: - master - stable + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true + env: PYWIKIBOT_TEST_RUNNING: 1 PYWIKIBOT_NO_USER_CONFIG: 2 + jobs: pre-commit: runs-on: ubuntu-latest @@ -17,9 +22,9 @@ fail-fast: false matrix: python-version: - - "3.13" - - "3.14-dev" - - "3.15-dev" + - '3.13' + - 3.14-dev + - 3.15-dev steps: - name: set up python ${{ matrix.python-version }} if: "!endsWith(matrix.python-version, '-dev')" @@ -27,7 +32,7 @@ with: python-version: ${{ matrix.python-version }} - name: set up development python ${{ matrix.python-version }} - if: "endsWith(matrix.python-version, '-dev')" + if: endsWith(matrix.python-version, '-dev') uses: deadsnakes/action@v3.2.0 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/pywikibot-ci.yml b/.github/workflows/pywikibot-ci.yml index b88463d..847ec66 100644 --- a/.github/workflows/pywikibot-ci.yml +++ b/.github/workflows/pywikibot-ci.yml @@ -1,11 +1,12 @@ -name: Pywikibot CI +--- # Run Pywikibot tests with a variety of Python versions +name: Pywikibot CI
on: push: - branches: [ master, stable ] + branches: [master, stable] pull_request: - branches: [ master ] + branches: [master]
concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -20,37 +21,35 @@ runs-on: ${{ matrix.os || 'ubuntu-latest' }} continue-on-error: ${{ matrix.experimental || false }} timeout-minutes: 100 - strategy: fail-fast: false max-parallel: 19 - matrix: - python-version: [ pypy3.10, "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ] - site: [ "wikipedia:en", "wikisource:zh" ] + python-version: [pypy3.10, '3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + site: ['wikipedia:en', 'wikisource:zh'] include: - - python-version: "3.8" + - python-version: '3.8' site: wikipedia:test - - python-version: "3.8" - site: False + - python-version: '3.8' + site: false family: wpbeta code: en - - python-version: "3.8" - site: False + - python-version: '3.8' + site: false family: wpbeta code: zh - - python-version: "3.9" + - python-version: '3.9' site: wsbeta:en - - python-version: "3.8" + - python-version: '3.8' site: wikidata:test - - python-version: "3.10" + - python-version: '3.10' site: wiktionary:ar test_no_rc: true - - python-version: "3.8" + - python-version: '3.8' site: wikidata:wikidata - - python-version: "3.9" + - python-version: '3.9' site: wowwiki:uk - - python-version: "3" + - python-version: '3' site: wikipedia:de os: macOS-latest # ubuntu-22.04 required for pypy3.8 and 3.14-dev due to T382214 @@ -73,89 +72,79 @@ site: wikisource:zh os: ubuntu-22.04 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 }} + - 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.2.0 - if: endsWith(matrix.python-version, '-dev') - 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 - pip install wikitextparser - - - name: Install setuptools - if: ${{ (matrix.python-version >= '3.12') || (matrix.os == 'macOS-latest') }} - run: pip install setuptools - - - name: Generate family files - run: | + - name: Set up development Python ${{ matrix.python-version }} + uses: deadsnakes/action@v3.2.0 + if: endsWith(matrix.python-version, '-dev') + 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 + pip install wikitextparser + - name: Install setuptools + if: ${{ (matrix.python-version >= '3.12') || (matrix.os == 'macOS-latest') }} + run: pip install setuptools + - name: Generate family files + run: | if [ ${{matrix.family || 0}} == wpbeta ]; then python pwb.py generate_family_file http://$%7B%7Bmatrix.code%7D%7D.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 "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 or pytest - id: ci_test - continue-on-error: true - timeout-minutes: 90 - env: - PYWIKIBOT_TEST_NO_RC: - ${{ (matrix.site == 'wikisource:zh' || matrix.test_no_rc) && 1 || 0 }} - run: | - python pwb.py version - if [ ${{matrix.site || 0}} != 'wikisource:zh' ]; then - coverage run -m unittest discover -vv -p "*_tests.py"; - else - coverage run -m pytest - fi - - - name: Show coverage statistics - run: | - coverage report - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - - name: Check on failure - if: steps.ci_test.outcome == 'failure' - run: exit 1 + - 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 "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 or pytest + id: ci_test + continue-on-error: true + timeout-minutes: 90 + env: + PYWIKIBOT_TEST_NO_RC: ${{ (matrix.site == 'wikisource:zh' || matrix.test_no_rc) && 1 || 0 }} + run: | + python pwb.py version + if [ ${{matrix.site || 0}} != 'wikisource:zh' ]; then + coverage run -m unittest discover -vv -p "*_tests.py"; + else + coverage run -m pytest + fi + - name: Show coverage statistics + run: | + coverage report + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - name: Check on failure + if: steps.ci_test.outcome == 'failure' + run: exit 1 diff --git a/.github/workflows/sysop_write_tests-ci.yml b/.github/workflows/sysop_write_tests-ci.yml index 55aaa96..a08b124 100644 --- a/.github/workflows/sysop_write_tests-ci.yml +++ b/.github/workflows/sysop_write_tests-ci.yml @@ -1,9 +1,10 @@ -name: Sysop write test CI +--- # Run Pywikibot write tests on test wiki using sysop rights +name: Sysop write test CI
on: push: - branches: [ master ] + branches: [master]
concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -18,64 +19,54 @@ runs-on: ubuntu-latest continue-on-error: ${{ matrix.experimental || false }} timeout-minutes: 100 - strategy: fail-fast: false - matrix: - python-version: [ "3.8" ] - site: [ "wikipedia:test" ] - attr: [ write and not rights, write and rights, rights and not write ] - + python-version: ['3.8'] + 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 - coverage run -m pytest -s -r A -a "${{ matrix.attr }}" - - - name: Show coverage statistics - run: | - coverage report - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - - name: Check on failure - if: steps.ci_test.outcome == 'failure' - run: exit 1 + - 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 + coverage run -m pytest -s -r A -a "${{ matrix.attr }}" + - name: Show coverage statistics + run: | + coverage report + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - name: Check on failure + if: steps.ci_test.outcome == 'failure' + run: exit 1 diff --git a/.github/workflows/windows_tests.yml b/.github/workflows/windows_tests.yml index 35e512c..13a2405 100644 --- a/.github/workflows/windows_tests.yml +++ b/.github/workflows/windows_tests.yml @@ -1,9 +1,10 @@ -name: Windows Tests +--- # Successor for Appveyor Tests +name: Windows Tests
on: push: - branches: [ master ] + branches: [master]
concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -18,77 +19,67 @@ runs-on: windows-latest continue-on-error: ${{ matrix.experimental || false }} timeout-minutes: 100 - strategy: fail-fast: false - matrix: - python-version: [ 3.8.0, "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ] - python-arch: [ x64, x86 ] - site: [ "wikipedia:en" ] - + python-version: [3.8.0, '3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + python-arch: [x64, x86] + site: ['wikipedia:en'] 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 }} - architecture: ${{ matrix.python-arch }} - - - name: Install dependencies - shell: powershell - run: | - git submodule update --init - python --version - python -c "import struct; print('PYTHON_ARCH:', struct.calcsize('P') << 3)" - python -m pip install --upgrade pip - pip --version - if ('${{ matrix.python-version }}' -ge '3.12') { - pip install -U setuptools; - } - pip install -r dev-requirements.txt - pip install -r requirements.txt - pip install wikitextparser - - - name: Generate user files - run: | - python -Werror::UserWarning -m pwb generate_user_files -site:${{matrix.site}} -user:${{ env.PYWIKIBOT_USERNAME }} -v -debug; - 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 "transliteration_target = None" >> 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 - id: ci_test - continue-on-error: true - timeout-minutes: 90 - env: - PYTHONIOENCODING: utf-8 - run: | - python pwb.py version - coverage run -m unittest discover -vv -p "*_tests.py"; - - - name: Show coverage statistics - run: | - coverage report - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - - name: Check on failure - if: steps.ci_test.outcome == 'failure' - run: exit 1 + - 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 }} + architecture: ${{ matrix.python-arch }} + - name: Install dependencies + shell: powershell + run: | + git submodule update --init + python --version + python -c "import struct; print('PYTHON_ARCH:', struct.calcsize('P') << 3)" + python -m pip install --upgrade pip + pip --version + if ('${{ matrix.python-version }}' -ge '3.12') { + pip install -U setuptools; + } + pip install -r dev-requirements.txt + pip install -r requirements.txt + pip install wikitextparser + - name: Generate user files + run: | + python -Werror::UserWarning -m pwb generate_user_files -site:${{matrix.site}} -user:${{ env.PYWIKIBOT_USERNAME }} -v -debug; + 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 "transliteration_target = None" >> 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 + id: ci_test + continue-on-error: true + timeout-minutes: 90 + env: + PYTHONIOENCODING: utf-8 + run: | + python pwb.py version + coverage run -m unittest discover -vv -p "*_tests.py"; + - name: Show coverage statistics + run: | + coverage report + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - name: Check on failure + if: steps.ci_test.outcome == 'failure' + run: exit 1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f92ce04..04b0fe6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,8 @@ +--- default_install_hook_types: - commit-msg - pre-commit + repos: - repo: meta hooks: @@ -33,12 +35,12 @@ - id: double-quote-string-fixer - id: end-of-file-fixer - id: fix-byte-order-marker - exclude: '^tests/data/' + exclude: ^tests/data/ - id: forbid-new-submodules - id: mixed-line-ending - id: pretty-format-json # list required for tab - args: ["--autofix", "--indent", "\t", "--no-ensure-ascii"] + args: [--autofix, --indent, "\t", --no-ensure-ascii] - id: trailing-whitespace args: - --markdown-linebreak-ext=rst @@ -62,12 +64,12 @@ files: .+.py$ language: python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.0 + rev: v0.12.1 hooks: - id: ruff-check alias: ruff args: - - --fix + - --fix - repo: https://github.com/asottile/pyupgrade rev: v3.20.0 hooks:
pywikibot-commits@lists.wikimedia.org