Skip to content

ci: expose native Qt crashes and stalled test stacks #40

ci: expose native Qt crashes and stalled test stacks

ci: expose native Qt crashes and stalled test stacks #40

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
qt-binding-probe:
name: Isolated Qt binding (${{ matrix.qt }})
runs-on: ubuntu-latest
timeout-minutes: 8
strategy:
fail-fast: false
matrix:
qt: ["6.11.2", "6.12.0"]
env:
QT_QPA_PLATFORM: offscreen
PYTHONIOENCODING: utf-8
steps:
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Linux Qt runtime
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends libegl1 libgl1 libxkbcommon-x11-0
- name: Install isolated binding
run: python -m pip install "PySide6_Essentials==${{ matrix.qt }}"
- name: Exercise virtual highlighter callbacks without product code
run: |
python -X faulthandler -u - <<'PY'
import gc
import sys
import PySide6
import shiboken6
from PySide6.QtGui import QSyntaxHighlighter, QTextCharFormat, QTextDocument
from PySide6.QtWidgets import QApplication
class Probe(QSyntaxHighlighter):
calls = 0
def highlightBlock(self, text):
self.calls += 1
self.setCurrentBlockState(0)
self.setFormat(0, len(text), QTextCharFormat())
app = QApplication([])
document = QTextDocument()
highlighter = Probe(document)
print("versions", sys.version, PySide6.__version__, shiboken6.__version__)
print("initial None references", sys.getrefcount(None))
for iteration in range(1000):
document.setPlainText(("plain text " + str(iteration) + "\n") * 10)
highlighter.rehighlight()
app.processEvents()
if iteration % 100 == 0:
gc.collect()
print("iteration", iteration, "callbacks", highlighter.calls,
"None references", sys.getrefcount(None))
assert highlighter.calls >= 1000
print("PROBE_COMPLETED", highlighter.calls, sys.getrefcount(None))
PY
lint:
name: Lint & Code Style
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install Linting Tools
run: |
python -m pip install --upgrade pip
python -m pip install ruff
- name: Run Ruff Lint Check
run: ruff check .
test:
name: Test (${{ matrix.os }} - Python ${{ matrix.python-version }})
needs: lint
runs-on: ${{ matrix.os }}
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
env:
PYTEST_DISABLE_PLUGIN_AUTOLOAD: "1"
QT_QPA_PLATFORM: offscreen
PYTHONIOENCODING: utf-8
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install Linux Qt Runtime Dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libegl1 \
libgl1 \
libxkbcommon-x11-0 \
libxcb-cursor0 \
libxcb-icccm4 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-xinerama0 \
libxcb-xkb1
- name: Install Project Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt pytest Pillow tomli
- name: Run Pytest Test Suite
run: python -X faulthandler -u -m pytest -s -v -o faulthandler_timeout=60