Skip to content

Commit ff23166

Browse files
authored
Parity Fixes with Test Runner (QOL Changes) (#607)
* Fix missed directory change that isn't used anymore * Fixes, improvements, and cleanup while reconciling test runner scripts * Additional cleanup * Fix possible hang * Don't mislead with activation server on windows * Update node version
1 parent 9406bce commit ff23166

File tree

13 files changed

+128
-38
lines changed

13 files changed

+128
-38
lines changed

.github/pull_request_template.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#### Successful Workflow Run Link
1414

15+
PRs don't have access to secrets so you will need to provide a link to a successful run of the workflows from your own
16+
repo.
17+
1518
- ...
1619

1720
#### Checklist

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,5 +270,5 @@ branding:
270270
icon: 'box'
271271
color: 'gray-dark'
272272
runs:
273-
using: 'node16'
273+
using: 'node20'
274274
main: 'dist/index.js'

dist/BlankProject/Packages/.DS_Store

-6 KB
Binary file not shown.

dist/index.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/platforms/ubuntu/steps/activate.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,12 @@ else
7575
#
7676
echo "License activation strategy could not be determined."
7777
echo ""
78-
echo "Visit https://game.ci/docs/github/getting-started for more"
78+
echo "Visit https://game.ci/docs/github/activation for more"
7979
echo "details on how to set up one of the possible activation strategies."
8080

8181
echo "::error ::No valid license activation strategy could be determined. Make sure to provide UNITY_EMAIL, UNITY_PASSWORD, and either a UNITY_SERIAL \
82-
or UNITY_LICENSE. Otherwise please use UNITY_LICENSING_SERVER."
82+
or UNITY_LICENSE. Otherwise please use UNITY_LICENSING_SERVER. See more info at https://game.ci/docs/github/activation"
83+
8384
# Immediately exit as no UNITY_EXIT_CODE can be derived.
8485
exit 1;
8586

@@ -98,6 +99,3 @@ else
9899
echo "::error ::There was an error while trying to activate the Unity license."
99100
exit $UNITY_EXIT_CODE
100101
fi
101-
102-
# Return to previous working directory
103-
popd

dist/platforms/ubuntu/steps/return_license.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# Run in ACTIVATE_LICENSE_PATH directory
4-
echo "Changing to \"$ACTIVATE_LICENSE_PATH\" directory."
5-
pushd "$ACTIVATE_LICENSE_PATH"
6-
7-
8-
if [[ -n "$UNITY_LICENSING_SERVER" ]]; then #
3+
if [[ -n "$UNITY_LICENSING_SERVER" ]]; then
94
#
105
# Return any floating license used.
116
#
@@ -25,6 +20,3 @@ elif [[ -n "$UNITY_SERIAL" ]]; then
2520
-password "$UNITY_PASSWORD" \
2621
-projectPath "/BlankProject"
2722
fi
28-
29-
# Return to previous working directory
30-
popd

dist/platforms/windows/activate.ps1

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,64 @@ Write-Output "# Activating #"
66
Write-Output "###########################"
77
Write-Output ""
88

9-
& "$Env:UNITY_PATH/Editor/Unity.exe" -batchmode -quit -nographics `
10-
-username $Env:UNITY_EMAIL `
11-
-password $Env:UNITY_PASSWORD `
12-
-serial $Env:UNITY_SERIAL `
13-
-projectPath "c:/BlankProject" `
14-
-logfile - | Out-Host
15-
16-
$ACTIVATION_EXIT_CODE = $LASTEXITCODE
9+
if ( ($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($null -ne ${env:UNITY_PASSWORD}) )
10+
{
11+
#
12+
# SERIAL LICENSE MODE
13+
#
14+
# This will activate unity, using the serial activation process.
15+
#
16+
Write-Output "Requesting activation"
17+
18+
$ACTIVATION_OUTPUT = Start-Process -FilePath "$Env:UNITY_PATH/Editor/Unity.exe" `
19+
-NoNewWindow `
20+
-PassThru `
21+
-ArgumentList "-batchmode `
22+
-quit `
23+
-nographics `
24+
-username $Env:UNITY_EMAIL `
25+
-password $Env:UNITY_PASSWORD `
26+
-serial $Env:UNITY_SERIAL `
27+
-projectPath c:/BlankProject `
28+
-logfile -"
29+
30+
# Cache the handle so exit code works properly
31+
# https://stackoverflow.com/questions/10262231/obtaining-exitcode-using-start-process-and-waitforexit-instead-of-wait
32+
$unityHandle = $ACTIVATION_OUTPUT.Handle
33+
34+
while ($true) {
35+
if ($ACTIVATION_OUTPUT.HasExited) {
36+
$ACTIVATION_EXIT_CODE = $ACTIVATION_OUTPUT.ExitCode
37+
38+
# Display results
39+
if ($ACTIVATION_EXIT_CODE -eq 0)
40+
{
41+
Write-Output "Activation Succeeded"
42+
} else
43+
{
44+
Write-Output "Activation failed, with exit code $ACTIVATION_EXIT_CODE"
45+
}
46+
47+
break
48+
}
49+
50+
Start-Sleep -Seconds 3
51+
}
52+
}
53+
else
54+
{
55+
#
56+
# NO LICENSE ACTIVATION STRATEGY MATCHED
57+
#
58+
# This will exit since no activation strategies could be matched.
59+
#
60+
Write-Output "License activation strategy could not be determined."
61+
Write-Output ""
62+
Write-Output "Visit https://game.ci/docs/github/activation for more"
63+
Write-Output "details on how to set up one of the possible activation strategies."
64+
65+
Write-Output "::error ::No valid license activation strategy could be determined. Make sure to provide UNITY_EMAIL, UNITY_PASSWORD, and either a UNITY_SERIAL \
66+
or UNITY_LICENSE. See more info at https://game.ci/docs/github/activation"
67+
68+
$ACTIVATION_EXIT_CODE = 1;
69+
}

dist/platforms/windows/build.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ $unityArgs = @(
156156
# Remove null items as that will fail the Start-Process call
157157
$unityArgs = $unityArgs | Where-Object { $_ -ne $null }
158158

159-
$unityProcess = Start-Process -FilePath "$Env:UNITY_PATH\Editor\Unity.exe" `
160-
-ArgumentList $unityArgs `
161-
-PassThru `
162-
-NoNewWindow
159+
$unityProcess = Start-Process -FilePath "$Env:UNITY_PATH/Editor/Unity.exe" `
160+
-ArgumentList $unityArgs `
161+
-PassThru `
162+
-NoNewWindow
163163

164164
# Cache the handle so exit code works properly
165165
# https://stackoverflow.com/questions/10262231/obtaining-exitcode-using-start-process-and-waitforexit-instead-of-wait

dist/platforms/windows/return_license.ps1

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,47 @@ Write-Output "# Return License #"
66
Write-Output "###########################"
77
Write-Output ""
88

9-
& "$Env:UNITY_PATH\Editor\Unity.exe" -batchmode -quit -nographics `
10-
-username $Env:UNITY_EMAIL `
11-
-password $Env:UNITY_PASSWORD `
12-
-returnlicense `
13-
-projectPath "c:/BlankProject" `
14-
-logfile - | Out-Host
9+
if (($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($null -ne ${env:UNITY_PASSWORD}))
10+
{
11+
#
12+
# SERIAL LICENSE MODE
13+
#
14+
# This will return the license that is currently in use.
15+
#
16+
$RETURN_LICENSE_OUTPUT = Start-Process -FilePath "$Env:UNITY_PATH/Editor/Unity.exe" `
17+
-NoNewWindow `
18+
-PassThru `
19+
-ArgumentList "-batchmode `
20+
-quit `
21+
-nographics `
22+
-username $Env:UNITY_EMAIL `
23+
-password $Env:UNITY_PASSWORD `
24+
-returnlicense `
25+
-projectPath c:/BlankProject `
26+
-logfile -"
27+
28+
# Cache the handle so exit code works properly
29+
# https://stackoverflow.com/questions/10262231/obtaining-exitcode-using-start-process-and-waitforexit-instead-of-wait
30+
$unityHandle = $RETURN_LICENSE_OUTPUT.Handle
31+
32+
while ($true) {
33+
if ($RETURN_LICENSE_OUTPUT.HasExited) {
34+
$RETURN_LICENSE_EXIT_CODE = $RETURN_LICENSE_OUTPUT.ExitCode
35+
36+
# Display results
37+
if ($RETURN_LICENSE_EXIT_CODE -eq 0)
38+
{
39+
Write-Output "License Return Succeeded"
40+
} else
41+
{
42+
Write-Output "License Return failed, with exit code $RETURN_LICENSE_EXIT_CODE"
43+
Write-Output "::warning ::License Return failed! If this is a Pro License you might need to manually `
44+
free the seat in your Unity admin panel or you might run out of seats to activate with."
45+
}
46+
47+
break
48+
}
49+
50+
Start-Sleep -Seconds 3
51+
}
52+
}

0 commit comments

Comments
 (0)