Skip to content

Commit 06a5e61

Browse files
ci: use Xvfb and pulseaudio
1 parent e34f519 commit 06a5e61

File tree

3 files changed

+65
-1
lines changed

3 files changed

+65
-1
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Setup Godot
2+
description: Setup Godot dependencies.
3+
runs:
4+
using: "composite"
5+
steps:
6+
7+
- name: Installing Linux dependencies
8+
if: ${{ runner.os == 'Linux' }}
9+
shell: bash
10+
run: sudo apt-get install -y pulseaudio xvfb x11-xserver-utils mesa-vulkan-drivers
11+
12+
- name: Starting X11 server on :0
13+
if: ${{ runner.os == 'Linux' }}
14+
shell: bash
15+
run: xset -q || /bin/bash -c "sudo Xvfb -ac :0 -screen 0 1920x1080x24 > /dev/null 2>&1 &"
16+
env:
17+
DISPLAY: ":0"
18+
19+
- name: Check that X11 server is running
20+
if: ${{ runner.os == 'Linux' }}
21+
uses: nick-fields/retry@v2
22+
with:
23+
timeout_minutes: 1
24+
max_attempts: 5
25+
command: /bin/bash -c "xset -q > /dev/null 2>&1"
26+
env:
27+
DISPLAY: ":0"
28+
29+
- name: Starting dummy sound device
30+
if: ${{ runner.os == 'Linux' }}
31+
uses: nick-fields/retry@v2
32+
with:
33+
timeout_minutes: 1
34+
max_attempts: 3
35+
command: pulseaudio --check || pulseaudio -D

.github/workflows/release-packaging.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ jobs:
4444
- name: Load dotenv
4545
run: just ci-load-dotenv
4646

47+
- name: Setup Godot dependencies
48+
uses: ./.github/actions/setup-godot
49+
4750
- name: Export
4851
run: just export
4952

@@ -68,6 +71,9 @@ jobs:
6871
- name: Load dotenv
6972
run: just ci-load-dotenv
7073

74+
- name: Setup Godot dependencies
75+
uses: ./.github/actions/setup-godot
76+
7177
- name: Export
7278
run: just export-web
7379

Justfile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@ import-resources:
129129

130130
# Godot binary wrapper
131131
@godot *ARGS: makedirs install-godot install-templates
132-
{{ godot_bin }} {{ ARGS }}
132+
#!/usr/bin/env sh
133+
if [ "{{ env("CI", "false") }}" = "true" ]; then
134+
just ci-godot-x11 {{ ARGS }}
135+
else
136+
{{ godot_bin }} {{ ARGS }}
137+
fi
133138

134139
# Open the Godot editor
135140
editor:
@@ -196,6 +201,24 @@ ci-load-dotenv:
196201
echo "game_name={{ game_name }}" >> $GITHUB_ENV
197202
echo "game_version={{ game_version }}" >> $GITHUB_ENV
198203

204+
# Starts godot using Xvfb and pulseaudio
205+
ci-godot-x11 *ARGS:
206+
#!/bin/bash
207+
set -e
208+
# Set locale to 'en' if locale is not already set.
209+
# Godot will fallback to this locale anyway and it
210+
# prevents an error message being printed to console.
211+
[ "$LANG" == "C.UTF-8" ] && LANG=en || true
212+
213+
# Start dummy sound device.
214+
pulseaudio --check || pulseaudio -D
215+
216+
# Running godot with X11 Display.
217+
xvfb-run --auto-servernum {{ godot_bin }} {{ ARGS }}
218+
219+
# Cleanup (allowed to fail).
220+
pulseaudio -k || true
221+
199222
# Download Butler
200223
[private]
201224
install-butler: makedirs

0 commit comments

Comments
 (0)