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

Change subject: [tests] Enable logged in tests with github actions
......................................................................

[tests] Enable logged in tests with github actions

- set PYWIKIBOT_USERNAME environment
- Password is set by secrets on github
- increase max-parallel
- always set site, otherwise the test is not collected
- add usernames settings to config file
- create password file

Bug: T296371
Change-Id: I931c63e9b387b9f85fdfb4f1e047536f4445f936
---
M .github/workflows/pywikibot-ci.yml
1 file changed, 16 insertions(+), 4 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.github/workflows/pywikibot-ci.yml 
b/.github/workflows/pywikibot-ci.yml
index 4eaef12..712e989 100644
--- a/.github/workflows/pywikibot-ci.yml
+++ b/.github/workflows/pywikibot-ci.yml
@@ -12,6 +12,7 @@

 env:
   PYWIKIBOT_TESTS_RUNNING: 1
+  PYWIKIBOT_USERNAME: Pywikibot-test

 jobs:
   build:
@@ -20,7 +21,7 @@

     strategy:
       fail-fast: false
-      max-parallel: 7
+      max-parallel: 8

       matrix:
         python-version: ["pypy3", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
@@ -28,10 +29,12 @@
         test_prod_only: [true]
         include:
           - python-version: "3.6"
+            site: False
             family: wpbeta
             code: en
             experimental: true
           - python-version: "3.6"
+            site: False
             family: wpbeta
             code: zh
             experimental: true
@@ -88,14 +91,23 @@

     - name: Generate user files
       run: |
-        if [ ${{matrix.site}} ]; then
-          python -Werror::UserWarning -m pwb generate_user_files 
-site:${{matrix.site}} -v -debug
+        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}} -v -debug
+          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 "max_retries = 3" >> 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
       env:

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/752676
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: I931c63e9b387b9f85fdfb4f1e047536f4445f936
Gerrit-Change-Number: 752676
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to