Xqt has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1287995?usp=email )

Change subject: [tests] Add SOCKS proxy support to pywikibot-ci
......................................................................

[tests] Add SOCKS proxy support to pywikibot-ci

Bug: T426484
Change-Id: I30c95a5be9e1b15093e6ec4a8e4562a1c5e6bd2a
---
M .github/workflows/pywikibot-ci.yml
1 file changed, 39 insertions(+), 0 deletions(-)

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




diff --git a/.github/workflows/pywikibot-ci.yml 
b/.github/workflows/pywikibot-ci.yml
index 70888aa..3c108dd 100644
--- a/.github/workflows/pywikibot-ci.yml
+++ b/.github/workflows/pywikibot-ci.yml
@@ -93,6 +93,7 @@
           pip install -r dev-requirements.txt
           pip install -r requirements.txt
           pip install wikitextparser
+          pip install requests[socks]
       - name: Install DjVuLibre
         if: runner.os == 'Linux'
         run: |
@@ -103,7 +104,41 @@
       - name: Install setuptools
         if: ${{ (matrix.python-version >= '3.12') || (matrix.os == 
'macOS-latest') }}
         run: pip install setuptools
+      - name: Configure and start WMCS SOCKS tunnel
+        env:
+          USER: ${{ secrets.WMCS_USER }}
+        run: |
+          mkdir -p ~/.ssh
+          printf "%s" "${{ secrets.WMCS_SSH_KEY }}" > ~/.ssh/id_ed25519
+          chmod 600 ~/.ssh/id_ed25519
+          ssh-keygen -lf ~/.ssh/id_ed25519
+          ssh-keyscan bastion.wmcloud.org >> ~/.ssh/known_hosts
+          ssh \
+            -o StrictHostKeyChecking=accept-new \
+            -o ExitOnForwardFailure=yes \
+            -o ServerAliveInterval=30 \
+            -o ServerAliveCountMax=3 \
+            -o ConnectTimeout=10 \
+            -f -N \
+            -D 127.0.0.1:1080 \
+            -i ~/.ssh/id_ed25519 \
+            "[email protected]"
+          echo
+          echo "Socket connection"
+          ss -lntp | grep 1080 || true
+          echo
+          echo "Local IP:"
+          curl -s https://api.ipify.org
+          echo
+          echo "Proxy IP:"
+          curl --proxy socks5h://127.0.0.1:1080 -s https://api.ipify.org
+          echo
       - name: Generate family files
+        env:
+          HTTP_PROXY: socks5h://127.0.0.1:1080
+          HTTPS_PROXY: socks5h://127.0.0.1:1080
+          ALL_PROXY: socks5h://127.0.0.1:1080
+          NO_PROXY: ""
         run: |
           if  [ ${{matrix.family || 0}} == wpbeta ]; then
             python pwb.py generate_family_file 
http://${{matrix.code}}.wikipedia.beta.wmcloud.org/ wpbeta y
@@ -136,6 +171,10 @@
           PYWIKIBOT_TEST_NO_RC: ${{ (matrix.site == 'wikisource:zh' || 
matrix.test_no_rc) && 1 || 0 }}
           # Force GIL "off" due to mwparserfromhell issue as suggested by 
warning in T412624
           PYTHON_GIL: ${{ endsWith(matrix.python-version, 't') && '0' || '1' }}
+          HTTP_PROXY: socks5h://127.0.0.1:1080
+          HTTPS_PROXY: socks5h://127.0.0.1:1080
+          ALL_PROXY: socks5h://127.0.0.1:1080
+          NO_PROXY: ""
         run: |
           python pwb.py version
           if [ "${{ matrix.site }}" != "wikisource:zh" ] ||

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I30c95a5be9e1b15093e6ec4a8e4562a1c5e6bd2a
Gerrit-Change-Number: 1287995
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to