@@ -234,77 +234,20 @@ jobs:
234234 Write-Output "✅ Tests directory exists"
235235 }
236236 }
237- - name : Import packages and prepare project
237+ - name : Build Unity 6 Windows executable
238+ timeout-minutes : 20
238239 run : |
239- Write-Output "Opening Unity to import packages (without building)..."
240- Write-Output "This step just lets Unity import all packages without trying to execute a build."
241- Write-Output ""
242-
243- # Start Unity without -quit so it stays open, but with a timeout
244- $unityProcess = Start-Process -FilePath "C:\Program Files\Unity\Hub\Editor\6000.0.58f2\Editor\Unity.exe" `
245- -ArgumentList "-projectPath", "${{ github.workspace }}\sample-unity6", `
246- "-logFile", "${{ github.workspace }}\sample-unity6\import-log.txt", `
247- "-batchmode", "-nographics" `
248- -PassThru -NoNewWindow
249-
250- Write-Output "Unity process started (PID: $($unityProcess.Id))"
251- Write-Output "Waiting for package import to complete..."
252- Write-Output "Will check for completion every 15 seconds (max 10 minutes)"
240+ Write-Output "Building Unity 6 Windows executable..."
241+ Write-Output "Note: First run will import packages then build. This may take 10-15 minutes."
253242 Write-Output ""
243+ Write-Output "Starting Unity build at: $(Get-Date -Format 'HH:mm:ss')"
254244
255- $maxWaitSeconds = 600 # 10 minutes - package import can take a while
256- $checkInterval = 15
257- $elapsed = 0
258- $packagesImported = $false
259-
260- while ($elapsed -lt $maxWaitSeconds) {
261- Start-Sleep -Seconds $checkInterval
262- $elapsed += $checkInterval
263-
264- # Check if Library folder exists and has PackageCache
265- if (Test-Path "${{ github.workspace }}\sample-unity6\Library\PackageCache") {
266- $packageCount = (Get-ChildItem "${{ github.workspace }}\sample-unity6\Library\PackageCache" -Directory -ErrorAction SilentlyContinue | Measure-Object).Count
267- Write-Output "PackageCache exists with $packageCount packages ($elapsed seconds elapsed)"
268-
269- # Check if AltTester package has been imported
270- if (Test-Path "${{ github.workspace }}\sample-unity6\Library\PackageCache\*alttester*") {
271- Write-Output "✅ AltTester package found! Packages should be ready."
272- $packagesImported = $true
273- # Wait a bit more to ensure everything is settled
274- Write-Output "Waiting 30 more seconds to ensure all packages are fully imported..."
275- Start-Sleep -Seconds 30
276- break
277- }
278- } else {
279- Write-Output "PackageCache not yet created ($elapsed seconds elapsed)"
280- }
281- }
282-
283- # Kill Unity process
284- Write-Output "Stopping Unity process..."
285- Stop-Process -Id $unityProcess.Id -Force -ErrorAction SilentlyContinue
286- Start-Sleep -Seconds 2
287-
288- if ($packagesImported) {
289- Write-Output "✅ Package import completed successfully"
290- } else {
291- Write-Output "⚠️ Timeout waiting for packages, but continuing anyway"
292- }
293-
294- Write-Output ""
295- Write-Output "Import log (last 50 lines):"
296- if (Test-Path "${{ github.workspace }}\sample-unity6\import-log.txt") {
297- Get-Content "${{ github.workspace }}\sample-unity6\import-log.txt" -Tail 50
298- } else {
299- Write-Output "⚠️ Log file not found"
300- }
301- - name : Build Unity 6 Windows executable
302- run : |
303- Write-Output "Building Unity 6 Windows executable (packages should be ready now)..."
304- Write-Output "Starting Unity build..."
305245 & "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"
306246 $buildExitCode = $LASTEXITCODE
307247
248+ Write-Output ""
249+ Write-Output "Unity build finished at: $(Get-Date -Format 'HH:mm:ss')"
250+
308251 Write-Output ""
309252 Write-Output "Build completed with exit code: $buildExitCode"
310253
@@ -408,12 +351,6 @@ jobs:
408351 BROWSERSTACK_ACCESS_KEY : ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
409352 working-directory : sample-unity6/Tests
410353 run : python -m pytest -xs test/test_windows.py::WindowsTest
411- - name : Upload import log
412- if : always()
413- uses : actions/upload-artifact@v4
414- with :
415- name : Unity6-Windows-Import-Log
416- path : sample-unity6/import-log.txt
417354 - name : Upload build log
418355 if : always()
419356 uses : actions/upload-artifact@v4
0 commit comments