Running a GUI application on a CI service without X11
Asked Answered
A

3

10

I have a GUI application that I would like to set up testing for via GitHub Actions. I already have it set up so that GitHub Actions compiles the application on Ubuntu, but now what I would like to do is run the application for a few seconds and test if it crashes or not. However, currently it fails to start because there is no X11 server installed.

Is there a way that I can install a dummy X11 server, so that the application runs? I don't care about what is actually displayed, I just want the application to be able to open without failing due to the X11 server missing.

Alternatively, is there a way to install a dummy Wayland server? This app can also run on Wayland.

Abba answered 28/7, 2020 at 0:38 Comment(0)
H
8

You can try xvfb-run from Xvfb project. It starts your application(s) under fully compatible X Window server w/o any hardware (you can even run x11vnc among your apps and connect to the server over VNC, but I believe it's not your case for now). Personally I use xvfb-run for isolated screenless X.org-aware packages build, when, e. g., a package needs to take a snapshot of itself while making documentation.

$ xvfb-run x.org_application_binary
Hermetic answered 17/10, 2021 at 7:32 Comment(1)
xorg-server-xvfbJesusitajet
P
4

I use this command:

  linux:
    runs-on: ubuntu-latest

    steps:
        run: |
          export DISPLAY=:99
          sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
          mycommand
Pictorial answered 30/4, 2022 at 22:48 Comment(0)
B
-1

Yes, that is possible. Simply create a Docker Image with your X11 environment and deploy your application in it.

Alternatively, you can also just install X11 on your machine. Make sure to do it in every run, as the environments always fully reset:

sudo apt-get install xorg openbox
Brigitte answered 28/7, 2020 at 8:57 Comment(3)
Even with X11 installed, it says there's no display. I need a dummy display or something. ERROR: X11 Display is not available Error: Can't open display: ERROR: Unable to create DisplayServer, all display drivers failed.Abba
is your DISPLAY environment variable set? if you run an xterm it is set by default but if your terminal has not started from within X you will not have anything set. Normally its value is ":0.0" but not every case. Check its value by echoing it from within an xterm and then set it in the terminal you wish to tun the test from. (you may also have to deal with xauth and xhosts) Get you display variable set first.Maraud
The question concerns environments, which have no display/video hardware, so one need to use special virtual X server, such as XvfbHermetic

© 2022 - 2024 — McMap. All rights reserved.