|
| 1 | +name: gui-tests-ubuntu24 |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - 'tests/**' |
| 7 | + - '.github/workflows/gui-tests-ubuntu24.yml' |
| 8 | + branches: ['main', 'feat/**'] |
| 9 | + pull_request: |
| 10 | + paths: |
| 11 | + - 'tests/**' |
| 12 | + - '.github/workflows/gui-tests-ubuntu24.yml' |
| 13 | + branches: ['main'] |
| 14 | + |
| 15 | +jobs: |
| 16 | + gui-tests: |
| 17 | + name: GUI tests (Linux headless) |
| 18 | + runs-on: ubuntu-24.04 |
| 19 | + env: |
| 20 | + PYTHONPATH: ${{ github.workspace }} |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Set up Python |
| 26 | + uses: actions/setup-python@v4 |
| 27 | + with: |
| 28 | + python-version: 3.11 |
| 29 | + |
| 30 | + - name: Install system packages for headless Qt |
| 31 | + run: | |
| 32 | + set -e |
| 33 | + sudo apt-get update -y |
| 34 | + # Conservative set of packages that on ubuntu-24.04 commonly provide |
| 35 | + # libEGL.so.1 and other Mesa/GL dependencies. Some package names may |
| 36 | + # differ across images; continue on failure to keep the job non-fatal |
| 37 | + # while we iterate. |
| 38 | + sudo apt-get install -y --no-install-recommends \ |
| 39 | + xvfb \ |
| 40 | + libegl-mesa0 libegl1 libgbm1 libglx-mesa0 libgl1-mesa-dri libgl1-mesa-glx \ |
| 41 | + libgles2 libx11-6 libx11-xcb1 libxcb1 libxrandr2 libxkbcommon0 \ |
| 42 | + fontconfig fonts-dejavu-core fonts-dejavu-extra || true |
| 43 | + # Refresh font cache |
| 44 | + sudo fc-cache -f -v || true |
| 45 | +
|
| 46 | + - name: Install Python dependencies (pytest-qt + PySide6) |
| 47 | + run: | |
| 48 | + python -m pip install --upgrade pip |
| 49 | + python -m pip install -r requirements-dev-minimal.txt |
| 50 | + python -m pip install pytest-qt |
| 51 | + # prefer binary wheels and retry once if the first attempt fails |
| 52 | + python -m pip install --prefer-binary --no-cache-dir "PySide6>=6.5,<7" || \ |
| 53 | + (sleep 3 && python -m pip install --prefer-binary --no-cache-dir "PySide6>=6.5,<7") || \ |
| 54 | + python -m pip install --no-deps --force-reinstall "PySide6>=6.5,<7" |
| 55 | +
|
| 56 | + - name: Sanity check PySide6 import (non-fatal) and collect diagnostics |
| 57 | + id: sanity |
| 58 | + run: | |
| 59 | + set -e |
| 60 | + echo 'Sanity: check PySide6 can be imported and report platform info (non-fatal)' |
| 61 | + python - <<'PY' || true |
| 62 | + import importlib, sys, traceback, subprocess |
| 63 | + try: |
| 64 | + m = importlib.import_module('PySide6') |
| 65 | + v = getattr(m, '__version__', 'unknown') |
| 66 | + print('PySide6 import OK, version:', v) |
| 67 | + from PySide6 import QtCore |
| 68 | + print('QtCore QT_VERSION_STR:', QtCore.QT_VERSION_STR) |
| 69 | + except Exception: |
| 70 | + print('PySide6 import failed (sanity check):', file=sys.stderr) |
| 71 | + traceback.print_exc() |
| 72 | + # Try to provide more diagnostics: locate shiboken6 and run ldd to show missing shared objects. |
| 73 | + try: |
| 74 | + shib = importlib.import_module('shiboken6') |
| 75 | + path = getattr(shib, '__file__', None) |
| 76 | + if path: |
| 77 | + print('\n== ldd for shiboken6 binary ==') |
| 78 | + subprocess.run(['ldd', path], check=False) |
| 79 | + except Exception: |
| 80 | + pass |
| 81 | + # Exit with non-zero so the subsequent output-based gate will detect failure |
| 82 | + sys.exit(1) |
| 83 | + PY |
| 84 | +
|
| 85 | + - name: Set import_ok output |
| 86 | + id: set_import_ok |
| 87 | + run: | |
| 88 | + # Write a single output line for the runner (true if PySide6 imports) |
| 89 | + if python -c "import importlib; importlib.import_module('PySide6')" >/dev/null 2>&1; then |
| 90 | + echo "import_ok=true" >> "$GITHUB_OUTPUT" |
| 91 | + else |
| 92 | + echo "import_ok=false" >> "$GITHUB_OUTPUT" |
| 93 | + fi |
| 94 | +
|
| 95 | + - name: Initialize test database for CI |
| 96 | + run: | |
| 97 | + # Ensure the repo root is on PYTHONPATH so tools/ci_init_db.py can import local packages |
| 98 | + export PYTHONPATH="${{ github.workspace }}" |
| 99 | + python tools/ci_init_db.py || true |
| 100 | +
|
| 101 | + - name: Run GUI-marked tests |
| 102 | + if: steps.set_import_ok.outputs.import_ok == 'true' |
| 103 | + run: | |
| 104 | + export QT_QPA_PLATFORM=offscreen |
| 105 | + xvfb-run -s '-screen 0 1280x1024x24' pytest -q -m gui |
| 106 | +
|
| 107 | + - name: Skip GUI tests notice |
| 108 | + if: steps.set_import_ok.outputs.import_ok != 'true' |
| 109 | + run: | |
| 110 | + echo 'PySide6 import failed — skipping GUI tests on this runner.' |
| 111 | + echo 'See earlier step "Sanity check PySide6 import" for ldd diagnostics.' |
0 commit comments