8

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.

Aaron Franke
  • 3,268
  • 4
  • 31
  • 51

3 Answers3

6

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
FrBrGeorge
  • 610
  • 7
  • 8
3

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
User Rebo
  • 3,056
  • 25
  • 30
-2

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
Meiswjn
  • 752
  • 6
  • 17
  • 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.` – Aaron Franke Jul 29 '20 at 20:20
  • 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. – silicontrip Sep 18 '20 at 01:53
  • 2
    The question concerns environments, which have no display/video hardware, so one need to use special virtual X server, such as Xvfb – FrBrGeorge Oct 17 '21 at 07:34