Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ This is a monorepo containing a collection of GitHub Actions maintained by Lizar

## actions

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

## Contributions

Expand Down
33 changes: 19 additions & 14 deletions actions/screenshot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ points in time or for debugging purposes.
No preparation needed! These platforms have built-in screenshot capabilities.

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

```yaml
- name: Setup virtual display
uses: aganders3/headless-gui@v2
uses: LizardByte/actions/actions/setup_virtual_desktop@master
with:
environment: xfce
```

## 🚀 Basic Usage
Expand Down Expand Up @@ -189,22 +191,25 @@ jobs:
screenshot:
runs-on: ubuntu-latest
steps:
- name: Setup virtual desktop
uses: LizardByte/actions/actions/setup_virtual_desktop@master
with:
environment: xfce

- name: Setup screenshot tool
id: screenshot
uses: LizardByte/actions/actions/screenshot@master

- name: Setup and use headless display
uses: aganders3/headless-gui@v2
with:
run: |
# Launch something visual
xeyes &
sleep 2

# Take multiple screenshots
${{ steps.screenshot.outputs.tool-path }} --output-path=screenshot1.png
sleep 1
${{ steps.screenshot.outputs.tool-path }} --output-path=screenshot2.png --delay=500
- name: Take screenshots
run: |
# Launch something visual
xeyes &
sleep 2

# Take multiple screenshots
${{ steps.screenshot.outputs.tool-path }} --output-path=screenshot1.png
sleep 1
${{ steps.screenshot.outputs.tool-path }} --output-path=screenshot2.png --delay=500

- name: Upload screenshots
uses: actions/upload-artifact@v6
Expand Down
1 change: 1 addition & 0 deletions actions/screenshot/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ runs:
with:
name: screenshot-${{ runner.os }}
path: screenshot.png
if-no-files-found: error
12 changes: 0 additions & 12 deletions actions/screenshot/post-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,3 @@ fi

echo ""
echo "Screenshot validation successful!"

# Cleanup Xvfb if running on Linux
if [[ "$OSTYPE" == "linux-gnu"* && -f /tmp/xvfb_screenshot.pid ]]; then
XVFB_PID=$(cat /tmp/xvfb_screenshot.pid)
if ps -p "$XVFB_PID" > /dev/null 2>&1; then
echo ""
echo "Cleaning up Xvfb (PID: $XVFB_PID)..."
kill "$XVFB_PID" || true
rm -f /tmp/xvfb_screenshot.pid
echo "✓ Xvfb stopped"
fi
fi
48 changes: 7 additions & 41 deletions actions/screenshot/pre-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,18 @@ echo "Pre-CI: Setting up display for screenshot tests..."

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

# Install xvfb if not already present
if ! command -v Xvfb &> /dev/null; then
echo "Installing Xvfb..."
sudo apt-get update -qq
sudo apt-get install -y -qq xvfb
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*
fi

# Start Xvfb on display :99
echo "Starting Xvfb virtual display on :99..."
Xvfb :99 -screen 0 1024x768x24 &
XVFB_PID=$!

# Save PID for cleanup in post-ci
echo "$XVFB_PID" > /tmp/xvfb_screenshot.pid

# Set DISPLAY environment variable
export DISPLAY=:99
echo "DISPLAY=$DISPLAY" >> "$GITHUB_ENV"

# Wait a moment for Xvfb to start
sleep 2

# Verify Xvfb is running
if ps -p $XVFB_PID > /dev/null; then
echo "✓ Xvfb is running (PID: $XVFB_PID)"
echo "✓ DISPLAY set to :99"
else
echo "✗ Failed to start Xvfb"
exit 1
fi

# Optional: Start a simple window manager for more realistic testing
if command -v fluxbox &> /dev/null; then
echo "Starting fluxbox window manager..."
fluxbox &
sleep 1
fi
# Call the setup_virtual_desktop action's setup script
chmod +x ./actions/setup_virtual_desktop/setup_desktop.sh
./actions/setup_virtual_desktop/setup_desktop.sh \
--environment=xfce \
--display-size=1280x720

else
echo "Not Linux - no display setup needed"
echo "OS: $OSTYPE"
fi

echo ""
echo "Display setup complete!"
echo "Pre-CI setup complete!"
Loading
Loading