Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1004064?usp=email )
Change subject: [tests] merge sysop and write tests ......................................................................
[tests] merge sysop and write tests
sysop test need write environment flag; therefore merge them.
Change-Id: I3f041c2081249748c3ecdfb5b7b0c33df1c4d8cd --- R .github/workflows/sysop_write_tests-ci.yml D .github/workflows/write_tests-ci.yml 2 files changed, 24 insertions(+), 102 deletions(-)
Approvals: Xqt: Verified; Looks good to me, approved
diff --git a/.github/workflows/sysop_tests-ci.yml b/.github/workflows/sysop_write_tests-ci.yml similarity index 79% rename from .github/workflows/sysop_tests-ci.yml rename to .github/workflows/sysop_write_tests-ci.yml index 9275ff8..0c85ec3 100644 --- a/.github/workflows/sysop_tests-ci.yml +++ b/.github/workflows/sysop_write_tests-ci.yml @@ -1,5 +1,5 @@ -name: Sysop CI -# Run tests using sysop rights +name: Sysop write test CI +# Run Pywikibot write tests on test wiki using sysop rights
on: push: @@ -12,22 +12,23 @@ env: PYWIKIBOT_TEST_RUNNING: 1 PYWIKIBOT_USERNAME: Pywikibot-oauth - PYWIKIBOT_LOGIN_LOGOUT: 1
jobs: build: runs-on: ${{ matrix.os || 'ubuntu-latest' }} - timeout-minutes: 2 + continue-on-error: ${{ matrix.experimental || false }} + timeout-minutes: 100
strategy: fail-fast: false - max-parallel: 15 + 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"] + python-version: ["3.7"] family: ['wikipedia'] code: ['test'] domain: ['test.wikipedia.org'] + experimental: [true]
steps: - name: Checkout Repository @@ -60,31 +61,28 @@ python -m pip install --upgrade pip pip --version if [ -f dev-requirements.txt ]; then pip install -r dev-requirements.txt; fi - pip install "importlib_metadata ; python_version < '3.8'" - pip install mwparserfromhell - pip install mwoauth - pip install packaging - pip install requests - + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- 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 "authenticate['${{ matrix.domain }}'] = ('${{ steps.split.outputs._0 }}', '${{ steps.split.outputs._1 }}', '${{ steps.split.outputs._2 }}', '${{ steps.split.outputs._3 }}')" >> user-config.py + echo "usernames['wikipedia']['test'] = '${{ 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
- - name: Sysop tests with pytest + - name: Sysop and write tests with pytest id: ci_test continue-on-error: true - timeout-minutes: 1 + timeout-minutes: 90 env: PYWIKIBOT_TEST_OAUTH: ${{ secrets[format('{0}', steps.token.outputs.uppercase)] }} + PYWIKIBOT_TEST_WRITE: ${{ matrix.site == 'wikipedia:test' && 1 || 0}} run: | python pwb.py version - pytest -s -a rights --cov=.; + pytest -s -r A -a "rights or write" --cov=.;
- name: Show coverage statistics run: | diff --git a/.github/workflows/write_tests-ci.yml b/.github/workflows/write_tests-ci.yml deleted file mode 100644 index 8b83441..0000000 --- a/.github/workflows/write_tests-ci.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: Write test CI -# Run Pywikibot write tests on test wiki - -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: - runs-on: 'ubuntu-latest' - continue-on-error: ${{ matrix.experimental || false }} - timeout-minutes: 100 - - strategy: - fail-fast: false - max-parallel: 1 - - matrix: - python-version: ["3.7"] - site: ['wikipedia:test'] - 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 - 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']['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: 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 -a write --cov=.; - - - 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