Skip to content

Commit 63b258f

Browse files
committed
ci: windows sample unity 6 confirm packages are imported
1 parent f241600 commit 63b258f

File tree

1 file changed

+48
-22
lines changed

1 file changed

+48
-22
lines changed

.github/workflows/ui-tests.yml

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -237,37 +237,63 @@ jobs:
237237
Write-Output "✅ Tests directory exists"
238238
}
239239
}
240-
- name: First build (resolves packages)
240+
- name: Import packages and prepare project
241241
run: |
242-
Write-Output "Running first build to trigger package resolution..."
243-
Write-Output "Unity command: C:\Program Files\Unity\Hub\Editor\6000.0.58f2\Editor\Unity.exe"
244-
Write-Output "Project path: ${{ github.workspace }}\sample-unity6"
245-
Write-Output "Build method: WindowsBuilderUnity6.BuildForAltTester"
246-
Write-Output "Build path: ${{ github.workspace }}\sample-unity6\Tests\Sample Unity 6 Windows.exe"
242+
Write-Output "Opening Unity to import packages (without building)..."
243+
Write-Output "This step just lets Unity import all packages without trying to execute a build."
247244
Write-Output ""
248245
249-
& "C:\Program Files\Unity\Hub\Editor\6000.0.58f2\Editor\Unity.exe" -projectPath "${{ github.workspace }}\sample-unity6" -executeMethod "WindowsBuilderUnity6.BuildForAltTester" -logFile "${{ github.workspace }}\sample-unity6\first-build-log.txt" -quit -batchmode -nographics --buildPath "${{ github.workspace }}\sample-unity6\Tests\Sample Unity 6 Windows.exe"
250-
$buildExitCode = $LASTEXITCODE
246+
# Start Unity without -quit so it stays open, but with a timeout
247+
$unityProcess = Start-Process -FilePath "C:\Program Files\Unity\Hub\Editor\6000.0.58f2\Editor\Unity.exe" `
248+
-ArgumentList "-projectPath", "${{ github.workspace }}\sample-unity6", `
249+
"-logFile", "${{ github.workspace }}\sample-unity6\import-log.txt", `
250+
"-batchmode", "-nographics" `
251+
-PassThru -NoNewWindow
251252
252-
Write-Output ""
253-
Write-Output "First build completed with exit code: $buildExitCode"
254-
Write-Output "Checking for AltTester..."
255-
if (Test-Path "${{ github.workspace }}\sample-unity6\Library\PackageCache\*alttester*") {
256-
Write-Output "✅ AltTester found in PackageCache after first build"
253+
Write-Output "Unity process started (PID: $($unityProcess.Id))"
254+
Write-Output "Waiting for package import to complete..."
255+
Write-Output "Will check for completion every 10 seconds (max 5 minutes)"
256+
257+
$maxWaitSeconds = 300
258+
$checkInterval = 10
259+
$elapsed = 0
260+
$packagesImported = $false
261+
262+
while ($elapsed -lt $maxWaitSeconds) {
263+
Start-Sleep -Seconds $checkInterval
264+
$elapsed += $checkInterval
265+
266+
# Check if AltTester package has been imported
267+
if (Test-Path "${{ github.workspace }}\sample-unity6\Library\PackageCache\*alttester*") {
268+
Write-Output "✅ AltTester package found! Packages have been imported."
269+
$packagesImported = $true
270+
break
271+
}
272+
273+
Write-Output "Still importing... ($elapsed seconds elapsed)"
274+
}
275+
276+
# Kill Unity process
277+
Write-Output "Stopping Unity process..."
278+
Stop-Process -Id $unityProcess.Id -Force -ErrorAction SilentlyContinue
279+
Start-Sleep -Seconds 2
280+
281+
if ($packagesImported) {
282+
Write-Output "✅ Package import completed successfully"
257283
} else {
258-
Write-Output "⚠️ AltTester not found yet, but will be ready for second build"
284+
Write-Output "⚠️ Timeout waiting for packages, but continuing anyway"
259285
}
260286
261287
Write-Output ""
262-
Write-Output "First build log (last 50 lines):"
263-
if (Test-Path "${{ github.workspace }}\sample-unity6\first-build-log.txt") {
264-
Get-Content "${{ github.workspace }}\sample-unity6\first-build-log.txt" -Tail 50
288+
Write-Output "Import log (last 50 lines):"
289+
if (Test-Path "${{ github.workspace }}\sample-unity6\import-log.txt") {
290+
Get-Content "${{ github.workspace }}\sample-unity6\import-log.txt" -Tail 50
265291
} else {
266292
Write-Output "⚠️ Log file not found"
267293
}
268-
- name: Build Unity 6 Windows with command line (second build with packages ready)
294+
- name: Build Unity 6 Windows executable
269295
run: |
270-
Write-Output "Building Unity 6 Windows using command line (second attempt)..."
296+
Write-Output "Building Unity 6 Windows executable (packages should be ready now)..."
271297
Write-Output "Starting Unity build..."
272298
& "C:\Program Files\Unity\Hub\Editor\6000.0.58f2\Editor\Unity.exe" -projectPath "${{ github.workspace }}\sample-unity6" -executeMethod "WindowsBuilderUnity6.BuildForAltTester" -logFile "${{ github.workspace }}\sample-unity6\build-log.log" -quit -batchmode -nographics --buildPath "${{ github.workspace }}\sample-unity6\Tests\Sample Unity 6 Windows.exe"
273299
$buildExitCode = $LASTEXITCODE
@@ -375,12 +401,12 @@ jobs:
375401
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
376402
working-directory: sample-unity6/Tests
377403
run: python -m pytest -xs test/test_windows.py::WindowsTest
378-
- name: Upload first build log
404+
- name: Upload import log
379405
if: always()
380406
uses: actions/upload-artifact@v4
381407
with:
382-
name: Unity6-Windows-First-Build-Log
383-
path: sample-unity6/first-build-log.txt
408+
name: Unity6-Windows-Import-Log
409+
path: sample-unity6/import-log.txt
384410
- name: Upload build log
385411
if: always()
386412
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)