I am trying to run a test suite on GitHub Actions for a package that wraps utilities for calling the clipboard on a variety of platforms. While I have managed to get headless testing set up for a Linux system using X11, based on running xvfb
, I am struggling to find documentation for how to set up a headless Wayland-based system for testing the utility wl-clipboard.
The current action I'm running installs sway, creates the required XDG_RUNTIME_DIR
, and then runs sway
. I suspect I am not starting sway
correctly because I can't seem to get it to startup and stay running in the background while the rest of the tests run.
- name: Install wayland
if: ${{ matrix.config.clip_type == 'wayland' }}
run: |
mkdir $XDG_RUNTIME_DIR
chown $USER $XDG_RUNTIME_DIR
chmod 0700 $XDG_RUNTIME_DIR
sudo apt-get update
sudo apt-get purge x11-*
sudo apt-get install sway meson libwayland-dev
echo $XDG_RUNTIME_DIR
ls -la $XDG_RUNTIME_DIR
sway -d -V
cd $GITHUB_WORKSPACE/..
git clone https://github.com/bugaevc/wl-clipboard.git
cd wl-clipboard
meson build
cd build/
sudo ninja install
wl-copy --primary
wl-paste --primary
cd $GITHUB_WORKSPACE
env:
XDG_RUNTIME_DIR: /home/runner/work/clipr/xdg
WLR_BACKENDS: headless
WLR_LIBINPUT_NO_DEVICES: 1
WAYLAND_DISPLAY: wayland-1
GTK_USE_PORTAL: 0
See the verbose logs from sway
. Running sway
like this in the foreground, it just hangs indefinitely. Naively trying to run sway in the background using nohup sway &
results in the later calls to the utilities saying Failed to connect to a Wayland server
.
Any suggestions for getting a headless Wayland server up and running?