mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-07 20:35:33 -04:00
Merge branch 'main' into fix/dotnet-3-5-support
This commit is contained in:
commit
9c368ff779
BIN
dist/index.js
generated
vendored
BIN
dist/index.js
generated
vendored
Binary file not shown.
BIN
dist/index.js.map
generated
vendored
BIN
dist/index.js.map
generated
vendored
Binary file not shown.
24
dist/platforms/windows/activate.ps1
vendored
24
dist/platforms/windows/activate.ps1
vendored
@ -50,6 +50,30 @@ if ( ($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($
|
|||||||
Start-Sleep -Seconds 3
|
Start-Sleep -Seconds 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elseif( ($null -ne ${env:UNITY_LICENSING_SERVER}))
|
||||||
|
{
|
||||||
|
#
|
||||||
|
# Custom Unity License Server
|
||||||
|
#
|
||||||
|
|
||||||
|
Write-Output "Adding licensing server config"
|
||||||
|
|
||||||
|
$ACTIVATION_OUTPUT = Start-Process -FilePath "$Env:UNITY_PATH\Editor\Data\Resources\Licensing\Client\Unity.Licensing.Client.exe" `
|
||||||
|
-ArgumentList "--acquire-floating" `
|
||||||
|
-NoNewWindow `
|
||||||
|
-PassThru `
|
||||||
|
-Wait `
|
||||||
|
-RedirectStandardOutput "license.txt"
|
||||||
|
|
||||||
|
$PARSEDFILE = (Get-Content "license.txt" | Select-String -AllMatches -Pattern '\".*?\"' | ForEach-Object { $_.Matches.Value }) -replace '"'
|
||||||
|
|
||||||
|
$env:FLOATING_LICENSE = $PARSEDFILE[1]
|
||||||
|
$FLOATING_LICENSE_TIMEOUT = $PARSEDFILE[3]
|
||||||
|
|
||||||
|
Write-Output "Acquired floating license: ""$env:FLOATING_LICENSE"" with timeout $FLOATING_LICENSE_TIMEOUT"
|
||||||
|
# Store the exit code from the verify command
|
||||||
|
$ACTIVATION_EXIT_CODE = $ACTIVATION_OUTPUT.ExitCode
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#
|
#
|
||||||
|
11
dist/platforms/windows/return_license.ps1
vendored
11
dist/platforms/windows/return_license.ps1
vendored
@ -6,7 +6,16 @@ Write-Output "# Return License #"
|
|||||||
Write-Output "###########################"
|
Write-Output "###########################"
|
||||||
Write-Output ""
|
Write-Output ""
|
||||||
|
|
||||||
if (($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($null -ne ${env:UNITY_PASSWORD}))
|
if (($null -ne ${env:UNITY_LICENSING_SERVER}))
|
||||||
|
{
|
||||||
|
Write-Output "Returning floating license: ""$env:FLOATING_LICENSE"""
|
||||||
|
Start-Process -FilePath "$Env:UNITY_PATH\Editor\Data\Resources\Licensing\Client\Unity.Licensing.Client.exe" `
|
||||||
|
-ArgumentList "--return-floating ""$env:FLOATING_LICENSE"" " `
|
||||||
|
-NoNewWindow `
|
||||||
|
-Wait
|
||||||
|
}
|
||||||
|
|
||||||
|
elseif (($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($null -ne ${env:UNITY_PASSWORD}))
|
||||||
{
|
{
|
||||||
#
|
#
|
||||||
# SERIAL LICENSE MODE
|
# SERIAL LICENSE MODE
|
||||||
|
10
dist/platforms/windows/set_gitcredential.ps1
vendored
10
dist/platforms/windows/set_gitcredential.ps1
vendored
@ -5,12 +5,12 @@ else {
|
|||||||
Write-Host "GIT_PRIVATE_TOKEN is set configuring git credentials"
|
Write-Host "GIT_PRIVATE_TOKEN is set configuring git credentials"
|
||||||
|
|
||||||
git config --global credential.helper store
|
git config --global credential.helper store
|
||||||
git config --global --replace-all "url.https://token:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "ssh://git@github.com/"
|
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 "git@github.com"
|
||||||
git config --global --add "url.https://token:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "https://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://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:"
|
git config --global url."https://git:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "git@github.com:"
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "---------- git config --list -------------"
|
Write-Host "---------- git config --list -------------"
|
||||||
|
@ -113,6 +113,7 @@ class Docker {
|
|||||||
--volume "C:/ProgramData/Microsoft/VisualStudio":"C:/ProgramData/Microsoft/VisualStudio" \
|
--volume "C:/ProgramData/Microsoft/VisualStudio":"C:/ProgramData/Microsoft/VisualStudio" \
|
||||||
--volume "${actionFolder}/default-build-script":"c:/UnityBuilderAction" \
|
--volume "${actionFolder}/default-build-script":"c:/UnityBuilderAction" \
|
||||||
--volume "${actionFolder}/platforms/windows":"c:/steps" \
|
--volume "${actionFolder}/platforms/windows":"c:/steps" \
|
||||||
|
--volume "${actionFolder}/unity-config":"C:/ProgramData/Unity/config" \
|
||||||
--volume "${actionFolder}/BlankProject":"c:/BlankProject" \
|
--volume "${actionFolder}/BlankProject":"c:/BlankProject" \
|
||||||
--cpus=${dockerCpuLimit} \
|
--cpus=${dockerCpuLimit} \
|
||||||
--memory=${dockerMemoryLimit} \
|
--memory=${dockerMemoryLimit} \
|
||||||
|
@ -2,7 +2,7 @@ import ImageTag from './image-tag';
|
|||||||
|
|
||||||
describe('ImageTag', () => {
|
describe('ImageTag', () => {
|
||||||
const testImageParameters = {
|
const testImageParameters = {
|
||||||
editorVersion: '2099.9.f9f9',
|
editorVersion: '2099.9.9f9',
|
||||||
targetPlatform: 'Test',
|
targetPlatform: 'Test',
|
||||||
builderPlatform: '',
|
builderPlatform: '',
|
||||||
containerRegistryRepository: 'unityci/editor',
|
containerRegistryRepository: 'unityci/editor',
|
||||||
@ -27,7 +27,7 @@ describe('ImageTag', () => {
|
|||||||
expect(image.builderPlatform).toStrictEqual(testImageParameters.builderPlatform);
|
expect(image.builderPlatform).toStrictEqual(testImageParameters.builderPlatform);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.each(['2000.0.0f0', '2011.1.11f1'])('accepts %p version format', (version) => {
|
test.each(['2000.0.0f0', '2011.1.11f1', '6000.0.0f1'])('accepts %p version format', (version) => {
|
||||||
expect(
|
expect(
|
||||||
() =>
|
() =>
|
||||||
new ImageTag({
|
new ImageTag({
|
||||||
@ -50,23 +50,23 @@ describe('ImageTag', () => {
|
|||||||
describe('toString', () => {
|
describe('toString', () => {
|
||||||
it('returns the correct version', () => {
|
it('returns the correct version', () => {
|
||||||
const image = new ImageTag({
|
const image = new ImageTag({
|
||||||
editorVersion: '2099.1.1111',
|
editorVersion: '2099.1.1111f1',
|
||||||
targetPlatform: testImageParameters.targetPlatform,
|
targetPlatform: testImageParameters.targetPlatform,
|
||||||
containerRegistryRepository: 'unityci/editor',
|
containerRegistryRepository: 'unityci/editor',
|
||||||
containerRegistryImageVersion: '3',
|
containerRegistryImageVersion: '3',
|
||||||
});
|
});
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
expect(image.toString()).toStrictEqual(`${defaults.image}:windows-2099.1.1111-3`);
|
expect(image.toString()).toStrictEqual(`${defaults.image}:windows-2099.1.1111f1-3`);
|
||||||
break;
|
break;
|
||||||
case 'linux':
|
case 'linux':
|
||||||
expect(image.toString()).toStrictEqual(`${defaults.image}:ubuntu-2099.1.1111-3`);
|
expect(image.toString()).toStrictEqual(`${defaults.image}:ubuntu-2099.1.1111f1-3`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
it('returns customImage if given', () => {
|
it('returns customImage if given', () => {
|
||||||
const image = new ImageTag({
|
const image = new ImageTag({
|
||||||
editorVersion: '2099.1.1111',
|
editorVersion: '2099.1.1111f1',
|
||||||
targetPlatform: testImageParameters.targetPlatform,
|
targetPlatform: testImageParameters.targetPlatform,
|
||||||
customImage: `${defaults.image}:2099.1.1111@347598437689743986`,
|
customImage: `${defaults.image}:2099.1.1111@347598437689743986`,
|
||||||
containerRegistryRepository: 'unityci/editor',
|
containerRegistryRepository: 'unityci/editor',
|
||||||
|
@ -42,7 +42,7 @@ class ImageTag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static get versionPattern(): RegExp {
|
static get versionPattern(): RegExp {
|
||||||
return /^(20\d{2}\.\d\.\w{3,4}|3)$/;
|
return /^\d+\.\d+\.\d+[a-z]\d+$/;
|
||||||
}
|
}
|
||||||
|
|
||||||
static get targetPlatformSuffixes() {
|
static get targetPlatformSuffixes() {
|
||||||
|
@ -4,9 +4,14 @@ import { BuildParameters } from '..';
|
|||||||
class ValidateWindows {
|
class ValidateWindows {
|
||||||
public static validate(buildParameters: BuildParameters) {
|
public static validate(buildParameters: BuildParameters) {
|
||||||
ValidateWindows.validateWindowsPlatformRequirements(buildParameters.targetPlatform);
|
ValidateWindows.validateWindowsPlatformRequirements(buildParameters.targetPlatform);
|
||||||
if (!(process.env.UNITY_EMAIL && process.env.UNITY_PASSWORD)) {
|
|
||||||
throw new Error(`Unity email and password must be set for Windows based builds to
|
const { unityLicensingServer } = buildParameters;
|
||||||
authenticate the license. Make sure to set them inside UNITY_EMAIL
|
const hasLicensingCredentials = process.env.UNITY_EMAIL && process.env.UNITY_PASSWORD;
|
||||||
|
const hasValidLicensingStrategy = hasLicensingCredentials || unityLicensingServer;
|
||||||
|
|
||||||
|
if (!hasValidLicensingStrategy) {
|
||||||
|
throw new Error(`Unity email and password or alternatively a Unity licensing server url must be set for
|
||||||
|
Windows based builds to authenticate the license. Make sure to set them inside UNITY_EMAIL
|
||||||
and UNITY_PASSWORD in Github Secrets and pass them into the environment.`);
|
and UNITY_PASSWORD in Github Secrets and pass them into the environment.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,12 @@ describe('Unity Versioning', () => {
|
|||||||
m_EditorVersionWithRevision: 2021.3.4f1 (cb45f9cae8b7)`;
|
m_EditorVersionWithRevision: 2021.3.4f1 (cb45f9cae8b7)`;
|
||||||
expect(UnityVersioning.parse(projectVersionContents)).toBe('2021.3.4f1');
|
expect(UnityVersioning.parse(projectVersionContents)).toBe('2021.3.4f1');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('parses Unity 6000 and newer from ProjectVersion.txt', () => {
|
||||||
|
const projectVersionContents = `m_EditorVersion: 6000.0.0f1
|
||||||
|
m_EditorVersionWithRevision: 6000.0.0f1 (cb45f9cae8b7)`;
|
||||||
|
expect(UnityVersioning.parse(projectVersionContents)).toBe('6000.0.0f1');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('read', () => {
|
describe('read', () => {
|
||||||
|
@ -2,10 +2,6 @@ import fs from 'node:fs';
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
export default class UnityVersioning {
|
export default class UnityVersioning {
|
||||||
static get versionPattern() {
|
|
||||||
return /20\d{2}\.\d\.\w{3,4}|3/;
|
|
||||||
}
|
|
||||||
|
|
||||||
static determineUnityVersion(projectPath: string, unityVersion: string) {
|
static determineUnityVersion(projectPath: string, unityVersion: string) {
|
||||||
if (unityVersion === 'auto') {
|
if (unityVersion === 'auto') {
|
||||||
return UnityVersioning.read(projectPath);
|
return UnityVersioning.read(projectPath);
|
||||||
@ -24,11 +20,13 @@ export default class UnityVersioning {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static parse(projectVersionTxt: string) {
|
static parse(projectVersionTxt: string) {
|
||||||
const matches = projectVersionTxt.match(UnityVersioning.versionPattern);
|
const versionRegex = /m_EditorVersion: (\d+\.\d+\.\d+[A-Za-z]?\d+)/;
|
||||||
if (!matches || matches.length === 0) {
|
const matches = projectVersionTxt.match(versionRegex);
|
||||||
throw new Error(`Failed to parse version from "${projectVersionTxt}".`);
|
|
||||||
|
if (!matches || matches.length < 2) {
|
||||||
|
throw new Error(`Failed to extract version from "${projectVersionTxt}".`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return matches[0];
|
return matches[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,21 @@ export default class Versioning {
|
|||||||
* identifies the current commit.
|
* identifies the current commit.
|
||||||
*/
|
*/
|
||||||
static async getVersionDescription() {
|
static async getVersionDescription() {
|
||||||
return this.git(['describe', '--long', '--tags', '--always', 'HEAD']);
|
const versionTags = (await this.git(['tag', '--list', '--merged', 'HEAD', '--sort=-creatordate']))
|
||||||
|
.split('\n')
|
||||||
|
.filter((tag) => new RegExp(this.grepCompatibleInputVersionRegex).test(tag));
|
||||||
|
|
||||||
|
if (versionTags.length === 0) {
|
||||||
|
core.warning('No valid version tags found. Using fallback description.');
|
||||||
|
|
||||||
|
return this.git(['describe', '--long', '--tags', '--always', 'HEAD']);
|
||||||
|
}
|
||||||
|
|
||||||
|
const latestVersionTag = versionTags[0];
|
||||||
|
const commitsCount = (await this.git(['rev-list', `${latestVersionTag}..HEAD`, '--count'])).trim();
|
||||||
|
const commitHash = (await this.git(['rev-parse', '--short', 'HEAD'])).trim();
|
||||||
|
|
||||||
|
return `${latestVersionTag}-${commitsCount}-g${commitHash}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user