Additional Fixes and Improvements (#596)

- Windows now exits with the proper exit codes. This mirrors Ubuntu behavior properly now and means we do not need the error parsing logic to handle error conditions which means we should be back to v2 behavior.
- Allow customizing image registry/image version
- Only create the licensing directory on Mac if it doesn't already exist. Don't delete the folder on build complete. This means builds nominally shouldn't need sudo permissions, very useful for self-hosted runners.
- Pick correct architecture when installing macos editor to support both x86 and arm-based systems (Credit @dcvz)
This commit is contained in:
Andrew Kahr
2023-11-15 06:17:55 -08:00
committed by GitHub
parent caa0a81b47
commit 2afd9cd86f
13 changed files with 143 additions and 44 deletions

View File

@@ -4,8 +4,13 @@
# Create directories for license activation
#
sudo mkdir /Library/Application\ Support/Unity
sudo chmod -R 777 /Library/Application\ Support/Unity
UNITY_LICENSE_PATH="/Library/Application Support/Unity"
if [ ! -d "$UNITY_LICENSE_PATH" ]; then
echo "Creating Unity License Directory"
sudo mkdir -p "$UNITY_LICENSE_PATH"
sudo chmod -R 777 "$UNITY_LICENSE_PATH"
fi;
ACTIVATE_LICENSE_PATH="$ACTION_FOLDER/BlankProject"
mkdir -p "$ACTIVATE_LICENSE_PATH"
@@ -21,7 +26,6 @@ source $ACTION_FOLDER/platforms/mac/steps/return_license.sh
# Remove license activation directory
#
sudo rm -r /Library/Application\ Support/Unity
rm -r "$ACTIVATE_LICENSE_PATH"
#

View File

@@ -156,26 +156,29 @@ $unityArgs = @(
# Remove null items as that will fail the Start-Process call
$unityArgs = $unityArgs | Where-Object { $_ -ne $null }
$process = Start-Process -FilePath "$Env:UNITY_PATH\Editor\Unity.exe" `
$unityProcess = Start-Process -FilePath "$Env:UNITY_PATH\Editor\Unity.exe" `
-ArgumentList $unityArgs `
-PassThru `
-NoNewWindow
while (!$process.HasExited) {
if ($process.HasExited) {
Start-Sleep -Seconds 5
# Cache the handle so exit code works properly
# https://stackoverflow.com/questions/10262231/obtaining-exitcode-using-start-process-and-waitforexit-instead-of-wait
$unityHandle = $unityProcess.Handle
while ($true) {
if ($unityProcess.HasExited) {
Start-Sleep -Seconds 3
Get-Process
Start-Sleep -Seconds 10
Get-Process
$BUILD_EXIT_CODE = $unityProcess.ExitCode
# Display results
if ($process.ExitCode -eq 0)
if ($BUILD_EXIT_CODE -eq 0)
{
Write-Output "Build Succeeded!!"
} else
{
Write-Output "$('Build failed, with exit code ')$($process.ExitCode)$('"')"
Write-Output "Build failed, with exit code $BUILD_EXIT_CODE"
}
Write-Output ""
@@ -187,8 +190,8 @@ while (!$process.HasExited) {
Get-ChildItem $Env:BUILD_PATH_FULL
Write-Output ""
exit $process.ExitCode
break
}
Start-Sleep -Seconds 5
Start-Sleep -Seconds 3
}

View File

@@ -12,16 +12,18 @@ regsvr32 C:\ProgramData\Microsoft\VisualStudio\Setup\x64\Microsoft.VisualStudio.
Get-Process -Name regsvr32 | ForEach-Object { Stop-Process -Id $_.Id -Force }
# Setup Git Credentials
& "c:\steps\set_gitcredential.ps1"
. "c:\steps\set_gitcredential.ps1"
# Activate Unity
& "c:\steps\activate.ps1"
. "c:\steps\activate.ps1"
# Build the project
& "c:\steps\build.ps1"
. "c:\steps\build.ps1"
# Free the seat for the activated license
& "c:\steps\return_license.ps1"
. "c:\steps\return_license.ps1"
Start-Sleep -Seconds 3
Get-Process
exit $BUILD_EXIT_CODE