ci: Pass X11 socket to tests

Pass the X11 socket of the Linux CI runners to the container where our
CI tests run, with the `-g` flag of `dev_scripts/env.py`. By having a
working X11 socket, we can run GUI tests. Prior to this fix, we would
encounter this error:

    tests/gui/test_main_window.py::test_change_document_button qt.qpa.xcb: could not connect to display
    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

    Available platform plugins are: xcb, offscreen, wayland-egl, wayland, eglfs, vnc, minimalegl, vkkhrdisplay, linuxfb, minimal.

Another alternative we considered was to use the
`QT_QPA_PLATFORM=offscreen` environment variable. This alternative
works, but it's less close to the end-user's environment, so we decided
in favor of the approach above.
This commit is contained in:
Alex Pyrgiotis 2023-07-24 13:49:56 +03:00
parent f58e31efe6
commit a1e3cb27a7
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA

View file

@ -178,7 +178,7 @@ jobs:
- run: - run:
name: Run CI tests name: Run CI tests
command: | command: |
./dev_scripts/env.py --distro ubuntu --version 23.04 run --dev \ ./dev_scripts/env.py --distro ubuntu --version 23.04 run -g --dev \
bash -c 'cd dangerzone; poetry run make test' bash -c 'cd dangerzone; poetry run make test'
ci-ubuntu-kinetic: ci-ubuntu-kinetic:
@ -205,7 +205,7 @@ jobs:
- run: - run:
name: Run CI tests name: Run CI tests
command: | command: |
./dev_scripts/env.py --distro ubuntu --version 22.10 run --dev \ ./dev_scripts/env.py --distro ubuntu --version 22.10 run -g --dev \
bash -c 'cd dangerzone; poetry run make test' bash -c 'cd dangerzone; poetry run make test'
ci-ubuntu-jammy: ci-ubuntu-jammy:
@ -232,7 +232,7 @@ jobs:
- run: - run:
name: Run CI tests name: Run CI tests
command: | command: |
./dev_scripts/env.py --distro ubuntu --version 22.04 run --dev \ ./dev_scripts/env.py --distro ubuntu --version 22.04 run -g --dev \
bash -c 'cd dangerzone; poetry run make test' bash -c 'cd dangerzone; poetry run make test'
ci-ubuntu-focal: ci-ubuntu-focal:
@ -259,7 +259,7 @@ jobs:
- run: - run:
name: Run CI tests name: Run CI tests
command: | command: |
./dev_scripts/env.py --distro ubuntu --version 20.04 run --dev \ ./dev_scripts/env.py --distro ubuntu --version 20.04 run -g --dev \
bash -c 'cd dangerzone; poetry run make test' bash -c 'cd dangerzone; poetry run make test'
ci-fedora-38: ci-fedora-38:
@ -286,7 +286,7 @@ jobs:
- run: - run:
name: Run CI tests name: Run CI tests
command: | command: |
./dev_scripts/env.py --distro fedora --version 38 run --dev \ ./dev_scripts/env.py --distro fedora --version 38 run -g --dev \
bash -c 'cd dangerzone; poetry run make test' bash -c 'cd dangerzone; poetry run make test'
ci-fedora-37: ci-fedora-37:
@ -313,7 +313,7 @@ jobs:
- run: - run:
name: Run CI tests name: Run CI tests
command: | command: |
./dev_scripts/env.py --distro fedora --version 37 run --dev \ ./dev_scripts/env.py --distro fedora --version 37 run -g --dev \
bash -c 'cd dangerzone; poetry run make test' bash -c 'cd dangerzone; poetry run make test'
ci-debian-trixie: ci-debian-trixie:
@ -340,7 +340,7 @@ jobs:
- run: - run:
name: Run CI tests name: Run CI tests
command: | command: |
./dev_scripts/env.py --distro debian --version trixie run --dev \ ./dev_scripts/env.py --distro debian --version trixie run -g --dev \
bash -c 'cd dangerzone; poetry run make test' bash -c 'cd dangerzone; poetry run make test'
ci-debian-bookworm: ci-debian-bookworm:
@ -367,7 +367,7 @@ jobs:
- run: - run:
name: Run CI tests name: Run CI tests
command: | command: |
./dev_scripts/env.py --distro debian --version bookworm run --dev \ ./dev_scripts/env.py --distro debian --version bookworm run -g --dev \
bash -c 'cd dangerzone; poetry run make test' bash -c 'cd dangerzone; poetry run make test'
# NOTE: Making CI tests work in Debian Bullseye requires some tip-toeing # NOTE: Making CI tests work in Debian Bullseye requires some tip-toeing
@ -427,7 +427,7 @@ jobs:
- run: - run:
name: Run CI tests name: Run CI tests
command: | command: |
./dev_scripts/env.py --distro debian --version bullseye run --dev \ ./dev_scripts/env.py --distro debian --version bullseye run -g --dev \
bash -c 'cd dangerzone; poetry run make test' bash -c 'cd dangerzone; poetry run make test'
build-ubuntu-lunar: build-ubuntu-lunar: