Skip to content

Commit ccc9db5

Browse files
committed
ci: windows unity 6 resolve alttester
1 parent f73d3d4 commit ccc9db5

File tree

1 file changed

+49
-114
lines changed

1 file changed

+49
-114
lines changed

.github/workflows/ui-tests.yml

Lines changed: 49 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -203,58 +203,57 @@ jobs:
203203
run: .\setup-symlinks.ps1
204204
- name: Verify symlinks were created
205205
run: |
206-
Write-Output "Verifying symlinks..."
207-
Write-Output "Checking Editor folder:"
208-
if (Test-Path "sample-unity6/Assets/Editor") {
209-
Write-Output "✅ Editor folder exists"
210-
if ((Get-Item "sample-unity6/Assets/Editor").LinkType -eq "Junction") {
211-
Write-Output "✅ Editor is a symlink"
212-
Write-Output "Target: $((Get-Item 'sample-unity6/Assets/Editor').Target)"
213-
}
214-
Write-Output "Editor contents:"
215-
Get-ChildItem "sample-unity6/Assets/Editor" | Select-Object -First 10 Name
216-
Write-Output ""
217-
Write-Output "Looking for WindowsBuilderUnity6.cs:"
218-
if (Test-Path "sample-unity6/Assets/Editor/WindowsBuilderUnity6.cs") {
219-
Write-Output "✅ WindowsBuilderUnity6.cs found"
220-
} else {
221-
Write-Output "❌ WindowsBuilderUnity6.cs NOT found"
222-
exit 1
223-
}
224-
} else {
225-
Write-Output "❌ Editor folder does not exist"
206+
if (-not (Test-Path "sample-unity6/Assets/Editor/WindowsBuilderUnity6.cs")) {
207+
Write-Output "❌ Build script not found - symlink setup failed"
226208
exit 1
227209
}
210+
Write-Output "✅ Symlinks verified"
228211
# Don't delete Library folder - let Unity reuse cached package data if available
229212
# Deleting it forces a complete reimport which takes too long
230213
- name: Ensure Tests directory exists
231214
run: |
232-
Write-Output "Ensuring Tests directory/symlink exists..."
233215
if (-not (Test-Path "sample-unity6/Tests")) {
234-
Write-Output "Creating Tests directory..."
235-
New-Item -ItemType Directory -Path "sample-unity6/Tests" -Force
236-
} else {
237-
$item = Get-Item "sample-unity6/Tests"
238-
if ($item.LinkType) {
239-
Write-Output "✅ Tests is a symlink to: $($item.Target)"
216+
New-Item -ItemType Directory -Path "sample-unity6/Tests" -Force | Out-Null
217+
}
218+
- name: First build (resolves packages)
219+
run: |
220+
Write-Output "Running first build to trigger package resolution..."
221+
222+
$unityPath = "C:\Program Files\Unity\Hub\Editor\6000.0.58f2\Editor\Unity.exe"
223+
$projectPath = "${{ github.workspace }}\sample-unity6"
224+
$logFile = "${{ github.workspace }}\sample-unity6\first-build-log.txt"
225+
$buildPath = "${{ github.workspace }}\sample-unity6\Tests\Sample Unity 6 Windows.exe"
226+
227+
$arguments = @(
228+
"-projectPath", "`"$projectPath`"",
229+
"-executeMethod", "WindowsBuilderUnity6.BuildForAltTester",
230+
"-logFile", "`"$logFile`"",
231+
"-quit", "-batchmode", "-nographics",
232+
"--buildPath", "`"$buildPath`""
233+
)
234+
235+
# Run and ignore exit code (may fail on first attempt)
236+
$process = Start-Process -FilePath $unityPath `
237+
-ArgumentList $arguments `
238+
-Wait -PassThru -NoNewWindow
239+
240+
Write-Output "First build completed (exit code: $($process.ExitCode), may have failed, that's ok). Checking for AltTester..."
241+
242+
if (Test-Path "${{ github.workspace }}\sample-unity6\Library\PackageCache") {
243+
$altTesterFound = Get-ChildItem "${{ github.workspace }}\sample-unity6\Library\PackageCache" -Filter "*alttester*" -ErrorAction SilentlyContinue
244+
if ($altTesterFound) {
245+
Write-Output "✅ AltTester found in PackageCache after first build"
240246
} else {
241-
Write-Output "✅ Tests directory exists"
247+
Write-Output "⚠️ AltTester not found yet, but will be ready for second build"
242248
}
243249
}
244250
- name: Build Unity 6 Windows executable
245251
timeout-minutes: 20
246252
run: |
247253
Write-Output "Building Unity 6 Windows executable..."
248-
Write-Output "Note: First run will import packages then build. This may take 10-15 minutes."
249-
Write-Output ""
250-
Write-Output "Current directory: $(Get-Location)"
251-
Write-Output "Project path exists: $(Test-Path '${{ github.workspace }}\sample-unity6')"
252-
Write-Output "Assets folder exists: $(Test-Path '${{ github.workspace }}\sample-unity6\Assets')"
253-
Write-Output "Library folder exists: $(Test-Path '${{ github.workspace }}\sample-unity6\Library')"
254-
Write-Output ""
255-
Write-Output "Starting Unity build at: $(Get-Date -Format 'HH:mm:ss')"
254+
Write-Output "Started at: $(Get-Date -Format 'HH:mm:ss')"
256255
257-
# Run Unity and capture output in real-time
256+
# Run Unity build
258257
$unityPath = "C:\Program Files\Unity\Hub\Editor\6000.0.58f2\Editor\Unity.exe"
259258
$projectPath = "${{ github.workspace }}\sample-unity6"
260259
$logFile = "${{ github.workspace }}\sample-unity6\build-log.log"
@@ -274,71 +273,21 @@ jobs:
274273
-Wait -PassThru -NoNewWindow
275274
276275
$buildExitCode = $process.ExitCode
276+
Write-Output "Finished at: $(Get-Date -Format 'HH:mm:ss') (exit code: $buildExitCode)"
277277
278-
Write-Output ""
279-
Write-Output "Unity build finished at: $(Get-Date -Format 'HH:mm:ss')"
280-
281-
Write-Output ""
282-
Write-Output "Build completed with exit code: $buildExitCode"
283-
284-
# Wait a moment for file system to settle
278+
# Verify build output
285279
Start-Sleep -Seconds 2
286-
287-
Write-Output ""
288-
Write-Output "Build log (last 100 lines):"
289-
$logPath = "${{ github.workspace }}\sample-unity6\build-log.log"
290-
if (Test-Path $logPath) {
291-
Write-Output "Log file found at: $logPath"
292-
Get-Content $logPath -Tail 100
280+
if (Test-Path $buildPath) {
281+
$fileSize = (Get-Item $buildPath).Length / 1MB
282+
Write-Output "✅ Build succeeded! ($([math]::Round($fileSize, 2)) MB)"
293283
} else {
294-
Write-Output "⚠️ Log file not found at: $logPath"
295-
Write-Output "Checking current directory..."
296-
if (Test-Path "sample-unity6\build-log.log") {
297-
Write-Output "Found in relative path!"
298-
Get-Content "sample-unity6\build-log.log" -Tail 100
299-
} else {
300-
Write-Output "Listing sample-unity6 directory:"
301-
Get-ChildItem "sample-unity6" -File | Where-Object { $_.Name -like "*.log" -or $_.Name -like "*.txt" } | Format-Table Name, Length, LastWriteTime
302-
}
303-
}
304-
305-
Write-Output ""
306-
Write-Output "Checking for build output..."
307-
Get-ChildItem sample-unity6/Tests/ -ErrorAction SilentlyContinue
308-
309-
Write-Output ""
310-
Write-Output "Searching for executable..."
311-
$exePaths = @(
312-
"${{ github.workspace }}\sample-unity6\Tests\Sample Unity 6 Windows.exe",
313-
"sample-unity6\Tests\Sample Unity 6 Windows.exe",
314-
"${{ github.workspace }}\sample\Tests\Sample Unity 6 Windows.exe",
315-
"sample\Tests\Sample Unity 6 Windows.exe"
316-
)
317-
318-
$exeFound = $false
319-
foreach ($path in $exePaths) {
320-
if (Test-Path $path) {
321-
Write-Output "✅ Build succeeded! Executable found at: $path"
322-
$fileSize = (Get-Item $path).Length / 1MB
323-
Write-Output "File size: $([math]::Round($fileSize, 2)) MB"
324-
$exeFound = $true
325-
break
326-
} else {
327-
Write-Output "Not found: $path"
328-
}
329-
}
330-
331-
if (-not $exeFound) {
332-
Write-Output ""
333-
Write-Output "❌ Build failed! Executable not found in any expected location"
284+
Write-Output "❌ Build failed! Executable not found"
334285
Write-Output ""
335-
Write-Output "Full build log:"
336-
if (Test-Path "${{ github.workspace }}\sample-unity6\build-log.log") {
337-
Get-Content "${{ github.workspace }}\sample-unity6\build-log.log"
338-
} elseif (Test-Path "sample-unity6\build-log.log") {
339-
Get-Content "sample-unity6\build-log.log"
286+
Write-Output "Build log:"
287+
if (Test-Path $logFile) {
288+
Get-Content $logFile
340289
} else {
341-
Write-Output "⚠️ Build log not found"
290+
Write-Output "⚠️ Log file not found at: $logFile"
342291
}
343292
exit 1
344293
}
@@ -347,29 +296,15 @@ jobs:
347296
python-version: "3.13"
348297
- name: Verify test files are accessible
349298
run: |
350-
Write-Output "Checking for test files in sample-unity6/Tests..."
351-
if (Test-Path "sample-unity6/Tests/requirements-desktop.txt") {
352-
Write-Output "✅ requirements-desktop.txt found"
353-
} else {
354-
Write-Output "⚠️ requirements-desktop.txt not found, trying sample/Tests..."
355-
if (Test-Path "sample/Tests/requirements-desktop.txt") {
356-
Write-Output "✅ Found in sample/Tests"
357-
} else {
358-
Write-Output "❌ requirements-desktop.txt not found"
359-
exit 1
360-
}
361-
}
362-
if (Test-Path "sample-unity6/Tests/test") {
363-
Write-Output "✅ test directory found"
364-
} else {
365-
Write-Output "⚠️ test directory not found in sample-unity6/Tests"
299+
if (-not (Test-Path "sample-unity6/Tests/requirements-desktop.txt") -and -not (Test-Path "sample/Tests/requirements-desktop.txt")) {
300+
Write-Output "❌ Test requirements file not found"
301+
exit 1
366302
}
367303
- name: Install dependencies
368304
run: |
369305
if (Test-Path "sample-unity6/Tests/requirements-desktop.txt") {
370306
pip install -r sample-unity6/Tests/requirements-desktop.txt
371307
} else {
372-
Write-Output "Installing from sample/Tests instead..."
373308
pip install -r sample/Tests/requirements-desktop.txt
374309
}
375310
- name: Run UI tests

0 commit comments

Comments
 (0)