Skip to content

Commit a921618

Browse files
feat(actions): add setup_virtual_desktop action
Introduces a new composite action, setup_virtual_desktop, for setting up a virtual desktop environment on Linux runners, including scripts, documentation, and CI matrix.
1 parent cbe2bc5 commit a921618

File tree

15 files changed

+938
-79
lines changed

15 files changed

+938
-79
lines changed

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@ This is a monorepo containing a collection of GitHub Actions maintained by Lizar
99

1010
## actions
1111

12-
| Action | Description | Type | Language |
13-
|-------------------------------------------------------|----------------------------------------------|-----------|------------------|
14-
| [audit_repos](actions/audit_repos#readme) | Audit repositories in an organization | composite | javascript |
15-
| [facebook_post](actions/facebook_post#readme) | Post to Facebook page/group using Graph API | docker | python |
16-
| [monitor_space](actions/monitor_space#readme) | Monitor and track minimum free disk space | composite | bash |
17-
| [more_space](actions/more_space#readme) | Free up disk space in GitHub Actions runners | composite | bash |
18-
| [release_changelog](actions/release_changelog#readme) | Generate a changelog for the latest release | composite | javascript |
19-
| [release_create](actions/release_create#readme) | Create a new release | composite | bash, javascript |
20-
| [release_homebrew](actions/release_homebrew#readme) | Validate and update Homebrew formula | composite | bash, python |
21-
| [release_setup](actions/release_setup#readme) | Prepare a release | docker | python |
22-
| [setup_cuda](actions/setup_cuda#readme) | Set up NVIDIA CUDA Toolkit on Linux runners | composite | bash |
23-
| [setup_python](actions/setup_python#readme) | Set up Python environment | composite | bash |
12+
| Action | Description | Type | Language |
13+
|---------------------------------------------------------------|----------------------------------------------|-----------|------------------|
14+
| [audit_repos](actions/audit_repos#readme) | Audit repositories in an organization | composite | javascript |
15+
| [facebook_post](actions/facebook_post#readme) | Post to Facebook page/group using Graph API | docker | python |
16+
| [monitor_space](actions/monitor_space#readme) | Monitor and track minimum free disk space | composite | bash |
17+
| [more_space](actions/more_space#readme) | Free up disk space in GitHub Actions runners | composite | bash |
18+
| [release_changelog](actions/release_changelog#readme) | Generate a changelog for the latest release | composite | javascript |
19+
| [release_create](actions/release_create#readme) | Create a new release | composite | bash, javascript |
20+
| [release_homebrew](actions/release_homebrew#readme) | Validate and update Homebrew formula | composite | bash, python |
21+
| [release_setup](actions/release_setup#readme) | Prepare a release | docker | python |
22+
| [screenshot](actions/screenshot#readme) | Setup cross-platform screenshot CLI tool | composite | bash |
23+
| [setup_cuda](actions/setup_cuda#readme) | Set up NVIDIA CUDA Toolkit on Linux runners | composite | bash |
24+
| [setup_python](actions/setup_python#readme) | Set up Python environment | composite | bash |
25+
| [setup_virtual_desktop](actions/setup_virtual_desktop#readme) | Setup virtual desktop for GUI apps on Linux | composite | bash |
2426

2527
## Contributions
2628

actions/screenshot/README.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ points in time or for debugging purposes.
1212
No preparation needed! These platforms have built-in screenshot capabilities.
1313

1414
### Linux
15-
Linux requires a display server (X11 or Wayland) to be running. Use a display setup action before this one:
15+
Linux requires a display server (X11 or Wayland) to be running. Use the virtual desktop setup action before this one:
1616

1717
```yaml
1818
- name: Setup virtual display
19-
uses: aganders3/headless-gui@v2
19+
uses: LizardByte/actions/actions/setup_virtual_desktop@master
20+
with:
21+
environment: xfce
2022
```
2123
2224
## 🚀 Basic Usage
@@ -189,22 +191,25 @@ jobs:
189191
screenshot:
190192
runs-on: ubuntu-latest
191193
steps:
194+
- name: Setup virtual desktop
195+
uses: LizardByte/actions/actions/setup_virtual_desktop@master
196+
with:
197+
environment: xfce
198+
192199
- name: Setup screenshot tool
193200
id: screenshot
194201
uses: LizardByte/actions/actions/screenshot@master
195202

196-
- name: Setup and use headless display
197-
uses: aganders3/headless-gui@v2
198-
with:
199-
run: |
200-
# Launch something visual
201-
xeyes &
202-
sleep 2
203-
204-
# Take multiple screenshots
205-
${{ steps.screenshot.outputs.tool-path }} --output-path=screenshot1.png
206-
sleep 1
207-
${{ steps.screenshot.outputs.tool-path }} --output-path=screenshot2.png --delay=500
203+
- name: Take screenshots
204+
run: |
205+
# Launch something visual
206+
xeyes &
207+
sleep 2
208+
209+
# Take multiple screenshots
210+
${{ steps.screenshot.outputs.tool-path }} --output-path=screenshot1.png
211+
sleep 1
212+
${{ steps.screenshot.outputs.tool-path }} --output-path=screenshot2.png --delay=500
208213
209214
- name: Upload screenshots
210215
uses: actions/upload-artifact@v6

actions/screenshot/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,4 @@ runs:
7272
with:
7373
name: screenshot-${{ runner.os }}
7474
path: screenshot.png
75+
if-no-files-found: error

actions/screenshot/post-ci.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,3 @@ fi
3939

4040
echo ""
4141
echo "Screenshot validation successful!"
42-
43-
# Cleanup Xvfb if running on Linux
44-
if [[ "$OSTYPE" == "linux-gnu"* && -f /tmp/xvfb_screenshot.pid ]]; then
45-
XVFB_PID=$(cat /tmp/xvfb_screenshot.pid)
46-
if ps -p "$XVFB_PID" > /dev/null 2>&1; then
47-
echo ""
48-
echo "Cleaning up Xvfb (PID: $XVFB_PID)..."
49-
kill "$XVFB_PID" || true
50-
rm -f /tmp/xvfb_screenshot.pid
51-
echo "✓ Xvfb stopped"
52-
fi
53-
fi

actions/screenshot/pre-ci.sh

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,18 @@ echo "Pre-CI: Setting up display for screenshot tests..."
66

77
# Only need to setup display on Linux
88
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
9-
echo "Detected Linux - setting up virtual display..."
9+
echo "Detected Linux - setting up virtual desktop..."
1010

11-
# Install xvfb if not already present
12-
if ! command -v Xvfb &> /dev/null; then
13-
echo "Installing Xvfb..."
14-
sudo apt-get update -qq
15-
sudo apt-get install -y -qq xvfb
16-
sudo apt-get clean
17-
sudo rm -rf /var/lib/apt/lists/*
18-
fi
19-
20-
# Start Xvfb on display :99
21-
echo "Starting Xvfb virtual display on :99..."
22-
Xvfb :99 -screen 0 1024x768x24 &
23-
XVFB_PID=$!
24-
25-
# Save PID for cleanup in post-ci
26-
echo "$XVFB_PID" > /tmp/xvfb_screenshot.pid
27-
28-
# Set DISPLAY environment variable
29-
export DISPLAY=:99
30-
echo "DISPLAY=$DISPLAY" >> "$GITHUB_ENV"
31-
32-
# Wait a moment for Xvfb to start
33-
sleep 2
34-
35-
# Verify Xvfb is running
36-
if ps -p $XVFB_PID > /dev/null; then
37-
echo "✓ Xvfb is running (PID: $XVFB_PID)"
38-
echo "✓ DISPLAY set to :99"
39-
else
40-
echo "✗ Failed to start Xvfb"
41-
exit 1
42-
fi
43-
44-
# Optional: Start a simple window manager for more realistic testing
45-
if command -v fluxbox &> /dev/null; then
46-
echo "Starting fluxbox window manager..."
47-
fluxbox &
48-
sleep 1
49-
fi
11+
# Call the setup_virtual_desktop action's setup script
12+
chmod +x ./actions/setup_virtual_desktop/setup_desktop.sh
13+
./actions/setup_virtual_desktop/setup_desktop.sh \
14+
--environment=xfce \
15+
--display-size=1280x720
5016

5117
else
5218
echo "Not Linux - no display setup needed"
5319
echo "OS: $OSTYPE"
5420
fi
5521

5622
echo ""
57-
echo "Display setup complete!"
23+
echo "Pre-CI setup complete!"

0 commit comments

Comments
 (0)