Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1049229?usp=email )
Change subject: [tests] Add experimental Windows tests as successor for Appveyor tests ......................................................................
[tests] Add experimental Windows tests as successor for Appveyor tests
Bug: T368192 Change-Id: Ieb737cbebb734cc0babcfab063102d683f70b687 --- M .github/workflows/doctest.yml M .github/workflows/oauth_tests-ci.yml M .github/workflows/pywikibot-ci.yml M .github/workflows/sysop_write_tests-ci.yml A .github/workflows/windows_tests.yml 5 files changed, 131 insertions(+), 3 deletions(-)
Approvals: Xqt: Verified; Looks good to me, approved
diff --git a/.github/workflows/doctest.yml b/.github/workflows/doctest.yml index 56c5c54..a8c91f0 100644 --- a/.github/workflows/doctest.yml +++ b/.github/workflows/doctest.yml @@ -20,7 +20,7 @@
strategy: fail-fast: false - max-parallel: 14 + max-parallel: 17
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" ] diff --git a/.github/workflows/oauth_tests-ci.yml b/.github/workflows/oauth_tests-ci.yml index 64598d0..598833d 100644 --- a/.github/workflows/oauth_tests-ci.yml +++ b/.github/workflows/oauth_tests-ci.yml @@ -20,6 +20,7 @@
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" ] diff --git a/.github/workflows/pywikibot-ci.yml b/.github/workflows/pywikibot-ci.yml index d45d1ef..511f07b 100644 --- a/.github/workflows/pywikibot-ci.yml +++ b/.github/workflows/pywikibot-ci.yml @@ -1,5 +1,5 @@ name: Pywikibot CI -# Run Pywikibot tests with a variety of Python versions +# Run Pywikibot tests with a variety of Python versions
on: push: @@ -23,7 +23,7 @@
strategy: fail-fast: false - max-parallel: 17 + max-parallel: 18
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" ] diff --git a/.github/workflows/sysop_write_tests-ci.yml b/.github/workflows/sysop_write_tests-ci.yml index 6d692cb..9d6219f 100644 --- a/.github/workflows/sysop_write_tests-ci.yml +++ b/.github/workflows/sysop_write_tests-ci.yml @@ -21,6 +21,7 @@
strategy: fail-fast: false + max-parallel: 2
matrix: python-version: [ "3.7" ] diff --git a/.github/workflows/windows_tests.yml b/.github/workflows/windows_tests.yml new file mode 100644 index 0000000..661f476 --- /dev/null +++ b/.github/workflows/windows_tests.yml @@ -0,0 +1,126 @@ +name: Windows Tests +# Successor for Appveyor Tests + +on: + push: + branches: [ master, stable ] + pull_request: + branches: [ master ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + PYWIKIBOT_TEST_RUNNING: 1 + PYWIKIBOT_USERNAME: Pywikibot-test + +jobs: + build: + runs-on: ${{ matrix.os || 'ubuntu-latest' }} + continue-on-error: ${{ matrix.experimental || false }} + timeout-minutes: 100 + + strategy: + fail-fast: false + max-parallel: 10 + + matrix: + python-version: [ "3.7.0", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13.0-alpha - 3.13.0" ] + python-arch: [ x64, x86 ] + site: [ "wikipedia:en" ] + test_prod_only: [ false ] + experimental: [ true ] + + 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 }} + architecture: ${{ matrix.python-arch }} + + # 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 }} + architecture: ${{ matrix.python-arch }} + + - name: Install dependencies + 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}} == '3.7.0'; then pip install "urllib3<2.0"; fi + if [ ${{matrix.python-version}} == '3.7.0'; then pip install -U setuptools; fi + if [ ${{matrix.python-version}} >= '3.12'; then pip install -U setuptools; fi + 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: 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 }} + PYWIKIBOT_TEST_PROD_ONLY: ${{ matrix.test_prod_only && 1 || 0 }} + run: | + python pwb.py version + if [ ${{matrix.site || 0}} != 'wikipedia:test' ]; then + coverage run -m unittest discover -vv -p "*_tests.py"; + else + pytest --cov=.; + fi + + - name: Show coverage statistics + run: | + coverage report + + - 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