diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f0ea5f7d3..82142dc79 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -147,9 +147,9 @@ jobs: }}-${{ hashFiles('requirements.txt') }} - name: Set system-wide proxy using PAC URL - run: echo "auto_proxy=http://proxy-doc.ird.fr/proxy.pac" | sudo tee -a /etc/environment - env: - auto_proxy: http://proxy-doc.ird.fr/proxy.pac + run: | + echo "auto_proxy=http://proxy-doc.ird.fr/proxy.pac" | sudo tee -a /etc/environment + echo "auto_proxy=http://proxy-doc.ird.fr/proxy.pac" >> $GITHUB_ENV - name: Verify proxy settings run: env | grep -i proxy @@ -160,6 +160,7 @@ jobs: sudo apt-get update sudo apt-get install ${{ matrix.client }} sudo apt-get install mesa-utils xvfb + sudo apt-get install wmctrl xdotool curl -LO https://github.com/jgm/pandoc/releases/download/3.1.11.1/pandoc-3.1.11.1-linux-amd64.tar.gz tar xvzf pandoc-3.1.11.1-linux-amd64.tar.gz sudo mv pandoc-3.1.11.1/bin/pandoc /usr/bin diff --git a/.github/workflows/src/ci.yaml b/.github/workflows/src/ci.yaml index 91504e17a..be4aafda8 100644 --- a/.github/workflows/src/ci.yaml +++ b/.github/workflows/src/ci.yaml @@ -136,9 +136,9 @@ jobs: - *cache - name: Set system-wide proxy using PAC URL - run: echo "auto_proxy=http://proxy-doc.ird.fr/proxy.pac" | sudo tee -a /etc/environment - env: - auto_proxy: http://proxy-doc.ird.fr/proxy.pac + run: | + echo "auto_proxy=http://proxy-doc.ird.fr/proxy.pac" | sudo tee -a /etc/environment + echo "auto_proxy=http://proxy-doc.ird.fr/proxy.pac" >> $GITHUB_ENV - name: Verify proxy settings run: env | grep -i proxy @@ -149,6 +149,7 @@ jobs: sudo apt-get update sudo apt-get install ${{ matrix.client }} sudo apt-get install mesa-utils xvfb + sudo apt-get install wmctrl xdotool curl -LO https://github.com/jgm/pandoc/releases/download/3.1.11.1/pandoc-3.1.11.1-linux-amd64.tar.gz tar xvzf pandoc-3.1.11.1-linux-amd64.tar.gz sudo mv pandoc-3.1.11.1/bin/pandoc /usr/bin diff --git a/test/behave b/test/behave index f5b6db91b..5ee773934 100755 --- a/test/behave +++ b/test/behave @@ -7,7 +7,7 @@ import os import re import shutil, shlex import subprocess -import sys +import sys, time, threading import tarfile from pygit2 import Repository import glob @@ -71,7 +71,7 @@ parser.add_argument('--inspire-hep', '--no-inspire-hep', dest='inspireHEP', acti parser.add_argument('--worker', '--no-worker', dest='worker', action=BooleanAction, default=False) parser.add_argument('--logging', '--no-logging', dest='logging', action=BooleanAction, default=False) parser.add_argument('--caching', '--no-caching', dest='caching', action=BooleanAction, default=True) -parser.add_argument('--headless', '--no-headless', dest='headless', action=BooleanAction, default=platform.system() == 'Linux') +parser.add_argument('--headless', '--no-headless', dest='headless', action=BooleanAction, default=platform.system() == 'Linux' and not os.getenv('XDG_SESSION_TYPE')) parser.add_argument('--this', action='store_true') parser.add_argument('--test-this', action='store_true') parser.add_argument('--slow', action='store_true', @@ -176,9 +176,33 @@ class InstallLastRunner(Runner): if install: locations.append(install) return locations +def cancel_proxy(): + for i in range(20): + print('cancel-proxy: looking for proxy auth window') + result = subprocess.run(['wmctrl', '-l'], capture_output=True, text=True) + window_id = None + for line in result.stdout.splitlines(): + if 'Authentication Required - Zotero' in line: + window_id = line.split()[0] + break + + time.sleep(5) + if window_id: + print('cancel proxy:', window_id) + time.sleep(3) + subprocess.run(['xdotool', 'windowactivate', '--sync', window_id, 'key', 'Escape']) + return + + print('cancel proxy: no window found') + def main(): config = Configuration() + thread = None + thread = threading.Thread(target=cancel_proxy) + thread.start() sys.exit(run_behave(config, runner_class=InstallLastRunner)) + if thread: + thread.join() if args.headless: from xvfbwrapper import Xvfb