@@ -25,14 +25,35 @@ jobs:
2525 with :
2626 python-version : ${{ matrix.python-version }}
2727
28+ # ADDED: Headless Qt/EGL/XCB dependencies
29+ - name : Install system dependencies (Ubuntu)
30+ if : runner.os == 'Linux'
31+ run : |
32+ sudo apt-get update -qq
33+ sudo apt-get install -y --no-install-recommends \
34+ libegl1 libgl1 libopengl0 libglx-mesa0 \
35+ libxcb-cursor0 libxcb-icccm4 libxcb-image0 \
36+ libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
37+ libxcb-shape0 libxcb-xfixes0 libxcb-xinerama0 \
38+ libxkbcommon-x11-0 libxkbcommon0 x11-utils xvfb
39+
2840 - name : Install Python dependencies
2941 run : |
3042 python -m pip install --upgrade pip
3143 pip install -r requirements.txt
3244 pip install pytest
3345
46+ # ADDED: bash shell, xvfb wrapper, and offscreen environment variables
3447 - name : Run Python tests
35- run : python -m pytest tests/ -v --tb=short
48+ shell : bash
49+ env :
50+ QT_QPA_PLATFORM : offscreen
51+ run : |
52+ if [ "$RUNNER_OS" == "Linux" ]; then
53+ xvfb-run -a python -m pytest tests/ -v --tb=short
54+ else
55+ python -m pytest tests/ -v --tb=short
56+ fi
3657
3758 # =========================================================================
3859 # Job 2: Run npm tests
5980 with :
6081 python-version : ' 3.12'
6182
83+ # ADDED: The Node wrapper also needs the display libs if it calls the Python backend
84+ - name : Install system dependencies (Ubuntu)
85+ if : runner.os == 'Linux'
86+ run : |
87+ sudo apt-get update -qq
88+ sudo apt-get install -y --no-install-recommends \
89+ libegl1 libgl1 libopengl0 libglx-mesa0 \
90+ libxcb-cursor0 libxcb-icccm4 libxcb-image0 \
91+ libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
92+ libxcb-shape0 libxcb-xfixes0 libxcb-xinerama0 \
93+ libxkbcommon-x11-0 libxkbcommon0 x11-utils xvfb
94+
6295 - name : Install Python dependencies
6396 run : |
6497 python -m pip install --upgrade pip
@@ -72,9 +105,18 @@ jobs:
72105 working-directory : npm
73106 run : npm run build
74107
108+ # ADDED: Wrapper for npm tests to prevent underlying Python scripts from crashing
75109 - name : Run npm tests
76110 working-directory : npm
77- run : npm test
111+ shell : bash
112+ env :
113+ QT_QPA_PLATFORM : offscreen
114+ run : |
115+ if [ "$RUNNER_OS" == "Linux" ]; then
116+ xvfb-run -a npm test
117+ else
118+ npm test
119+ fi
78120
79121 # =========================================================================
80122 # Job 3: Publish to npm
@@ -104,4 +146,4 @@ jobs:
104146 working-directory : npm
105147 run : npm publish --access public
106148 env :
107- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
149+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments