mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-02-04 08:09:08 +08:00
Compare commits
13 Commits
v1.5
...
v2.0-alpha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9707ad7ad5 | ||
|
|
8eeb848483 | ||
|
|
9e2a1b2d35 | ||
|
|
471bf0bdf0 | ||
|
|
6c2fbff839 | ||
|
|
72ab50499d | ||
|
|
9269fba307 | ||
|
|
dc54ae10a5 | ||
|
|
5417369dba | ||
|
|
483b784253 | ||
|
|
046ab3a72d | ||
|
|
ec0baa5d7b | ||
|
|
5b8f3cf342 |
File diff suppressed because one or more lines are too long
21
action/steps/activate.sh
Normal file → Executable file
21
action/steps/activate.sh
Normal file → Executable file
@@ -24,9 +24,7 @@ if [[ -n "$UNITY_LICENSE" ]] || [[ -n "$UNITY_LICENSE_FILE" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Activate license
|
# Activate license
|
||||||
ACTIVATION_OUTPUT=$(xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
|
ACTIVATION_OUTPUT=$(unity-editor \
|
||||||
/opt/Unity/Editor/Unity \
|
|
||||||
-batchmode \
|
|
||||||
-nographics \
|
-nographics \
|
||||||
-logFile /dev/stdout \
|
-logFile /dev/stdout \
|
||||||
-quit \
|
-quit \
|
||||||
@@ -63,15 +61,14 @@ elif [[ -n "$UNITY_SERIAL" && -n "$UNITY_EMAIL" && -n "$UNITY_PASSWORD" ]]; then
|
|||||||
echo "Requesting activation (professional license)"
|
echo "Requesting activation (professional license)"
|
||||||
|
|
||||||
# Activate license
|
# Activate license
|
||||||
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
|
unity-editor \
|
||||||
/opt/Unity/Editor/Unity \
|
-batchmode \
|
||||||
-batchmode \
|
-nographics \
|
||||||
-nographics \
|
-logFile /dev/stdout \
|
||||||
-logFile /dev/stdout \
|
-quit \
|
||||||
-quit \
|
-serial "$UNITY_SERIAL" \
|
||||||
-serial "$UNITY_SERIAL" \
|
-username "$UNITY_EMAIL" \
|
||||||
-username "$UNITY_EMAIL" \
|
-password "$UNITY_PASSWORD"
|
||||||
-password "$UNITY_PASSWORD"
|
|
||||||
|
|
||||||
# Store the exit code from the verify command
|
# Store the exit code from the verify command
|
||||||
UNITY_EXIT_CODE=$?
|
UNITY_EXIT_CODE=$?
|
||||||
|
|||||||
@@ -108,25 +108,23 @@ echo "# Building platform #"
|
|||||||
echo "###########################"
|
echo "###########################"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
|
unity-editor \
|
||||||
/opt/Unity/Editor/Unity \
|
-nographics \
|
||||||
-batchmode \
|
-logfile /dev/stdout \
|
||||||
-nographics \
|
-quit \
|
||||||
-logfile /dev/stdout \
|
-customBuildName "$BUILD_NAME" \
|
||||||
-quit \
|
-projectPath "$UNITY_PROJECT_PATH" \
|
||||||
-customBuildName "$BUILD_NAME" \
|
-buildTarget "$BUILD_TARGET" \
|
||||||
-projectPath "$UNITY_PROJECT_PATH" \
|
-customBuildTarget "$BUILD_TARGET" \
|
||||||
-buildTarget "$BUILD_TARGET" \
|
-customBuildPath "$CUSTOM_BUILD_PATH" \
|
||||||
-customBuildTarget "$BUILD_TARGET" \
|
-executeMethod "$BUILD_METHOD" \
|
||||||
-customBuildPath "$CUSTOM_BUILD_PATH" \
|
-buildVersion "$VERSION" \
|
||||||
-executeMethod "$BUILD_METHOD" \
|
-androidVersionCode "$ANDROID_VERSION_CODE" \
|
||||||
-buildVersion "$VERSION" \
|
-androidKeystoreName "$ANDROID_KEYSTORE_NAME" \
|
||||||
-androidVersionCode "$ANDROID_VERSION_CODE" \
|
-androidKeystorePass "$ANDROID_KEYSTORE_PASS" \
|
||||||
-androidKeystoreName "$ANDROID_KEYSTORE_NAME" \
|
-androidKeyaliasName "$ANDROID_KEYALIAS_NAME" \
|
||||||
-androidKeystorePass "$ANDROID_KEYSTORE_PASS" \
|
-androidKeyaliasPass "$ANDROID_KEYALIAS_PASS" \
|
||||||
-androidKeyaliasName "$ANDROID_KEYALIAS_NAME" \
|
$CUSTOM_PARAMETERS
|
||||||
-androidKeyaliasPass "$ANDROID_KEYALIAS_PASS" \
|
|
||||||
$CUSTOM_PARAMETERS
|
|
||||||
|
|
||||||
# Catch exit code
|
# Catch exit code
|
||||||
BUILD_EXIT_CODE=$?
|
BUILD_EXIT_CODE=$?
|
||||||
|
|||||||
12
action/steps/return_license.sh
Normal file → Executable file
12
action/steps/return_license.sh
Normal file → Executable file
@@ -6,11 +6,9 @@ if [[ -n "$UNITY_SERIAL" ]]; then
|
|||||||
#
|
#
|
||||||
# This will return the license that is currently in use.
|
# This will return the license that is currently in use.
|
||||||
#
|
#
|
||||||
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
|
unity-editor \
|
||||||
/opt/Unity/Editor/Unity \
|
-nographics \
|
||||||
-batchmode \
|
-logFile /dev/stdout \
|
||||||
-nographics \
|
-quit \
|
||||||
-logFile /dev/stdout \
|
-returnlicense
|
||||||
-quit \
|
|
||||||
-returnlicense
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { has, get, trimEnd, trimStart } from 'lodash-es';
|
import { trimEnd, trimStart } from 'lodash-es';
|
||||||
import Platform from './platform';
|
import Platform from './platform';
|
||||||
|
|
||||||
class ImageTag {
|
class ImageTag {
|
||||||
constructor(imageProperties) {
|
constructor(imageProperties) {
|
||||||
const {
|
const {
|
||||||
repository = 'gableroux',
|
repository = 'unityci',
|
||||||
name = 'unity3d',
|
name = 'editor',
|
||||||
version = '2019.2.11f1',
|
version = '2019.2.11f1',
|
||||||
platform,
|
platform,
|
||||||
customImage,
|
customImage,
|
||||||
@@ -15,15 +15,7 @@ class ImageTag {
|
|||||||
throw new Error(`Invalid version "${version}".`);
|
throw new Error(`Invalid version "${version}".`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!has(ImageTag.targetPlatformToImageSuffixMap, platform)) {
|
const builderPlatform = ImageTag.getTargetPlatformToImageSuffixMap(platform, version);
|
||||||
throw new Error(`Platform "${platform}" is currently not supported.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const builderPlatform = get(
|
|
||||||
ImageTag.targetPlatformToImageSuffixMap,
|
|
||||||
platform,
|
|
||||||
ImageTag.imageSuffixes.generic,
|
|
||||||
);
|
|
||||||
|
|
||||||
Object.assign(this, { repository, name, version, platform, builderPlatform, customImage });
|
Object.assign(this, { repository, name, version, platform, builderPlatform, customImage });
|
||||||
}
|
}
|
||||||
@@ -36,40 +28,81 @@ class ImageTag {
|
|||||||
return {
|
return {
|
||||||
generic: '',
|
generic: '',
|
||||||
webgl: 'webgl',
|
webgl: 'webgl',
|
||||||
mac: 'mac',
|
mac: 'mac-mono',
|
||||||
windows: 'windows',
|
windows: 'windows-mono',
|
||||||
|
linux: 'base',
|
||||||
|
linuxIl2cpp: 'linux-il2cpp',
|
||||||
android: 'android',
|
android: 'android',
|
||||||
ios: 'ios',
|
ios: 'ios',
|
||||||
facebook: 'facebook',
|
facebook: 'facebook',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static get targetPlatformToImageSuffixMap() {
|
static getTargetPlatformToImageSuffixMap(platform, version) {
|
||||||
const { generic, webgl, mac, windows, android, ios, facebook } = ImageTag.imageSuffixes;
|
const {
|
||||||
|
generic,
|
||||||
|
webgl,
|
||||||
|
mac,
|
||||||
|
windows,
|
||||||
|
linux,
|
||||||
|
linuxIl2cpp,
|
||||||
|
android,
|
||||||
|
ios,
|
||||||
|
facebook,
|
||||||
|
} = ImageTag.imageSuffixes;
|
||||||
|
|
||||||
|
const [major, minor] = version.split('.').map((digit) => Number(digit));
|
||||||
// @see: https://docs.unity3d.com/ScriptReference/BuildTarget.html
|
// @see: https://docs.unity3d.com/ScriptReference/BuildTarget.html
|
||||||
return {
|
switch (platform) {
|
||||||
[Platform.types.StandaloneOSX]: mac,
|
case Platform.types.StandaloneOSX:
|
||||||
[Platform.types.StandaloneWindows]: windows,
|
return mac;
|
||||||
[Platform.types.StandaloneWindows64]: windows,
|
case Platform.types.StandaloneWindows:
|
||||||
[Platform.types.StandaloneLinux64]: windows,
|
return windows;
|
||||||
[Platform.types.iOS]: ios,
|
case Platform.types.StandaloneWindows64:
|
||||||
[Platform.types.Android]: android,
|
return windows;
|
||||||
[Platform.types.WebGL]: webgl,
|
case Platform.types.StandaloneLinux64: {
|
||||||
[Platform.types.WSAPlayer]: windows,
|
// Unity versions before 2019.3 do not support il2cpp
|
||||||
[Platform.types.PS4]: windows,
|
if (major >= 2020 || (major === 2019 && minor >= 3)) {
|
||||||
[Platform.types.XboxOne]: windows,
|
return linuxIl2cpp;
|
||||||
[Platform.types.tvOS]: windows,
|
}
|
||||||
[Platform.types.Switch]: windows,
|
return linux;
|
||||||
|
}
|
||||||
|
case Platform.types.iOS:
|
||||||
|
return ios;
|
||||||
|
case Platform.types.Android:
|
||||||
|
return android;
|
||||||
|
case Platform.types.WebGL:
|
||||||
|
return webgl;
|
||||||
|
case Platform.types.WSAPlayer:
|
||||||
|
return windows;
|
||||||
|
case Platform.types.PS4:
|
||||||
|
return windows;
|
||||||
|
case Platform.types.XboxOne:
|
||||||
|
return windows;
|
||||||
|
case Platform.types.tvOS:
|
||||||
|
return windows;
|
||||||
|
case Platform.types.Switch:
|
||||||
|
return windows;
|
||||||
// Unsupported
|
// Unsupported
|
||||||
[Platform.types.Lumin]: windows,
|
case Platform.types.Lumin:
|
||||||
[Platform.types.BJM]: windows,
|
return windows;
|
||||||
[Platform.types.Stadia]: windows,
|
case Platform.types.BJM:
|
||||||
[Platform.types.Facebook]: facebook,
|
return windows;
|
||||||
[Platform.types.NoTarget]: generic,
|
case Platform.types.Stadia:
|
||||||
|
return windows;
|
||||||
|
case Platform.types.Facebook:
|
||||||
|
return facebook;
|
||||||
|
case Platform.types.NoTarget:
|
||||||
|
return generic;
|
||||||
|
|
||||||
// Test specific
|
// Test specific
|
||||||
[Platform.types.Test]: generic,
|
case Platform.types.Test:
|
||||||
};
|
return generic;
|
||||||
|
default:
|
||||||
|
throw new Error(`
|
||||||
|
Platform must be one of the ones described in the documentation.
|
||||||
|
"${platform}" is currently not supported.`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get tag() {
|
get tag() {
|
||||||
@@ -87,7 +120,7 @@ class ImageTag {
|
|||||||
return this.customImage;
|
return this.customImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${image}:${tag}`;
|
return `${image}:${tag}-0`; // '0' here represents the docker repo version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ describe('UnityImageVersion', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const defaults = {
|
const defaults = {
|
||||||
repository: 'gableroux',
|
repository: 'unityci',
|
||||||
name: 'unity3d',
|
name: 'editor',
|
||||||
image: 'gableroux/unity3d',
|
image: 'unityci/editor',
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('constructor', () => {
|
describe('constructor', () => {
|
||||||
@@ -49,7 +49,7 @@ describe('UnityImageVersion', () => {
|
|||||||
it('returns the correct version', () => {
|
it('returns the correct version', () => {
|
||||||
const image = new ImageTag({ version: '2099.1.1111', platform: some.platform });
|
const image = new ImageTag({ version: '2099.1.1111', platform: some.platform });
|
||||||
|
|
||||||
expect(image.toString()).toStrictEqual(`${defaults.image}:2099.1.1111`);
|
expect(image.toString()).toStrictEqual(`${defaults.image}:2099.1.1111-0`);
|
||||||
});
|
});
|
||||||
it('returns customImage if given', () => {
|
it('returns customImage if given', () => {
|
||||||
const image = new ImageTag({
|
const image = new ImageTag({
|
||||||
@@ -64,13 +64,13 @@ describe('UnityImageVersion', () => {
|
|||||||
it('returns the specific build platform', () => {
|
it('returns the specific build platform', () => {
|
||||||
const image = new ImageTag({ version: '2019.2.11f1', platform: 'WebGL' });
|
const image = new ImageTag({ version: '2019.2.11f1', platform: 'WebGL' });
|
||||||
|
|
||||||
expect(image.toString()).toStrictEqual(`${defaults.image}:2019.2.11f1-webgl`);
|
expect(image.toString()).toStrictEqual(`${defaults.image}:2019.2.11f1-webgl-0`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns no specific build platform for generic targetPlatforms', () => {
|
it('returns no specific build platform for generic targetPlatforms', () => {
|
||||||
const image = new ImageTag({ platform: 'NoTarget' });
|
const image = new ImageTag({ platform: 'NoTarget' });
|
||||||
|
|
||||||
expect(image.toString()).toStrictEqual(`${defaults.image}:2019.2.11f1`);
|
expect(image.toString()).toStrictEqual(`${defaults.image}:2019.2.11f1-0`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user