Xqt has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913653 )

Change subject: [tests] Add write_tests action
......................................................................

[tests] Add write_tests action

Change-Id: I6b6abaaa20787002f095eaa3f52ecfbfc3eef960
---
A .github/workflows/write_tests-ci.yml
1 file changed, 94 insertions(+), 0 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved




diff --git a/.github/workflows/write_tests-ci.yml 
b/.github/workflows/write_tests-ci.yml
new file mode 100644
index 0000000..9aa1d4e
--- /dev/null
+++ b/.github/workflows/write_tests-ci.yml
@@ -0,0 +1,85 @@
+name: Pywikibot CI
+# Run Pywikibot tests  with a variety of Python versions
+
+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: 'ubuntu-latest'
+    continue-on-error: ${{ matrix.experimental || false }}
+    timeout-minutes: 120
+
+    strategy:
+      fail-fast: false
+      max-parallel: 16
+
+      matrix:
+        python-version: ["3.7"]
+        site: ['wikipedia:test']
+        experimental: [true]
+
+    steps:
+    - name: Checkout Repository
+      uses: actions/checkout@v3
+      with:
+        submodules: true
+
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v4
+      with:
+        python-version: ${{ matrix.python-version }}
+
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip --version
+        pip install -U setuptools
+        if [ -f dev-requirements.txt ]; then pip install -r 
dev-requirements.txt; fi
+        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
+        python -c "import setuptools; print('setuptools:', 
setuptools.__version__)"
+
+    - 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: Test with unittest or 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 --cov=.; -a 'write'
+
+    - name: Upload coverage to Codecov
+      uses: codecov/codecov-action@v3
+
+    - name: Check on failure
+      if: steps.ci_test.outcome == 'failure'
+      run: exit 1

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913653
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I6b6abaaa20787002f095eaa3f52ecfbfc3eef960
Gerrit-Change-Number: 913653
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <i...@gno.de>
Gerrit-Reviewer: Xqt <i...@gno.de>
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org

Reply via email to