Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/build-options.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"2021.3.x",
"2022.x",
"6000.0.x",
"6000.1.x",
"6000"
],
"include": [
Expand All @@ -30,30 +31,78 @@
"build-targets": "StandaloneOSX Android iOS VisionOS",
"modules": "mac-server"
},
{
"os": "ubuntu-latest",
"build-targets": "None",
"modules": "None"
},
{
"os": "windows-latest",
"build-targets": "None",
"modules": "None"
},
{
"os": "macos-latest",
"build-targets": "None",
"modules": "None"
},
{
"os": "ubuntu-latest",
"unity-version": "2019.4.40f1",
"build-targets": "None",
"modules": "None"
},
{
"os": "ubuntu-latest",
"unity-version": "2018.4.36f1 (6cd387d23174)",
"build-targets": "None",
"modules": "None"
},
{
"os": "ubuntu-latest",
"unity-version": "2017.4.40f1 (6e14067f8a9a)",
"build-targets": "None",
"modules": "None"
}
],
"exclude": [
{
"os": "ubuntu-latest",
"unity-version": "None",
"build-targets": "StandaloneLinux64, Android, iOS",
"modules": "linux-server"
},
{
"os": "windows-latest",
"unity-version": "None",
"build-targets": "StandaloneWindows64, Android, WSAPlayer",
"modules": "windows-server"
},
{
"os": "macos-latest",
"unity-version": "None",
"build-targets": "StandaloneOSX Android iOS VisionOS",
"modules": "mac-server"
},
{
"os": "ubuntu-latest",
"unity-version": "5.6.7f1 (e80cc3114ac1)"
},
{
"os": "ubuntu-latest",
"unity-version": "4.7.2"
},
{
"os": "windows-latest",
"unity-version": "4.7.2",
"build-targets": "StandaloneWindows64, Android, WSAPlayer",
"modules": "windows-server"
},
{
"os": "macos-latest",
"unity-version": "4.7.2",
"build-targets": "StandaloneOSX Android iOS VisionOS",
"modules": "mac-server"
}
]
}
4 changes: 3 additions & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
id: setup-jobs
with:
build-options: ./.github/workflows/build-options.json
group-by: 'os'
group-by: 'unity-version'
outputs:
jobs: ${{ steps.setup-jobs.outputs.jobs }}
validate:
Expand All @@ -35,6 +35,8 @@ jobs:
contents: read
strategy:
matrix: ${{ fromJSON(needs.setup.outputs.jobs) }}
fail-fast: false
max-parallel: 1
secrets: inherit
uses: ./.github/workflows/build.yml
with:
Expand Down
171 changes: 99 additions & 72 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35503,19 +35503,27 @@ async function ValidateInputs() {
core.info(` > ${module}`);
}
}
if (modules.length === 0) {
core.info(` > None`);
}
core.info(`buildTargets:`);
const moduleMap = getPlatformTargetModuleMap();
for (const target of buildTargets) {
const module = moduleMap[target];
if (module === undefined) {
core.warning(`${target} not a valid build target!`);
if (target.toLowerCase() !== 'none') {
core.warning(`${target} is not a valid build target for ${os.type()}`);
}
continue;
}
if (!modules.includes(module)) {
modules.push(module);
core.info(` > ${target} -> ${module}`);
}
}
if (buildTargets.length == 0) {
core.info(` > None`);
}
const versions = getUnityVersionsFromInput(architecture);
const versionFilePath = await getVersionFilePath();
const unityProjectPath = versionFilePath !== undefined ? path.join(versionFilePath, '..', '..') : undefined;
Expand All @@ -35534,6 +35542,9 @@ async function ValidateInputs() {
for (const unityVersion of versions) {
core.info(` > ${unityVersion.toString()}`);
}
if (versions.length === 0) {
core.info(` > None`);
}
let installPath = core.getInput('install-path');
if (installPath) {
installPath = path.normalize(installPath.trim());
Expand Down Expand Up @@ -35574,40 +35585,41 @@ function getInstallationArch() {
}
function getPlatformTargetModuleMap() {
const osType = os.type();
let moduleMap = undefined;
if (osType == 'Linux') {
moduleMap = {
"StandaloneLinux64": "linux-il2cpp",
"Android": "android",
"WebGL": "webgl",
"iOS": "ios",
};
}
else if (osType == 'Darwin') {
moduleMap = {
"StandaloneOSX": "mac-il2cpp",
"iOS": "ios",
"Android": "android",
"tvOS": "appletv",
"StandaloneLinux64": "linux-il2cpp",
"WebGL": "webgl",
"VisionOS": "visionos"
};
}
else if (osType == 'Windows_NT') {
moduleMap = {
"StandaloneWindows64": "windows-il2cpp",
"WSAPlayer": "universal-windows-platform",
"Android": "android",
"iOS": "ios",
"tvOS": "appletv",
"StandaloneLinux64": "linux-il2cpp",
"Lumin": "lumin",
"WebGL": "webgl",
};
}
else {
throw Error(`${osType} not supported`);
let moduleMap;
switch (osType) {
case 'Linux':
moduleMap = {
"StandaloneLinux64": "linux-il2cpp",
"Android": "android",
"WebGL": "webgl",
"iOS": "ios",
};
break;
case 'Darwin':
moduleMap = {
"StandaloneOSX": "mac-il2cpp",
"iOS": "ios",
"Android": "android",
"tvOS": "appletv",
"StandaloneLinux64": "linux-il2cpp",
"WebGL": "webgl",
"VisionOS": "visionos"
};
break;
case 'Windows_NT':
moduleMap = {
"StandaloneWindows64": "windows-il2cpp",
"WSAPlayer": "universal-windows-platform",
"Android": "android",
"iOS": "ios",
"tvOS": "appletv",
"StandaloneLinux64": "linux-il2cpp",
"Lumin": "lumin",
"WebGL": "webgl",
};
break;
default:
throw Error(`${osType} not supported`);
}
return moduleMap;
}
Expand Down Expand Up @@ -35894,35 +35906,39 @@ function init() {
}
}
async function Get() {
let isCleanInstall = false;
try {
await fs.promises.access(hubPath, fs.constants.X_OK);
}
catch (error) {
hubPath = await installUnityHub();
}
const hubVersion = await getInstalledHubVersion();
if (!semver.valid(hubVersion)) {
throw new Error(`Failed to get installed Unity Hub version ${hubVersion}!`);
}
core.info(`Unity Hub Version:\n > ${hubVersion}`);
const latestHubVersion = await getLatestHubVersion();
if (!semver.valid(latestHubVersion)) {
throw new Error(`Failed to get latest Unity Hub version!`);
}
core.debug(`Latest Unity Hub Version:\n > ${latestHubVersion}`);
core.debug(`Comparing versions:\n > ${hubVersion} < ${latestHubVersion} => ${semver.compare(hubVersion, latestHubVersion)}`);
if (semver.compare(hubVersion, latestHubVersion) < 0) {
core.info(`Installing Latest Unity Hub Version:\n > ${latestHubVersion}`);
if (process.platform !== 'linux') {
core.info(`Removing previous Unity Hub version:\n > ${hubVersion}`);
await (0, utility_1.RemovePath)(hubPath);
hubPath = await installUnityHub();
}
else {
const scriptPath = __nccwpck_require__.ab + "update-unityhub-linux.sh";
const exitCode = await exec.exec('sh', [__nccwpck_require__.ab + "update-unityhub-linux.sh"]);
if (exitCode !== 0) {
throw new Error(`Failed to install Unity Hub: ${exitCode}`);
isCleanInstall = true;
}
if (!isCleanInstall) {
const hubVersion = await getInstalledHubVersion();
if (!semver.valid(hubVersion)) {
throw new Error(`Failed to get installed Unity Hub version ${hubVersion}!`);
}
core.info(`Installed Unity Hub Version:\n > ${hubVersion}`);
const latestHubVersion = await getLatestHubVersion();
if (!semver.valid(latestHubVersion)) {
throw new Error(`Failed to get latest Unity Hub version!`);
}
core.debug(`Latest Unity Hub Version:\n > ${latestHubVersion}`);
core.debug(`Comparing versions:\n > ${hubVersion} < ${latestHubVersion} => ${semver.compare(hubVersion, latestHubVersion)}`);
if (semver.compare(hubVersion, latestHubVersion) < 0) {
core.info(`Installing Latest Unity Hub Version:\n > ${latestHubVersion}`);
if (process.platform !== 'linux') {
core.info(`Removing previous Unity Hub version:\n > ${hubVersion}`);
await (0, utility_1.RemovePath)(hubPath);
hubPath = await installUnityHub();
}
else {
const scriptPath = __nccwpck_require__.ab + "update-unityhub-linux.sh";
const exitCode = await exec.exec('sh', [__nccwpck_require__.ab + "update-unityhub-linux.sh"]);
if (exitCode !== 0) {
throw new Error(`Failed to install Unity Hub: ${exitCode}`);
}
}
}
}
Expand Down Expand Up @@ -36214,6 +36230,15 @@ async function installUnity(unityVersion, modules) {
return await installUnity4x(unityVersion);
}
core.startGroup(`Installing Unity ${unityVersion.toString()}...`);
if (process.platform === 'linux') {
const installLinuxDepsScript = __nccwpck_require__.ab + "install-linux-dependencies.sh";
const exitCode = await exec.exec('sh', [__nccwpck_require__.ab + "install-linux-dependencies.sh", unityVersion.version], {
ignoreReturnCode: true
});
if (exitCode !== 0) {
throw new Error(`Failed to install additional Linux dependencies for Unity ${unityVersion.toString()}: ${exitCode}`);
}
}
const args = ['install', '--version', unityVersion.version];
if (unityVersion.changeset) {
args.push('--changeset', unityVersion.changeset);
Expand Down Expand Up @@ -36248,7 +36273,9 @@ async function installUnity4x(unityVersion) {
const installPath = path.join(installDir, `Unity ${unityVersion.version}`);
if (!fs.existsSync(installPath)) {
const scriptPath = __nccwpck_require__.ab + "unity-editor-installer.ps1";
const exitCode = await exec.exec('pwsh', [__nccwpck_require__.ab + "unity-editor-installer.ps1", unityVersion.version, installDir]);
const exitCode = await exec.exec('pwsh', [__nccwpck_require__.ab + "unity-editor-installer.ps1", unityVersion.version, installDir], {
ignoreReturnCode: true
});
if (exitCode !== 0) {
throw new Error(`Failed to install Unity ${unityVersion.toString()}: ${exitCode}`);
}
Expand All @@ -36261,8 +36288,9 @@ async function installUnity4x(unityVersion) {
const installPath = path.join(installDir, `Unity ${unityVersion.version}`, 'Unity.app');
if (!fs.existsSync(installPath)) {
const scriptPath = __nccwpck_require__.ab + "unity-editor-installer.sh";
await fs.promises.chmod(__nccwpck_require__.ab + "unity-editor-installer.sh", 0o755);
const exitCode = await exec.exec('sh', [__nccwpck_require__.ab + "unity-editor-installer.sh", unityVersion.version, installDir]);
const exitCode = await exec.exec('sh', [__nccwpck_require__.ab + "unity-editor-installer.sh", unityVersion.version, installDir], {
ignoreReturnCode: true
});
if (exitCode !== 0) {
throw new Error(`Failed to install Unity ${unityVersion.toString()}: ${exitCode}`);
}
Expand Down Expand Up @@ -36441,26 +36469,25 @@ async function getEditorReleaseInfo(unityVersion) {
return results[0];
}
async function fallbackVersionLookup(unityVersion) {
let version = unityVersion.version.split('.')[0];
if (/^\d{1,4}\.0(\.0)?$/.test(unityVersion.version)) {
version = unityVersion.version.split('.')[0];
}
const url = `https://unity.com/releases/editor/whats-new/${version}`;
const url = `https://unity.com/releases/editor/whats-new/${unityVersion.version}`;
core.debug(`Fetching release page: "${url}"`);
let response;
try {
response = await fetch(url);
}
catch (error) {
core.warning(`Failed to fetch changeset for Unity ${unityVersion.toString()} [network error]: ${error}`);
core.warning(`Failed to fetch changeset for Unity ${unityVersion.toString()}: ${error}`);
return unityVersion;
}
const responseText = await response.text();
if (core.isDebug()) {
core.info(responseText);
}
if (!response.ok) {
throw new Error(`Failed to fetch changeset [${response.status}] "${url}"`);
throw new Error(`Failed to fetch changeset for Unity ${unityVersion.toString()} [${response.status}] "${url}"`);
}
const data = await response.text();
core.debug(`Release page content:\n${data}`);
const match = data.match(/unityhub:\/\/(?<version>\d+\.\d+\.\d+[abcfpx]?\d*)\/(?<changeset>[a-zA-Z0-9]+)/);
core.debug(`Release page content: \n${responseText}`);
const match = responseText.match(/unityhub:\/\/(?<version>\d+\.\d+\.\d+[abcfpx]?\d*)\/(?<changeset>[a-zA-Z0-9]+)/);
if (match && match.groups && match.groups.changeset) {
return new unity_version_1.UnityVersion(match.groups.version, match.groups.changeset, unityVersion.architecture);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions dist/install-linux-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
## installs additional dependencies required for Unity on Linux
## usage: install-linux-dependencies.sh <unity-version>
set -e

unityVersion="$1"

if [ -z "$unityVersion" ]; then
echo "Usage: $0 <unity-version>"
exit 1
fi

echo "::group::Installing additional dependencies for Unity $unityVersion..."

# Unity 2019.{1,2}
if [[ "$unityVersion" =~ ^2019\.[12]\. ]]; then
curl -LO https://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.0.0_1.0.2g-1ubuntu4.20_amd64.deb
sudo dpkg -i libssl1.0.0_1.0.2g-1ubuntu4.20_amd64.deb
rm libssl1.0.0_1.0.2g-1ubuntu4.20_amd64.deb
fi

# Unity 2019.{3,4}/2020.*
if [[ "$unityVersion" =~ ^2019\.[34]\. ]] || [[ "$unityVersion" =~ ^2020\. ]]; then
curl -LO https://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb
sudo dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb
rm libssl1.1_1.1.0g-2ubuntu4_amd64.deb
fi

echo "::endgroup::"
Loading
Loading