Skip to content

CompareScreenshotTest: mitigate a race condition causing tests to fail #16

CompareScreenshotTest: mitigate a race condition causing tests to fail

CompareScreenshotTest: mitigate a race condition causing tests to fail #16

Workflow file for this run

name: test
on: [push, pull_request]
jobs:
test-linux:
runs-on: ubuntu-latest
steps:
- name: Update Package Information
run: sudo apt-get update
- name: Install Dependencies
run: sudo apt-get install -y xvfb mesa-utils libgl1-mesa-dri libglx-mesa0 libxrender-dev libx11-dev libxext-dev
- uses: actions/checkout@v6
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'temurin'
cache: gradle
- name: Build with Gradle
run: |
export XVFB_WHD="1920x1080x24"
export DISPLAY=":99"
export GALLIUM_DRIVER="llvmpipe"
export LIBGL_ALWAYS_SOFTWARE="1"
export LIBGL_DEBUG="verbose"
# Start Xvfb with GLX support
echo "Starting Xvfb"
Xvfb :99 -ac -screen 0 "$XVFB_WHD" -nolisten tcp +extension GLX +extension RENDER -noreset > /tmp/xvfb.log 2>&1 &
Xvfb_pid="$!"
echo "Waiting for Xvfb (PID: $Xvfb_pid) to be ready..."
sleep 2
for i in {1..30}; do
if xdpyinfo -display "${DISPLAY}" > /dev/null 2>&1; then
echo "Xvfb is running."
break
fi
sleep 0.5
done
# Verify GLX works
glxinfo -display :99 2>&1 | head -20 || echo "glxinfo not available, continuing anyway"
./gradlew --no-daemon test
# Clean up Xvfb
kill $Xvfb_pid 2>/dev/null || true
cat /tmp/xvfb.log || true
- name: Upload Images
uses: actions/upload-artifact@v4
with:
name: images-linux
path: |
target/*.png
build/**/*.png
test-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'temurin'
cache: gradle
- name: Download Mesa
uses: carlosperate/download-file-action@v2
with:
file-url: 'https://downloads.fdossena.com/geth.php?r=mesa64-latest'
file-name: 'mesa64-latest.7z'
location: '.'
- name: Overwrite opengl32.dll with Mesa
uses: DuckSoft/extract-7z-action@v1.0
with:
pathSource: mesa64-latest.7z
pathTarget: C:\WINDOWS\SYSTEM32\
- name: Build with Gradle
run: ./gradlew --no-daemon test
- name: Upload Images
uses: actions/upload-artifact@v6
with:
name: images-windows
path: |
target/*.png
build/**/*.png