mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
feat: add buildProfile
parameter (#685)
* feat: add `buildProfile` parameter add new `buildProfile` action param, which will be passed into Unity as the `-activeBuildProfile ...` CLI param. closes https://github.com/game-ci/unity-builder/issues/674 * ci: add tests for Unity 6 and build profiles
This commit is contained in:
parent
3ae9ec8536
commit
9d6bdcbdc5
15
.github/workflows/build-tests-ubuntu.yml
vendored
15
.github/workflows/build-tests-ubuntu.yml
vendored
@ -36,7 +36,8 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
buildForAllPlatformsUbuntu:
|
buildForAllPlatformsUbuntu:
|
||||||
name: ${{ matrix.targetPlatform }} on ${{ matrix.unityVersion }}
|
name:
|
||||||
|
"${{ matrix.targetPlatform }} on ${{ matrix.unityVersion}}${{startsWith(matrix.buildProfile, 'Assets') && ' (via Build Profile)' || '' }}"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@ -91,6 +92,12 @@ jobs:
|
|||||||
- targetPlatform: StandaloneWindows64
|
- targetPlatform: StandaloneWindows64
|
||||||
additionalParameters: -standaloneBuildSubtarget Server
|
additionalParameters: -standaloneBuildSubtarget Server
|
||||||
buildWithIl2cpp: true
|
buildWithIl2cpp: true
|
||||||
|
include:
|
||||||
|
- unityVersion: 6000.0.36f1
|
||||||
|
targetPlatform: WebGL
|
||||||
|
- unityVersion: 6000.0.36f1
|
||||||
|
targetPlatform: WebGL
|
||||||
|
buildProfile: 'Assets/Settings/Build Profiles/Sample WebGL Build Profile.asset'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Clear Space for Android Build
|
- name: Clear Space for Android Build
|
||||||
@ -136,6 +143,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
buildName: 'GameCI Test Build'
|
buildName: 'GameCI Test Build'
|
||||||
projectPath: ${{ matrix.projectPath }}
|
projectPath: ${{ matrix.projectPath }}
|
||||||
|
buildProfile: ${{ matrix.buildProfile }}
|
||||||
unityVersion: ${{ matrix.unityVersion }}
|
unityVersion: ${{ matrix.unityVersion }}
|
||||||
targetPlatform: ${{ matrix.targetPlatform }}
|
targetPlatform: ${{ matrix.targetPlatform }}
|
||||||
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue ${{ matrix.additionalParameters }}
|
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue ${{ matrix.additionalParameters }}
|
||||||
@ -158,6 +166,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
buildName: 'GameCI Test Build'
|
buildName: 'GameCI Test Build'
|
||||||
projectPath: ${{ matrix.projectPath }}
|
projectPath: ${{ matrix.projectPath }}
|
||||||
|
buildProfile: ${{ matrix.buildProfile }}
|
||||||
unityVersion: ${{ matrix.unityVersion }}
|
unityVersion: ${{ matrix.unityVersion }}
|
||||||
targetPlatform: ${{ matrix.targetPlatform }}
|
targetPlatform: ${{ matrix.targetPlatform }}
|
||||||
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue ${{ matrix.additionalParameters }}
|
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue ${{ matrix.additionalParameters }}
|
||||||
@ -179,6 +188,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
buildName: 'GameCI Test Build'
|
buildName: 'GameCI Test Build'
|
||||||
projectPath: ${{ matrix.projectPath }}
|
projectPath: ${{ matrix.projectPath }}
|
||||||
|
buildProfile: ${{ matrix.buildProfile }}
|
||||||
unityVersion: ${{ matrix.unityVersion }}
|
unityVersion: ${{ matrix.unityVersion }}
|
||||||
targetPlatform: ${{ matrix.targetPlatform }}
|
targetPlatform: ${{ matrix.targetPlatform }}
|
||||||
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue ${{ matrix.additionalParameters }}
|
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue ${{ matrix.additionalParameters }}
|
||||||
@ -191,7 +201,6 @@ jobs:
|
|||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name:
|
name:
|
||||||
'Build ${{ matrix.targetPlatform }} on Ubuntu (${{ matrix.unityVersion }}_il2cpp_${{ matrix.buildWithIl2cpp
|
"Build ${{ matrix.targetPlatform }}${{ startsWith(matrix.buildProfile, 'Assets') && ' (via Build Profile)' || '' }} on Ubuntu (${{ matrix.unityVersion }}_il2cpp_${{ matrix.buildWithIl2cpp }}_params_${{ matrix.additionalParameters }})"
|
||||||
}}_params_${{ matrix.additionalParameters }})'
|
|
||||||
path: build
|
path: build
|
||||||
retention-days: 14
|
retention-days: 14
|
||||||
|
@ -18,7 +18,11 @@ inputs:
|
|||||||
projectPath:
|
projectPath:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
description: 'Relative path to the project to be built.'
|
description: 'Path to the project to be built, relative to the repository root.'
|
||||||
|
buildProfile:
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
description: 'Path to the build profile to activate, relative to the project root.'
|
||||||
buildName:
|
buildName:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
|
@ -6,6 +6,9 @@ using UnityBuilderAction.Reporting;
|
|||||||
using UnityBuilderAction.Versioning;
|
using UnityBuilderAction.Versioning;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Build.Reporting;
|
using UnityEditor.Build.Reporting;
|
||||||
|
#if UNITY_6000_0_OR_NEWER
|
||||||
|
using UnityEditor.Build.Profile;
|
||||||
|
#endif
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityBuilderAction
|
namespace UnityBuilderAction
|
||||||
@ -17,47 +20,9 @@ namespace UnityBuilderAction
|
|||||||
// Gather values from args
|
// Gather values from args
|
||||||
var options = ArgumentsParser.GetValidatedOptions();
|
var options = ArgumentsParser.GetValidatedOptions();
|
||||||
|
|
||||||
// Gather values from project
|
|
||||||
var scenes = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(s => s.path).ToArray();
|
|
||||||
|
|
||||||
// Get all buildOptions from options
|
|
||||||
BuildOptions buildOptions = BuildOptions.None;
|
|
||||||
foreach (string buildOptionString in Enum.GetNames(typeof(BuildOptions))) {
|
|
||||||
if (options.ContainsKey(buildOptionString)) {
|
|
||||||
BuildOptions buildOptionEnum = (BuildOptions) Enum.Parse(typeof(BuildOptions), buildOptionString);
|
|
||||||
buildOptions |= buildOptionEnum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if UNITY_2021_2_OR_NEWER
|
|
||||||
// Determine subtarget
|
|
||||||
StandaloneBuildSubtarget buildSubtarget;
|
|
||||||
if (!options.TryGetValue("standaloneBuildSubtarget", out var subtargetValue) || !Enum.TryParse(subtargetValue, out buildSubtarget)) {
|
|
||||||
buildSubtarget = default;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Define BuildPlayer Options
|
|
||||||
var buildPlayerOptions = new BuildPlayerOptions {
|
|
||||||
scenes = scenes,
|
|
||||||
locationPathName = options["customBuildPath"],
|
|
||||||
target = (BuildTarget) Enum.Parse(typeof(BuildTarget), options["buildTarget"]),
|
|
||||||
options = buildOptions,
|
|
||||||
#if UNITY_2021_2_OR_NEWER
|
|
||||||
subtarget = (int) buildSubtarget
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
// Set version for this build
|
// Set version for this build
|
||||||
VersionApplicator.SetVersion(options["buildVersion"]);
|
VersionApplicator.SetVersion(options["buildVersion"]);
|
||||||
|
|
||||||
// Apply Android settings
|
|
||||||
if (buildPlayerOptions.target == BuildTarget.Android)
|
|
||||||
{
|
|
||||||
VersionApplicator.SetAndroidVersionCode(options["androidVersionCode"]);
|
|
||||||
AndroidSettings.Apply(options);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Execute default AddressableAsset content build, if the package is installed.
|
// Execute default AddressableAsset content build, if the package is installed.
|
||||||
// Version defines would be the best solution here, but Unity 2018 doesn't support that,
|
// Version defines would be the best solution here, but Unity 2018 doesn't support that,
|
||||||
// so we fall back to using reflection instead.
|
// so we fall back to using reflection instead.
|
||||||
@ -78,6 +43,72 @@ namespace UnityBuilderAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get all buildOptions from options
|
||||||
|
BuildOptions buildOptions = BuildOptions.None;
|
||||||
|
foreach (string buildOptionString in Enum.GetNames(typeof(BuildOptions))) {
|
||||||
|
if (options.ContainsKey(buildOptionString)) {
|
||||||
|
BuildOptions buildOptionEnum = (BuildOptions) Enum.Parse(typeof(BuildOptions), buildOptionString);
|
||||||
|
buildOptions |= buildOptionEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Depending on whether the build is using a build profile, `buildPlayerOptions` will an instance
|
||||||
|
// of either `UnityEditor.BuildPlayerOptions` or `UnityEditor.BuildPlayerWithProfileOptions`
|
||||||
|
dynamic buildPlayerOptions;
|
||||||
|
|
||||||
|
if (options["customBuildProfile"] != "") {
|
||||||
|
|
||||||
|
#if UNITY_6000_0_OR_NEWER
|
||||||
|
// Load build profile from Assets folder
|
||||||
|
BuildProfile buildProfile = AssetDatabase.LoadAssetAtPath<BuildProfile>(options["customBuildProfile"]);
|
||||||
|
|
||||||
|
// Set it as active
|
||||||
|
BuildProfile.SetActiveBuildProfile(buildProfile);
|
||||||
|
|
||||||
|
// Define BuildPlayerWithProfileOptions
|
||||||
|
buildPlayerOptions = new BuildPlayerWithProfileOptions {
|
||||||
|
buildProfile = buildProfile,
|
||||||
|
locationPathName = options["customBuildPath"],
|
||||||
|
options = buildOptions,
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
throw new Exception("Build profiles are not supported by this version of Unity (" + Application.unityVersion +")");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Gather values from project
|
||||||
|
var scenes = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(s => s.path).ToArray();
|
||||||
|
|
||||||
|
#if UNITY_2021_2_OR_NEWER
|
||||||
|
// Determine subtarget
|
||||||
|
StandaloneBuildSubtarget buildSubtarget;
|
||||||
|
if (!options.TryGetValue("standaloneBuildSubtarget", out var subtargetValue) || !Enum.TryParse(subtargetValue, out buildSubtarget)) {
|
||||||
|
buildSubtarget = default;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BuildTarget buildTarget = (BuildTarget) Enum.Parse(typeof(BuildTarget), options["buildTarget"]);
|
||||||
|
|
||||||
|
// Define BuildPlayerOptions
|
||||||
|
buildPlayerOptions = new BuildPlayerOptions {
|
||||||
|
scenes = scenes,
|
||||||
|
locationPathName = options["customBuildPath"],
|
||||||
|
target = buildTarget,
|
||||||
|
options = buildOptions,
|
||||||
|
#if UNITY_2021_2_OR_NEWER
|
||||||
|
subtarget = (int) buildSubtarget
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
// Apply Android settings
|
||||||
|
if (buildTarget == BuildTarget.Android) {
|
||||||
|
VersionApplicator.SetAndroidVersionCode(options["androidVersionCode"]);
|
||||||
|
AndroidSettings.Apply(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Perform build
|
// Perform build
|
||||||
BuildReport buildReport = BuildPipeline.BuildPlayer(buildPlayerOptions);
|
BuildReport buildReport = BuildPipeline.BuildPlayer(buildPlayerOptions);
|
||||||
|
|
||||||
|
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.
18
dist/platforms/mac/steps/build.sh
vendored
18
dist/platforms/mac/steps/build.sh
vendored
@ -19,6 +19,23 @@ echo "Using build name \"$BUILD_NAME\"."
|
|||||||
|
|
||||||
echo "Using build target \"$BUILD_TARGET\"."
|
echo "Using build target \"$BUILD_TARGET\"."
|
||||||
|
|
||||||
|
#
|
||||||
|
# Display the build profile
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ -z "$BUILD_PROFILE" ]; then
|
||||||
|
# User has not provided a build profile
|
||||||
|
#
|
||||||
|
echo "Doing a default \"$BUILD_TARGET\" platform build."
|
||||||
|
#
|
||||||
|
else
|
||||||
|
# User has provided a path to a build profile `.asset` file
|
||||||
|
#
|
||||||
|
echo "Using build profile \"$BUILD_PROFILE\" relative to \"$UNITY_PROJECT_PATH\"."
|
||||||
|
#
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Display build path and file
|
# Display build path and file
|
||||||
#
|
#
|
||||||
@ -139,6 +156,7 @@ echo ""
|
|||||||
-buildTarget "$BUILD_TARGET" \
|
-buildTarget "$BUILD_TARGET" \
|
||||||
-customBuildTarget "$BUILD_TARGET" \
|
-customBuildTarget "$BUILD_TARGET" \
|
||||||
-customBuildPath "$CUSTOM_BUILD_PATH" \
|
-customBuildPath "$CUSTOM_BUILD_PATH" \
|
||||||
|
-customBuildProfile "$BUILD_PROFILE" \
|
||||||
-executeMethod "$BUILD_METHOD" \
|
-executeMethod "$BUILD_METHOD" \
|
||||||
-buildVersion "$VERSION" \
|
-buildVersion "$VERSION" \
|
||||||
-androidVersionCode "$ANDROID_VERSION_CODE" \
|
-androidVersionCode "$ANDROID_VERSION_CODE" \
|
||||||
|
17
dist/platforms/ubuntu/steps/build.sh
vendored
17
dist/platforms/ubuntu/steps/build.sh
vendored
@ -19,6 +19,22 @@ echo "Using build name \"$BUILD_NAME\"."
|
|||||||
|
|
||||||
echo "Using build target \"$BUILD_TARGET\"."
|
echo "Using build target \"$BUILD_TARGET\"."
|
||||||
|
|
||||||
|
#
|
||||||
|
# Display the build profile
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ -z "$BUILD_PROFILE" ]; then
|
||||||
|
# User has not provided a build profile
|
||||||
|
#
|
||||||
|
echo "Doing a default \"$BUILD_TARGET\" platform build."
|
||||||
|
#
|
||||||
|
else
|
||||||
|
# User has provided a path to a build profile `.asset` file
|
||||||
|
#
|
||||||
|
echo "Using build profile \"$BUILD_PROFILE\" relative to \"$UNITY_PROJECT_PATH\"."
|
||||||
|
#
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Display build path and file
|
# Display build path and file
|
||||||
#
|
#
|
||||||
@ -112,6 +128,7 @@ unity-editor \
|
|||||||
-buildTarget "$BUILD_TARGET" \
|
-buildTarget "$BUILD_TARGET" \
|
||||||
-customBuildTarget "$BUILD_TARGET" \
|
-customBuildTarget "$BUILD_TARGET" \
|
||||||
-customBuildPath "$CUSTOM_BUILD_PATH" \
|
-customBuildPath "$CUSTOM_BUILD_PATH" \
|
||||||
|
-customBuildProfile "$BUILD_PROFILE" \
|
||||||
-executeMethod "$BUILD_METHOD" \
|
-executeMethod "$BUILD_METHOD" \
|
||||||
-buildVersion "$VERSION" \
|
-buildVersion "$VERSION" \
|
||||||
-androidVersionCode "$ANDROID_VERSION_CODE" \
|
-androidVersionCode "$ANDROID_VERSION_CODE" \
|
||||||
|
20
dist/platforms/windows/build.ps1
vendored
20
dist/platforms/windows/build.ps1
vendored
@ -16,6 +16,25 @@ Write-Output "$('Using build name "')$($Env:BUILD_NAME)$('".')"
|
|||||||
|
|
||||||
Write-Output "$('Using build target "')$($Env:BUILD_TARGET)$('".')"
|
Write-Output "$('Using build target "')$($Env:BUILD_TARGET)$('".')"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Display the build profile
|
||||||
|
#
|
||||||
|
|
||||||
|
if ($Env:BUILD_PROFILE)
|
||||||
|
{
|
||||||
|
# User has provided a path to a build profile `.asset` file
|
||||||
|
#
|
||||||
|
Write-Output "$('Using build profile "')$($Env:BUILD_PROFILE)$('" relative to "')$($Env:UNITY_PROJECT_PATH)$('".')"
|
||||||
|
#
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# User has not provided a build profile
|
||||||
|
#
|
||||||
|
Write-Output "$('Doing a default "')$($Env:BUILD_TARGET)$('" platform build.')"
|
||||||
|
#
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Display build path and file
|
# Display build path and file
|
||||||
#
|
#
|
||||||
@ -143,6 +162,7 @@ $unityArgs = @(
|
|||||||
"-buildTarget", "`"$Env:BUILD_TARGET`"",
|
"-buildTarget", "`"$Env:BUILD_TARGET`"",
|
||||||
"-customBuildTarget", "`"$Env:BUILD_TARGET`"",
|
"-customBuildTarget", "`"$Env:BUILD_TARGET`"",
|
||||||
"-customBuildPath", "`"$Env:CUSTOM_BUILD_PATH`"",
|
"-customBuildPath", "`"$Env:CUSTOM_BUILD_PATH`"",
|
||||||
|
"-customBuildProfile", "`"$Env:BUILD_PROFILE`"",
|
||||||
"-buildVersion", "`"$Env:VERSION`"",
|
"-buildVersion", "`"$Env:VERSION`"",
|
||||||
"-androidVersionCode", "`"$Env:ANDROID_VERSION_CODE`"",
|
"-androidVersionCode", "`"$Env:ANDROID_VERSION_CODE`"",
|
||||||
"-androidKeystorePass", "`"$Env:ANDROID_KEYSTORE_PASS`"",
|
"-androidKeystorePass", "`"$Env:ANDROID_KEYSTORE_PASS`"",
|
||||||
|
@ -71,6 +71,12 @@ describe('BuildParameters', () => {
|
|||||||
await expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ projectPath: mockValue }));
|
await expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ projectPath: mockValue }));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('returns the build profile', async () => {
|
||||||
|
const mockValue = 'path/to/build_profile.asset';
|
||||||
|
jest.spyOn(Input, 'buildProfile', 'get').mockReturnValue(mockValue);
|
||||||
|
await expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ buildProfile: mockValue }));
|
||||||
|
});
|
||||||
|
|
||||||
it('returns the build name', async () => {
|
it('returns the build name', async () => {
|
||||||
const mockValue = 'someBuildName';
|
const mockValue = 'someBuildName';
|
||||||
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(mockValue);
|
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(mockValue);
|
||||||
|
@ -26,6 +26,7 @@ class BuildParameters {
|
|||||||
public runnerTempPath!: string;
|
public runnerTempPath!: string;
|
||||||
public targetPlatform!: string;
|
public targetPlatform!: string;
|
||||||
public projectPath!: string;
|
public projectPath!: string;
|
||||||
|
public buildProfile!: string;
|
||||||
public buildName!: string;
|
public buildName!: string;
|
||||||
public buildPath!: string;
|
public buildPath!: string;
|
||||||
public buildFile!: string;
|
public buildFile!: string;
|
||||||
@ -152,6 +153,7 @@ class BuildParameters {
|
|||||||
runnerTempPath: Input.runnerTempPath,
|
runnerTempPath: Input.runnerTempPath,
|
||||||
targetPlatform: Input.targetPlatform,
|
targetPlatform: Input.targetPlatform,
|
||||||
projectPath: Input.projectPath,
|
projectPath: Input.projectPath,
|
||||||
|
buildProfile: Input.buildProfile,
|
||||||
buildName: Input.buildName,
|
buildName: Input.buildName,
|
||||||
buildPath: `${Input.buildsPath}/${Input.targetPlatform}`,
|
buildPath: `${Input.buildsPath}/${Input.targetPlatform}`,
|
||||||
buildFile,
|
buildFile,
|
||||||
|
@ -36,6 +36,7 @@ class ImageEnvironmentFactory {
|
|||||||
value: process.env.USYM_UPLOAD_AUTH_TOKEN,
|
value: process.env.USYM_UPLOAD_AUTH_TOKEN,
|
||||||
},
|
},
|
||||||
{ name: 'PROJECT_PATH', value: parameters.projectPath },
|
{ name: 'PROJECT_PATH', value: parameters.projectPath },
|
||||||
|
{ name: 'BUILD_PROFILE', value: parameters.buildProfile },
|
||||||
{ name: 'BUILD_TARGET', value: parameters.targetPlatform },
|
{ name: 'BUILD_TARGET', value: parameters.targetPlatform },
|
||||||
{ name: 'BUILD_NAME', value: parameters.buildName },
|
{ name: 'BUILD_NAME', value: parameters.buildName },
|
||||||
{ name: 'BUILD_PATH', value: parameters.buildPath },
|
{ name: 'BUILD_PATH', value: parameters.buildPath },
|
||||||
|
@ -59,6 +59,19 @@ describe('Input', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('buildProfile', () => {
|
||||||
|
it('returns the default value', () => {
|
||||||
|
expect(Input.buildProfile).toStrictEqual('');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('takes input from the users workflow', () => {
|
||||||
|
const mockValue = 'path/to/build_profile.asset';
|
||||||
|
const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue);
|
||||||
|
expect(Input.buildProfile).toStrictEqual(mockValue);
|
||||||
|
expect(spy).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('buildName', () => {
|
describe('buildName', () => {
|
||||||
it('returns the default value', () => {
|
it('returns the default value', () => {
|
||||||
expect(Input.buildName).toStrictEqual(Input.targetPlatform);
|
expect(Input.buildName).toStrictEqual(Input.targetPlatform);
|
||||||
|
@ -107,6 +107,10 @@ class Input {
|
|||||||
return rawProjectPath.replace(/\/$/, '');
|
return rawProjectPath.replace(/\/$/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get buildProfile(): string {
|
||||||
|
return Input.getInput('buildProfile') ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
static get runnerTempPath(): string {
|
static get runnerTempPath(): string {
|
||||||
return Input.getInput('RUNNER_TEMP') ?? '';
|
return Input.getInput('RUNNER_TEMP') ?? '';
|
||||||
}
|
}
|
||||||
|
@ -170,6 +170,7 @@ class SetupMac {
|
|||||||
process.env.UNITY_LICENSING_SERVER = buildParameters.unityLicensingServer;
|
process.env.UNITY_LICENSING_SERVER = buildParameters.unityLicensingServer;
|
||||||
process.env.SKIP_ACTIVATION = buildParameters.skipActivation;
|
process.env.SKIP_ACTIVATION = buildParameters.skipActivation;
|
||||||
process.env.PROJECT_PATH = buildParameters.projectPath;
|
process.env.PROJECT_PATH = buildParameters.projectPath;
|
||||||
|
process.env.BUILD_PROFILE = buildParameters.buildProfile;
|
||||||
process.env.BUILD_TARGET = buildParameters.targetPlatform;
|
process.env.BUILD_TARGET = buildParameters.targetPlatform;
|
||||||
process.env.BUILD_NAME = buildParameters.buildName;
|
process.env.BUILD_NAME = buildParameters.buildName;
|
||||||
process.env.BUILD_PATH = buildParameters.buildPath;
|
process.env.BUILD_PATH = buildParameters.buildPath;
|
||||||
|
8
test-project/Assets/Settings.meta
Normal file
8
test-project/Assets/Settings.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 28bfc999a135648538355bfcb6a23aee
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
test-project/Assets/Settings/Build Profiles.meta
Normal file
8
test-project/Assets/Settings/Build Profiles.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cd91492ed9aca40c49d42156a4a8f387
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,46 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 15003, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_Name: Sample WebGL Build Profile
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_AssetVersion: 1
|
||||||
|
m_BuildTarget: 20
|
||||||
|
m_Subtarget: 0
|
||||||
|
m_PlatformId: 84a3bb9e7420477f885e98145999eb20
|
||||||
|
m_PlatformBuildProfile:
|
||||||
|
rid: 200022742090383361
|
||||||
|
m_OverrideGlobalSceneList: 0
|
||||||
|
m_Scenes: []
|
||||||
|
m_ScriptingDefines: []
|
||||||
|
m_PlayerSettingsYaml:
|
||||||
|
m_Settings: []
|
||||||
|
references:
|
||||||
|
version: 2
|
||||||
|
RefIds:
|
||||||
|
- rid: 200022742090383361
|
||||||
|
type: {class: WebGLPlatformSettings, ns: UnityEditor.WebGL, asm: UnityEditor.WebGL.Extensions}
|
||||||
|
data:
|
||||||
|
m_Development: 0
|
||||||
|
m_ConnectProfiler: 0
|
||||||
|
m_BuildWithDeepProfilingSupport: 0
|
||||||
|
m_AllowDebugging: 0
|
||||||
|
m_WaitForManagedDebugger: 0
|
||||||
|
m_ManagedDebuggerFixedPort: 0
|
||||||
|
m_ExplicitNullChecks: 0
|
||||||
|
m_ExplicitDivideByZeroChecks: 0
|
||||||
|
m_ExplicitArrayBoundsChecks: 0
|
||||||
|
m_CompressionType: -1
|
||||||
|
m_InstallInBuildFolder: 0
|
||||||
|
m_CodeOptimization: 0
|
||||||
|
m_WebGLClientBrowserPath:
|
||||||
|
m_WebGLClientBrowserType: 0
|
||||||
|
m_WebGLTextureSubtarget: 0
|
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b9aac23ad2add4b439decb0cf65b0d68
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user