Fix possible activation hang. Remove 2021 seg fault

pull/246/head
Andrew Kahr 2023-12-11 20:32:29 -08:00
parent f5273c6e18
commit 422db0d796
3 changed files with 82 additions and 65 deletions

View File

@ -35,7 +35,6 @@ jobs:
projectPath:
- unity-project-with-correct-tests
unityVersion:
- 2021.3.32f1
- 2022.3.13f1
- 2023.1.19f1
- 2023.2.2f1
@ -84,7 +83,6 @@ jobs:
projectPath:
- unity-project-with-correct-tests
unityVersion:
- 2021.3.32f1
- 2022.3.13f1
- 2023.1.19f1
- 2023.2.2f1
@ -141,7 +139,6 @@ jobs:
fail-fast: false
matrix:
unityVersion:
- 2021.3.32f1
- 2022.3.13f1
- 2023.1.19f1
- 2023.2.2f1
@ -201,7 +198,6 @@ jobs:
projectPath:
- unity-project-with-correct-tests
unityVersion:
- 2021.3.32f1
- 2022.3.13f1
- 2023.1.19f1
- 2023.2.2f1
@ -259,7 +255,6 @@ jobs:
projectPath:
- unity-project-with-correct-tests
unityVersion:
- 2021.3.32f1
- 2022.3.13f1
- 2023.1.19f1
- 2023.2.2f1
@ -309,7 +304,6 @@ jobs:
projectPath:
- unity-project-with-correct-tests
unityVersion:
- 2021.3.32f1
- 2022.3.13f1
- 2023.1.19f1
- 2023.2.2f1
@ -364,7 +358,6 @@ jobs:
fail-fast: false
matrix:
unityVersion:
- 2021.3.32f1
- 2022.3.13f1
- 2023.1.19f1
- 2023.2.2f1
@ -433,7 +426,6 @@ jobs:
projectPath:
- unity-package-with-correct-tests/com.example.testpackage
unityVersion:
- 2021.3.32f1
- 2022.3.13f1
- 2023.1.19f1
- 2023.2.2f1
@ -475,7 +467,6 @@ jobs:
projectPath:
- unity-package-with-correct-tests/com.example.testpackage
unityVersion:
- 2021.3.32f1
- 2022.3.13f1
- 2023.1.19f1
- 2023.2.2f1
@ -522,7 +513,6 @@ jobs:
fail-fast: false
matrix:
unityVersion:
- 2021.3.32f1
- 2022.3.13f1
- 2023.1.19f1
- 2023.2.2f1
@ -573,7 +563,6 @@ jobs:
projectPath:
- unity-package-with-correct-tests/com.example.testpackage
unityVersion:
- 2021.3.32f1
- 2022.3.13f1
- 2023.1.19f1
- 2023.2.2f1
@ -620,7 +609,6 @@ jobs:
fail-fast: false
matrix:
unityVersion:
- 2021.3.32f1
- 2022.3.13f1
- 2023.1.19f1
- 2023.2.2f1

View File

@ -8,27 +8,47 @@ Write-Output ""
if ( ($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($null -ne ${env:UNITY_PASSWORD}) )
{
#
# SERIAL LICENSE MODE
#
# This will activate unity, using the serial activation process.
#
Write-Output "Requesting activation"
#
# SERIAL LICENSE MODE
#
# This will activate unity, using the serial activation process.
#
Write-Output "Requesting activation"
# Activate license
$ACTIVATION_OUTPUT = Start-Process -NoNewWindow -Wait -PassThru "$Env:UNITY_PATH/Editor/Unity.exe" `
-ArgumentList `
"-batchmode `
-nographics `
-logFile - `
-quit `
-serial $Env:UNITY_SERIAL `
-username $Env:UNITY_EMAIL `
-password $Env:UNITY_PASSWORD `
-projectPath c:/BlankProject"
$ACTIVATION_OUTPUT = Start-Process -FilePath "$Env:UNITY_PATH/Editor/Unity.exe" `
-NoNewWindow `
-PassThru `
-ArgumentList "-batchmode `
-quit `
-nographics `
-username $Env:UNITY_EMAIL `
-password $Env:UNITY_PASSWORD `
-serial $Env:UNITY_SERIAL `
-projectPath c:/BlankProject `
-logfile -"
# Store the exit code from the activate command
$ACTIVATION_EXIT_CODE = $ACTIVATION_OUTPUT.ExitCode
# Cache the handle so exit code works properly
# https://stackoverflow.com/questions/10262231/obtaining-exitcode-using-start-process-and-waitforexit-instead-of-wait
$unityHandle = $ACTIVATION_OUTPUT.Handle
while ($true) {
if ($ACTIVATION_OUTPUT.HasExited) {
$ACTIVATION_EXIT_CODE = $ACTIVATION_OUTPUT.ExitCode
# Display results
if ($ACTIVATION_EXIT_CODE -eq 0)
{
Write-Output "Activation Succeeded"
} else
{
Write-Output "Activation failed, with exit code $ACTIVATION_EXIT_CODE"
}
break
}
Start-Sleep -Seconds 3
}
}
else
{
@ -43,24 +63,7 @@ else
Write-Output "details on how to set up one of the possible activation strategies."
Write-Output "::error ::No valid license activation strategy could be determined. Make sure to provide UNITY_EMAIL, UNITY_PASSWORD, and either a UNITY_SERIAL \
or UNITY_LICENSE. Otherwise please use UNITY_LICENSING_SERVER. See more info at https://game.ci/docs/github/activation"
or UNITY_LICENSE. See more info at https://game.ci/docs/github/activation"
$ACTIVATION_EXIT_CODE = 1;
}
#
# Display information about the result
#
if ($ACTIVATION_EXIT_CODE -eq 0)
{
# Activation was a success
Write-Output "Activation complete."
}
else
{
# Activation failed so exit with the code from the license verification step
Write-Output "Unclassified error occured while trying to activate license."
Write-Output "Exit code was: $UNITY_EXIT_CODE"
Write-Output "::error ::There was an error while trying to activate the Unity license."
exit $UNITY_EXIT_CODE
}

View File

@ -6,21 +6,47 @@ Write-Output "# Return License #"
Write-Output "###########################"
Write-Output ""
if ($null -ne ${env:UNITY_SERIAL})
if (($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($null -ne ${env:UNITY_PASSWORD}))
{
#
# SERIAL LICENSE MODE
#
# This will return the license that is currently in use.
#
$RETURN_OUTPUT = Start-Process -NoNewWindow -Wait -PassThru "$Env:UNITY_PATH/Editor/Unity.exe" `
-ArgumentList `
"-batchmode `
-quit `
-nographics `
-username $Env:UNITY_EMAIL `
-password $Env:UNITY_PASSWORD `
-returnlicense `
-projectPath c:/BlankProject `
-logfile -"
#
# SERIAL LICENSE MODE
#
# This will return the license that is currently in use.
#
$RETURN_LICENSE_OUTPUT = Start-Process -FilePath "$Env:UNITY_PATH/Editor/Unity.exe" `
-NoNewWindow `
-PassThru `
-ArgumentList "-batchmode `
-quit `
-nographics `
-username $Env:UNITY_EMAIL `
-password $Env:UNITY_PASSWORD `
-returnlicense `
-projectPath c:/BlankProject `
-logfile -"
# Cache the handle so exit code works properly
# https://stackoverflow.com/questions/10262231/obtaining-exitcode-using-start-process-and-waitforexit-instead-of-wait
$unityHandle = $RETURN_LICENSE_OUTPUT.Handle
while ($true) {
if ($RETURN_LICENSE_OUTPUT.HasExited) {
$RETURN_LICENSE_EXIT_CODE = $RETURN_LICENSE_OUTPUT.ExitCode
# Display results
if ($RETURN_LICENSE_EXIT_CODE -eq 0)
{
Write-Output "License Return Succeeded"
} else
{
Write-Output "License Return failed, with exit code $RETURN_LICENSE_EXIT_CODE"
Write-Output "::warning ::License Return failed! If this is a Pro License you might need to manually `
free the seat in your Unity admin panel or you might run out of seats to activate with."
}
break
}
Start-Sleep -Seconds 3
}
}