Running Qt tests in Github actions using xvfb
I moved the pyqtkeybind repo to Github Actions recently. We run a few UI
tests using the X11 virtual framebuffer in the CI. The test registers
for a few hotkeys in X11 and then we use the
xdotool to mimic keyboard
invocations, finally assert on the trigger.
Migrating to Actions was not quite straightforward because of the xvfb
dependencies. Nice folks over at
pytest-qt have documented them here.
The final actions
yml is here. Key parts are below:
jobs: build: env: DISPLAY: ':99.0' -steps: - name: Install dependencies run:| sudo apt install -y xvfb x11-utils libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 xdotool - name: Test run:| xvfb-run --auto-servernum pytest
Actions has been nice positive experience, so far. It’s super easy to integrate external actions e.g. codecov etc. I’ll move over few more repos off Travis and Appveyor soon.