Skip to content

Commit

Permalink
Merge branch 'main' into cloud-runner-develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	dist/index.js.map
  • Loading branch information
frostebite committed Jan 27, 2024
2 parents 74ad7d8 + 2800d14 commit 71f94af
Show file tree
Hide file tree
Showing 17 changed files with 160 additions and 60 deletions.
3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

#### Successful Workflow Run Link

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
repo.

- ...

#### Checklist
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/build-tests-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
###########################
# Cache #
###########################
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-macos-${{ matrix.targetPlatform }}
Expand All @@ -61,6 +61,7 @@ jobs:
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
with:
buildName: 'GameCI Test Build'
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
Expand All @@ -71,8 +72,8 @@ jobs:
###########################
# Upload #
###########################
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: Build MacOS (${{ matrix.unityVersion }})
name: Build ${{ matrix.targetPlatform }} on MacOS (${{ matrix.unityVersion }})
path: build
retention-days: 14
9 changes: 6 additions & 3 deletions .github/workflows/build-tests-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
###########################
# Cache #
###########################
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-ubuntu-${{ matrix.targetPlatform }}
Expand All @@ -88,6 +88,7 @@ jobs:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
buildName: 'GameCI Test Build'
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
Expand All @@ -108,6 +109,7 @@ jobs:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
buildName: 'GameCI Test Build'
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
Expand All @@ -128,6 +130,7 @@ jobs:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
buildName: 'GameCI Test Build'
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
Expand All @@ -138,8 +141,8 @@ jobs:
###########################
# Upload #
###########################
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: Build Ubuntu (${{ matrix.unityVersion }})
name: Build ${{ matrix.targetPlatform }} on Ubuntu (${{ matrix.unityVersion }})
path: build
retention-days: 14
9 changes: 6 additions & 3 deletions .github/workflows/build-tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
###########################
# Cache #
###########################
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-windows-${{ matrix.targetPlatform }}
Expand Down Expand Up @@ -67,6 +67,7 @@ jobs:
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
with:
buildName: 'GameCI Test Build'
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
Expand All @@ -90,6 +91,7 @@ jobs:
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
with:
buildName: 'GameCI Test Build'
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
Expand All @@ -112,6 +114,7 @@ jobs:
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
with:
buildName: 'GameCI Test Build'
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
Expand All @@ -122,8 +125,8 @@ jobs:
###########################
# Upload #
###########################
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: Build Windows (${{ matrix.unityVersion }})
name: Build ${{ matrix.targetPlatform }} on Windows (${{ matrix.unityVersion }})
path: build
retention-days: 14
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,5 @@ branding:
icon: 'box'
color: 'gray-dark'
runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
Binary file removed dist/BlankProject/Packages/.DS_Store
Binary file not shown.
6 changes: 5 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/platforms/mac/steps/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ echo ""

/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity \
-logFile - \
-quit \
$( [ "${MANUAL_EXIT}" == "true" ] || echo "-quit" ) \
-batchmode \
-nographics \
-username "$UNITY_EMAIL" \
Expand Down
8 changes: 3 additions & 5 deletions dist/platforms/ubuntu/steps/activate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,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 @@ -107,6 +108,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
10 changes: 1 addition & 9 deletions dist/platforms/ubuntu/steps/return_license.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#!/usr/bin/env bash

# Run in ACTIVATE_LICENSE_PATH directory
echo "Changing to \"$ACTIVATE_LICENSE_PATH\" directory."
pushd "$ACTIVATE_LICENSE_PATH"


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

# Return to previous working directory
popd
69 changes: 61 additions & 8 deletions dist/platforms/windows/activate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,64 @@ 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

$ACTIVATION_EXIT_CODE = $LASTEXITCODE
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_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 -"

# 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
{
#
# 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. See more info at https://game.ci/docs/github/activation"

$ACTIVATION_EXIT_CODE = 1;
}
35 changes: 18 additions & 17 deletions dist/platforms/windows/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -137,29 +137,30 @@ $unityArgs = @(
"-batchmode",
"-nographics",
"-silent-crashes",
"-projectPath", $Env:UNITY_PROJECT_PATH,
"-executeMethod", $Env:BUILD_METHOD,
"-buildTarget", $Env:BUILD_TARGET,
"-customBuildTarget", $Env:BUILD_TARGET,
"-customBuildPath", $Env:CUSTOM_BUILD_PATH,
"-buildVersion", $Env:VERSION,
"-androidVersionCode", $Env:ANDROID_VERSION_CODE,
"-androidKeystorePass", $Env:ANDROID_KEYSTORE_PASS,
"-androidKeyaliasName", $Env:ANDROID_KEYALIAS_NAME,
"-androidKeyaliasPass", $Env:ANDROID_KEYALIAS_PASS,
"-androidTargetSdkVersion", $Env:ANDROID_TARGET_SDK_VERSION,
"-androidExportType", $Env:ANDROID_EXPORT_TYPE,
"-androidSymbolType", $Env:ANDROID_SYMBOL_TYPE,
"-customBuildName", "`"$Env:BUILD_NAME`"",
"-projectPath", "`"$Env:UNITY_PROJECT_PATH`"",
"-executeMethod", "`"$Env:BUILD_METHOD`"",
"-buildTarget", "`"$Env:BUILD_TARGET`"",
"-customBuildTarget", "`"$Env:BUILD_TARGET`"",
"-customBuildPath", "`"$Env:CUSTOM_BUILD_PATH`"",
"-buildVersion", "`"$Env:VERSION`"",
"-androidVersionCode", "`"$Env:ANDROID_VERSION_CODE`"",
"-androidKeystorePass", "`"$Env:ANDROID_KEYSTORE_PASS`"",
"-androidKeyaliasName", "`"$Env:ANDROID_KEYALIAS_NAME`"",
"-androidKeyaliasPass", "`"$Env:ANDROID_KEYALIAS_PASS`"",
"-androidTargetSdkVersion", "`"$Env:ANDROID_TARGET_SDK_VERSION`"",
"-androidExportType", "`"$Env:ANDROID_EXPORT_TYPE`"",
"-androidSymbolType", "`"$Env:ANDROID_SYMBOL_TYPE`"",
"-logfile", "-"
) + $customParametersArray

# 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
50 changes: 44 additions & 6 deletions dist/platforms/windows/return_license.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,47 @@ 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}) -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_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
}
}
Loading

0 comments on commit 71f94af

Please sign in to comment.