Skip to content

Commit

Permalink
[tests] Move Pywikibot tests from Appveyor to Github action
Browse files Browse the repository at this point in the history
Solely Python 3.7.0 tests are tested on Appveyor because
they aren't avaliable at GitHub

Bug: T368192
Change-Id: If84db61a00aa2f57b0898b38d4afe69870206246
  • Loading branch information
xqt committed Jun 29, 2024
1 parent bf1c8ca commit 8b465ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 48 deletions.
34 changes: 6 additions & 28 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,12 @@ environment:
PYTHON_VERSION: "3.7.0"
PYTHON_ARCH: "32"


# AppVeyor pre-installs these versions onto build machines

- PYTHON: "C:\\Python37-x64"
PYTHON_VERSION: "3.7.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python38"
PYTHON_VERSION: "3.8.x"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python39-x64"
PYTHON_VERSION: "3.9.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python310"
PYTHON_VERSION: "3.10.x"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python311-x64"
PYTHON_VERSION: "3.11.x"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
PYTHON: "C:\\Python37"
PYTHON_VERSION: "3.7.0"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python312"
PYTHON_VERSION: "3.12.x"
PYTHON_ARCH: "32"
# Other versions are tested with GutHub actions

matrix:
fast_finish: false
Expand All @@ -66,19 +46,17 @@ install:
- python -c "import struct; print('PYTHON_ARCH:', struct.calcsize('P') << 3)"
- python -m pip install --upgrade pip
- pip --version
# required for Python 3.7.0
- if [%PYTHON_VERSION%]==[3.7.0] pip install "urllib3<2.0"
- if [%PYTHON_VERSION%]==[3.7.0] pip install -U setuptools
- if [%PYTHON_VERSION%]==[3.12.x] pip install -U setuptools
# other requirements
- pip install -r requirements.txt
- pip install -r dev-requirements.txt
- pip install wikitextparser

build: off

test_script:
- chcp 65001
- set PYTHONIOENCODING=utf8

- "mkdir %PYWIKIBOT_DIR%"
- "python -Werror::UserWarning -m pwb generate_user_files -dir:%PYWIKIBOT_DIR% -family:wikipedia -lang:en -v -debug -user:%PYWIKIBOT_USERNAME%"
- ps: "[IO.File]::AppendAllText($env:PYWIKIBOT_USER_CONFIG, 'maximum_GET_length = 5000; transliteration_target = None;')"
Expand Down
26 changes: 6 additions & 20 deletions .github/workflows/windows_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Windows Tests

on:
push:
branches: [ master, stable ]
pull_request:
branches: [ master ]

concurrency:
Expand All @@ -17,7 +15,7 @@ env:

jobs:
build:
runs-on: ${{ matrix.os || 'windows-latest' }}
runs-on: "windows-latest"
continue-on-error: ${{ matrix.experimental || false }}
timeout-minutes: 100

Expand All @@ -26,7 +24,7 @@ jobs:
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-version: [ "3.7.1", "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" ]
experimental: [ true ]
Expand All @@ -39,15 +37,6 @@ jobs:

- 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/[email protected]
if: "endsWith(matrix.python-version, '-dev')"
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.python-arch }}
Expand All @@ -59,30 +48,27 @@ jobs:
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 -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['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 "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 or pytest
- name: Test with unittest
id: ci_test
continue-on-error: true
timeout-minutes: 90
Expand Down

0 comments on commit 8b465ce

Please sign in to comment.