Skip to content

Commit d955cbd

Browse files
authored
move screenshot tests into a separate workflow and attempt at fixing for macos
1 parent 0ebc16b commit d955cbd

3 files changed

Lines changed: 230 additions & 144 deletions

File tree

.github/workflows/integration.yml

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
name: Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- v3.7
8+
- v3.6
9+
- v3.5
10+
- v3.4
11+
- v3.3
12+
- ios-2024_2
13+
pull_request:
14+
workflow_dispatch:
15+
16+
jobs:
17+
ScreenshotTests:
18+
name: Run Screenshot Tests
19+
runs-on: ubuntu-latest
20+
container:
21+
image: ghcr.io/onemillionworlds/opengl-docker-image:v1
22+
permissions:
23+
contents: read
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Setup the java environment
28+
uses: actions/setup-java@v4
29+
with:
30+
distribution: temurin
31+
java-version: '21'
32+
33+
- name: Start xvfb
34+
run: |
35+
Xvfb :99 -ac -screen 0 1024x768x16 &
36+
export DISPLAY=:99
37+
echo "DISPLAY=:99" >> $GITHUB_ENV
38+
39+
- name: Report GL/Vulkan
40+
run: |
41+
set -x
42+
echo "DISPLAY=$DISPLAY"
43+
glxinfo | grep -E "OpenGL version|OpenGL renderer|OpenGL vendor" || true
44+
vulkaninfo --summary || true
45+
echo "VK_ICD_FILENAMES=$VK_ICD_FILENAMES"
46+
echo "MESA_LOADER_DRIVER_OVERRIDE=$MESA_LOADER_DRIVER_OVERRIDE"
47+
echo "GALLIUM_DRIVER=$GALLIUM_DRIVER"
48+
49+
- name: Validate the Gradle wrapper
50+
uses: gradle/actions/wrapper-validation@v3
51+
52+
- name: Test with Gradle Wrapper
53+
run: |
54+
./gradlew --no-daemon :jme3-screenshot-tests:screenshotTest
55+
56+
- name: Upload Test Reports
57+
uses: actions/upload-artifact@v4
58+
if: always()
59+
with:
60+
name: screenshot-test-report
61+
retention-days: 30
62+
path: |
63+
**/build/reports/**
64+
**/build/changed-images/**
65+
**/build/test-results/**
66+
67+
ScreenshotTestsMacOS:
68+
name: Run Screenshot Tests (macOS)
69+
runs-on: macos-15-intel
70+
permissions:
71+
contents: read
72+
steps:
73+
- uses: actions/checkout@v4
74+
75+
- name: Setup the java environment
76+
uses: actions/setup-java@v4
77+
with:
78+
distribution: temurin
79+
java-version: '21'
80+
81+
- name: Validate the Gradle wrapper
82+
uses: gradle/actions/wrapper-validation@v3
83+
84+
- name: Prepare patched GLFW for macOS software renderer
85+
shell: bash
86+
run: |
87+
set -euo pipefail
88+
89+
if ! command -v cmake >/dev/null 2>&1; then
90+
brew install cmake
91+
fi
92+
93+
curl -L -o glfw-3.4.tar.gz https://github.com/glfw/glfw/archive/refs/tags/3.4.tar.gz
94+
tar -xzf glfw-3.4.tar.gz
95+
mv glfw-3.4 glfw-src
96+
97+
python3 - <<'PY'
98+
from pathlib import Path
99+
100+
p = Path("glfw-src/src/nsgl_context.m")
101+
text = p.read_text()
102+
103+
old = " ADD_ATTRIB(NSOpenGLPFAAccelerated);"
104+
new = (
105+
" ADD_ATTRIB(NSOpenGLPFARendererID);\n"
106+
" ADD_ATTRIB(kCGLRendererGenericFloatID);"
107+
)
108+
109+
if old not in text:
110+
raise SystemExit("Patch anchor not found in src/nsgl_context.m")
111+
112+
p.write_text(text.replace(old, new, 1))
113+
print("Patched src/nsgl_context.m")
114+
PY
115+
116+
cmake -S glfw-src -B glfw-build \
117+
-D BUILD_SHARED_LIBS=ON \
118+
-D GLFW_BUILD_EXAMPLES=OFF \
119+
-D GLFW_BUILD_TESTS=OFF \
120+
-D GLFW_BUILD_DOCS=OFF \
121+
-D CMAKE_BUILD_TYPE=Release \
122+
-D CMAKE_OSX_ARCHITECTURES=x86_64
123+
124+
cmake --build glfw-build --config Release --parallel 3
125+
126+
mkdir -p ci-glfw
127+
if [ -f glfw-build/src/libglfw.3.dylib ]; then
128+
cp glfw-build/src/libglfw.3.dylib ci-glfw/libglfw-ci.dylib
129+
elif [ -f glfw-build/src/libglfw.dylib ]; then
130+
cp glfw-build/src/libglfw.dylib ci-glfw/libglfw-ci.dylib
131+
else
132+
echo "Could not find built GLFW dylib"
133+
find glfw-build -name '*.dylib' -print
134+
exit 1
135+
fi
136+
137+
file ci-glfw/libglfw-ci.dylib
138+
otool -L ci-glfw/libglfw-ci.dylib
139+
140+
- name: Test with Gradle Wrapper
141+
env:
142+
JAVA_TOOL_OPTIONS: -Dorg.lwjgl.glfw.libname=${{ github.workspace }}/ci-glfw/libglfw-ci.dylib
143+
run: |
144+
./gradlew --no-daemon :jme3-screenshot-tests:screenshotTest
145+
146+
- name: Upload Test Reports
147+
uses: actions/upload-artifact@v4
148+
if: always()
149+
with:
150+
name: screenshot-test-report-macos
151+
retention-days: 30
152+
path: |
153+
**/build/reports/**
154+
**/build/changed-images/**
155+
**/build/test-results/**
156+
157+
ScreenshotTestsWindows:
158+
name: Run Screenshot Tests (Windows)
159+
runs-on: windows-latest
160+
permissions:
161+
contents: read
162+
steps:
163+
- uses: actions/checkout@v4
164+
165+
- name: Setup the java environment
166+
uses: actions/setup-java@v4
167+
with:
168+
distribution: 'temurin'
169+
java-version: '21'
170+
171+
- name: Set up Mesa3D for software OpenGL rendering
172+
shell: pwsh
173+
run: |
174+
$version = "24.2.4"
175+
$url = "https://github.com/pal1000/mesa-dist-win/releases/download/$version/mesa3d-$version-release-msvc.7z"
176+
Invoke-WebRequest -Uri $url -OutFile mesa3d.7z
177+
7z x mesa3d.7z -omesa3d
178+
179+
$javaBin = Join-Path $env:JAVA_HOME "bin"
180+
181+
# Deploy Mesa next to java.exe, because java.exe is the actual process executable.
182+
Copy-Item "mesa3d\x64\*.dll" "$javaBin\" -Force
183+
184+
# Force app-local DLL resolution for java.exe if the process would otherwise bypass it.
185+
New-Item -ItemType File -Force -Path (Join-Path $javaBin "java.exe.local") | Out-Null
186+
187+
# Start with llvmpipe first; it is Mesa's intended software fallback.
188+
"GALLIUM_DRIVER=llvmpipe" | Out-File -FilePath $env:GITHUB_ENV -Append
189+
190+
- name: Validate the Gradle wrapper
191+
uses: gradle/actions/wrapper-validation@v3
192+
193+
- name: Test with Gradle Wrapper
194+
shell: bash
195+
run: |
196+
./gradlew --no-daemon :jme3-screenshot-tests:screenshotTest
197+
198+
- name: Upload Test Reports
199+
uses: actions/upload-artifact@v4
200+
if: always()
201+
with:
202+
name: screenshot-test-report-windows
203+
retention-days: 30
204+
path: |
205+
**/build/reports/**
206+
**/build/changed-images/**
207+
**/build/test-results/**

.github/workflows/main.yml

Lines changed: 1 addition & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -57,132 +57,6 @@ on:
5757
types: [published]
5858

5959
jobs:
60-
ScreenshotTests:
61-
name: Run Screenshot Tests
62-
runs-on: ubuntu-latest
63-
container:
64-
image: ghcr.io/onemillionworlds/opengl-docker-image:v1
65-
permissions:
66-
contents: read
67-
steps:
68-
- uses: actions/checkout@v4
69-
- name: Start xvfb
70-
run: |
71-
Xvfb :99 -ac -screen 0 1024x768x16 &
72-
export DISPLAY=:99
73-
echo "DISPLAY=:99" >> $GITHUB_ENV
74-
- name: Report GL/Vulkan
75-
run: |
76-
set -x
77-
echo "DISPLAY=$DISPLAY"
78-
glxinfo | grep -E "OpenGL version|OpenGL renderer|OpenGL vendor" || true
79-
vulkaninfo --summary || true
80-
echo "VK_ICD_FILENAMES=$VK_ICD_FILENAMES"
81-
echo "MESA_LOADER_DRIVER_OVERRIDE=$MESA_LOADER_DRIVER_OVERRIDE"
82-
echo "GALLIUM_DRIVER=$GALLIUM_DRIVER"
83-
- name: Validate the Gradle wrapper
84-
uses: gradle/actions/wrapper-validation@v3
85-
- name: Test with Gradle Wrapper
86-
run: |
87-
./gradlew :jme3-screenshot-test:screenshotTest
88-
- name: Upload Test Reports
89-
uses: actions/upload-artifact@master
90-
if: always()
91-
with:
92-
name: screenshot-test-report
93-
retention-days: 30
94-
path: |
95-
**/build/reports/**
96-
**/build/changed-images/**
97-
**/build/test-results/**
98-
99-
ScreenshotTestsMacOS:
100-
name: Run Screenshot Tests (macOS)
101-
runs-on: macos-15-intel
102-
permissions:
103-
contents: read
104-
steps:
105-
- uses: actions/checkout@v4
106-
107-
- name: Setup the java environment
108-
uses: actions/setup-java@v4
109-
with:
110-
distribution: temurin
111-
java-version: '21'
112-
113-
- name: Validate the Gradle wrapper
114-
uses: gradle/actions/wrapper-validation@v3
115-
116-
- name: Test with Gradle Wrapper
117-
run: ./gradlew --no-daemon :jme3-screenshot-tests:screenshotTest
118-
119-
- name: Upload Test Reports
120-
uses: actions/upload-artifact@v4
121-
if: always()
122-
with:
123-
name: screenshot-test-report-macos
124-
retention-days: 30
125-
path: |
126-
**/build/reports/**
127-
**/build/changed-images/**
128-
**/build/test-results/**
129-
130-
ScreenshotTestsWindows:
131-
name: Run Screenshot Tests (Windows)
132-
runs-on: windows-latest
133-
permissions:
134-
contents: read
135-
steps:
136-
- uses: actions/checkout@v4
137-
138-
- name: Setup the java environment
139-
uses: actions/setup-java@v4
140-
with:
141-
distribution: 'temurin'
142-
java-version: '21'
143-
144-
- name: Set up Mesa3D for software OpenGL rendering
145-
shell: pwsh
146-
run: |
147-
$version = "24.2.4"
148-
$url = "https://github.com/pal1000/mesa-dist-win/releases/download/$version/mesa3d-$version-release-msvc.7z"
149-
Invoke-WebRequest -Uri $url -OutFile mesa3d.7z
150-
7z x mesa3d.7z -omesa3d
151-
152-
$javaBin = Join-Path $env:JAVA_HOME "bin"
153-
154-
# Deploy Mesa next to java.exe, because java.exe is the actual process executable.
155-
Copy-Item "mesa3d\x64\*.dll" "$javaBin\" -Force
156-
157-
# Force app-local DLL resolution for java.exe if the process would otherwise bypass it.
158-
New-Item -ItemType File -Force -Path (Join-Path $javaBin "java.exe.local") | Out-Null
159-
160-
# Start with llvmpipe first; it is Mesa's intended software fallback.
161-
"GALLIUM_DRIVER=llvmpipe" | Out-File -FilePath $env:GITHUB_ENV -Append
162-
163-
# Remove these until base loading works; add back only if you really need them.
164-
# "MESA_GL_VERSION_OVERRIDE=3.3" | Out-File -FilePath $env:GITHUB_ENV -Append
165-
# "MESA_GLSL_VERSION_OVERRIDE=330" | Out-File -FilePath $env:GITHUB_ENV -Append
166-
167-
- name: Validate the Gradle wrapper
168-
uses: gradle/actions/wrapper-validation@v3
169-
170-
- name: Test with Gradle Wrapper
171-
shell: bash
172-
run: |
173-
./gradlew --no-daemon :jme3-screenshot-tests:screenshotTest
174-
175-
- name: Upload Test Reports
176-
uses: actions/upload-artifact@v4
177-
if: always()
178-
with:
179-
name: screenshot-test-report-windows
180-
retention-days: 30
181-
path: |
182-
**/build/reports/**
183-
**/build/changed-images/**
184-
**/build/test-results/**
185-
18660
# Build iOS natives
18761
BuildIosNatives:
18862
name: Build natives for iOS
@@ -709,4 +583,4 @@ jobs:
709583
branch="gh-pages"
710584
git push origin "$branch" --force || true
711585
712-
fi
586+
fi

0 commit comments

Comments
 (0)