Skip to content

Commit

Permalink
Fixes, improvements, and cleanup while reconciling test runner scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewKahr committed Dec 10, 2023
1 parent 0e7097b commit d491502
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 28 deletions.
Binary file removed dist/BlankProject/Packages/.DS_Store
Binary file not shown.
8 changes: 3 additions & 5 deletions dist/platforms/ubuntu/steps/activate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ else
#
echo "License activation strategy could not be determined."
echo ""
echo "Visit https://game.ci/docs/github/getting-started for more"
echo "Visit https://game.ci/docs/github/activation for more"
echo "details on how to set up one of the possible activation strategies."

echo "::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."
or UNITY_LICENSE. Otherwise please use UNITY_LICENSING_SERVER. See more info at https://game.ci/docs/github/activation"

# Immediately exit as no UNITY_EXIT_CODE can be derived.
exit 1;

Expand All @@ -98,6 +99,3 @@ else
echo "::error ::There was an error while trying to activate the Unity license."
exit $UNITY_EXIT_CODE
fi

# Return to previous working directory
popd
5 changes: 1 addition & 4 deletions dist/platforms/ubuntu/steps/return_license.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

if [[ -n "$UNITY_LICENSING_SERVER" ]]; then #
if [[ -n "$UNITY_LICENSING_SERVER" ]]; then
#
# Return any floating license used.
#
Expand All @@ -20,6 +20,3 @@ elif [[ -n "$UNITY_SERIAL" ]]; then
-password "$UNITY_PASSWORD" \
-projectPath "/BlankProject"
fi

# Return to previous working directory
popd
45 changes: 38 additions & 7 deletions dist/platforms/windows/activate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,42 @@ Write-Output "# Activating #"
Write-Output "###########################"
Write-Output ""

& "$Env:UNITY_PATH/Editor/Unity.exe" -batchmode -quit -nographics `
-username $Env:UNITY_EMAIL `
-password $Env:UNITY_PASSWORD `
-serial $Env:UNITY_SERIAL `
-projectPath "c:/BlankProject" `
-logfile - | Out-Host
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"

$ACTIVATION_EXIT_CODE = $LASTEXITCODE
$ACTIVATION_OUTPUT = Start-Process -NoNewWindow -Wait -PassThru "$Env:UNITY_PATH/Editor/Unity.exe" `
-ArgumentList `
"-batchmode `
-quit `
-nographics `
-username $Env:UNITY_EMAIL `
-password $Env:UNITY_PASSWORD `
-serial $Env:UNITY_SERIAL `
-projectPath c:/BlankProject `
-logfile -"

$ACTIVATION_EXIT_CODE = $ACTIVATION_OUTPUT.ExitCode
}
else
{
#
# NO LICENSE ACTIVATION STRATEGY MATCHED
#
# This will exit since no activation strategies could be matched.
#
Write-Output "License activation strategy could not be determined."
Write-Output ""
Write-Output "Visit https://game.ci/docs/github/activation for more"
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"

$ACTIVATION_EXIT_CODE = 1;
}
8 changes: 4 additions & 4 deletions dist/platforms/windows/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ $unityArgs = @(
# Remove null items as that will fail the Start-Process call
$unityArgs = $unityArgs | Where-Object { $_ -ne $null }

$unityProcess = Start-Process -FilePath "$Env:UNITY_PATH\Editor\Unity.exe" `
-ArgumentList $unityArgs `
-PassThru `
-NoNewWindow
$unityProcess = Start-Process -FilePath "$Env:UNITY_PATH/Editor/Unity.exe" `
-ArgumentList $unityArgs `
-PassThru `
-NoNewWindow

# Cache the handle so exit code works properly
# https://stackoverflow.com/questions/10262231/obtaining-exitcode-using-start-process-and-waitforexit-instead-of-wait
Expand Down
24 changes: 18 additions & 6 deletions dist/platforms/windows/return_license.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,21 @@ Write-Output "# Return License #"
Write-Output "###########################"
Write-Output ""

& "$Env:UNITY_PATH\Editor\Unity.exe" -batchmode -quit -nographics `
-username $Env:UNITY_EMAIL `
-password $Env:UNITY_PASSWORD `
-returnlicense `
-projectPath "c:/BlankProject" `
-logfile - | Out-Host
if ($null -ne ${env:UNITY_SERIAL})
{
#
# 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 -"
}
4 changes: 2 additions & 2 deletions dist/platforms/windows/set_gitcredential.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if ([string]::IsNullOrEmpty($env:GIT_PRIVATE_TOKEN)) {
if ($null -eq ${env:GIT_PRIVATE_TOKEN}) {
Write-Host "GIT_PRIVATE_TOKEN unset skipping"
}
else {
Expand All @@ -8,7 +8,7 @@ else {
git config --global --replace-all "url.https://token:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "ssh://git@github.com/"
git config --global --add "url.https://token:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "git@github.com"
git config --global --add "url.https://token:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "https://github.com/"

git config --global "url.https://ssh:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "ssh://git@github.com/"
git config --global "url.https://git:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "git@github.com:"
}
Expand Down

0 comments on commit d491502

Please sign in to comment.