Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1295540?usp=email )
Change subject: GH tests: use WMCS SOCKS tunnel composite action with GitHub actions ......................................................................
GH tests: use WMCS SOCKS tunnel composite action with GitHub actions
Also finally close socket in doctest.yml
Change-Id: I47e4d814d43976dc2436209eceefbaac60fd1075 --- M .github/workflows/doctest.yml M .github/workflows/login_tests-ci.yml M .github/workflows/oauth_tests-ci.yml M .github/workflows/pywikibot-ci.yml 4 files changed, 18 insertions(+), 72 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/.github/workflows/doctest.yml b/.github/workflows/doctest.yml index 0b53b10..1d71ba2 100644 --- a/.github/workflows/doctest.yml +++ b/.github/workflows/doctest.yml @@ -82,6 +82,12 @@ python pwb.py version pytest --version coverage run -m pytest pywikibot --doctest-modules --ignore-glob="*gui.py" --ignore-glob="*memento.py" --doctest-wait + - name: Close WMCS SOCKS tunnel + if: always() + run: |- + if [ -f ssh.pid ]; then + kill "$(cat ssh.pid)" || true + fi - name: Show coverage statistics run: | coverage combine || true diff --git a/.github/workflows/login_tests-ci.yml b/.github/workflows/login_tests-ci.yml index 610b50f..7edffb7 100644 --- a/.github/workflows/login_tests-ci.yml +++ b/.github/workflows/login_tests-ci.yml @@ -103,30 +103,10 @@ pip install requests pip install requests[socks] - 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 \ - "$USER@bastion.wmcloud.org" - echo "Socket connection:" - 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 + uses: ./.github/actions/wmcs-socks + with: + ssh_user: ${{ secrets.WMCS_USER }} + ssh_key: ${{ secrets.WMCS_SSH_KEY }} - name: Generate family files env: HTTP_PROXY: socks5h://127.0.0.1:1080 diff --git a/.github/workflows/oauth_tests-ci.yml b/.github/workflows/oauth_tests-ci.yml index 03f45a6..03f427e 100644 --- a/.github/workflows/oauth_tests-ci.yml +++ b/.github/workflows/oauth_tests-ci.yml @@ -86,30 +86,10 @@ pip install requests pip install requests[socks] - 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 \ - "$USER@bastion.wmcloud.org" - echo "Socket connection:" - 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 + uses: ./.github/actions/wmcs-socks + with: + ssh_user: ${{ secrets.WMCS_USER }} + ssh_key: ${{ secrets.WMCS_SSH_KEY }} - name: Generate family files if: ${{ matrix.family == 'wpbeta' }} env: diff --git a/.github/workflows/pywikibot-ci.yml b/.github/workflows/pywikibot-ci.yml index 68694f7..c348a7b 100644 --- a/.github/workflows/pywikibot-ci.yml +++ b/.github/workflows/pywikibot-ci.yml @@ -104,30 +104,10 @@ 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 \ - "$USER@bastion.wmcloud.org" - echo "Socket connection:" - 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 + uses: ./.github/actions/wmcs-socks + with: + ssh_user: ${{ secrets.WMCS_USER }} + ssh_key: ${{ secrets.WMCS_SSH_KEY }} - name: Generate family files env: HTTP_PROXY: socks5h://127.0.0.1:1080
pywikibot-commits@lists.wikimedia.org