Skip to content

Commit

Permalink
ci: use Xvfb and pulseaudio
Browse files Browse the repository at this point in the history
  • Loading branch information
florianvazelle committed Dec 31, 2023
1 parent e34f519 commit 06a5e61
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .github/actions/setup-godot/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Setup Godot
description: Setup Godot dependencies.
runs:
using: "composite"
steps:

- name: Installing Linux dependencies
if: ${{ runner.os == 'Linux' }}
shell: bash
run: sudo apt-get install -y pulseaudio xvfb x11-xserver-utils mesa-vulkan-drivers

- name: Starting X11 server on :0
if: ${{ runner.os == 'Linux' }}
shell: bash
run: xset -q || /bin/bash -c "sudo Xvfb -ac :0 -screen 0 1920x1080x24 > /dev/null 2>&1 &"
env:
DISPLAY: ":0"

- name: Check that X11 server is running
if: ${{ runner.os == 'Linux' }}
uses: nick-fields/retry@v2
with:
timeout_minutes: 1
max_attempts: 5
command: /bin/bash -c "xset -q > /dev/null 2>&1"
env:
DISPLAY: ":0"

- name: Starting dummy sound device
if: ${{ runner.os == 'Linux' }}
uses: nick-fields/retry@v2
with:
timeout_minutes: 1
max_attempts: 3
command: pulseaudio --check || pulseaudio -D
6 changes: 6 additions & 0 deletions .github/workflows/release-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ jobs:
- name: Load dotenv
run: just ci-load-dotenv

- name: Setup Godot dependencies
uses: ./.github/actions/setup-godot

- name: Export
run: just export

Expand All @@ -68,6 +71,9 @@ jobs:
- name: Load dotenv
run: just ci-load-dotenv

- name: Setup Godot dependencies
uses: ./.github/actions/setup-godot

- name: Export
run: just export-web

Expand Down
25 changes: 24 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ import-resources:

# Godot binary wrapper
@godot *ARGS: makedirs install-godot install-templates
{{ godot_bin }} {{ ARGS }}
#!/usr/bin/env sh
if [ "{{ env("CI", "false") }}" = "true" ]; then
just ci-godot-x11 {{ ARGS }}
else
{{ godot_bin }} {{ ARGS }}
fi
# Open the Godot editor
editor:
Expand Down Expand Up @@ -196,6 +201,24 @@ ci-load-dotenv:
echo "game_name={{ game_name }}" >> $GITHUB_ENV
echo "game_version={{ game_version }}" >> $GITHUB_ENV

# Starts godot using Xvfb and pulseaudio
ci-godot-x11 *ARGS:
#!/bin/bash
set -e
# Set locale to 'en' if locale is not already set.
# Godot will fallback to this locale anyway and it
# prevents an error message being printed to console.
[ "$LANG" == "C.UTF-8" ] && LANG=en || true

# Start dummy sound device.
pulseaudio --check || pulseaudio -D

# Running godot with X11 Display.
xvfb-run --auto-servernum {{ godot_bin }} {{ ARGS }}

# Cleanup (allowed to fail).
pulseaudio -k || true

# Download Butler
[private]
install-butler: makedirs
Expand Down

0 comments on commit 06a5e61

Please sign in to comment.