Skip to content
This repository was archived by the owner on Aug 11, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
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
4 changes: 2 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ jobs:

steps:
- name: checkout self
uses: actions/checkout@v3
uses: actions/checkout@v4

- run: npm install

- name: checkout test project
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: xrtk/com.xrtk.test
path: test-project
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:
build-targets: 'StandaloneOSX Android iOS'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- id: unity-setup
uses: xrtk/unity-setup@v7.2
uses: xrtk/unity-setup@v7.3
with:
build-targets: ${{ matrix.build-targets }} #Optional, overrides the default platform specific module installs.
#version-file-path: 'ProjectSettings/ProjectVersion.txt' # Optional
Expand Down
32 changes: 31 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4127,6 +4127,7 @@ const os = __nccwpck_require__(37);
const main = async () => {
try {
var modules = '';
var architecture = '';
var buildTargets = core.getInput('build-targets');
core.debug(`buildTargets: ${buildTargets}`);

Expand All @@ -4153,6 +4154,9 @@ const main = async () => {
"StandaloneLinux64": "linux-il2cpp",
"WebGL": "webgl",
};

architecture = await getArchitecture();
core.debug(`architecture: ${architecture}`);
} else if (osType == 'Windows_NT') {
moduleMap = {
"StandaloneWindows64": "windows-il2cpp",
Expand Down Expand Up @@ -4201,7 +4205,7 @@ const main = async () => {
core.debug(`modules: ${modules}`);
core.debug(`versionFilePath: ${versionFilePath}`);

var args = `-modulesList \"${modules}\" -versionFilePath \"${versionFilePath}\"`;
var args = `-modulesList \"${modules}\" -versionFilePath \"${versionFilePath}\" -architecture \"${architecture}\"`;
var pwsh = await io.which("pwsh", true);
var install = __nccwpck_require__.ab + "unity-install.ps1";
var exitCode = 0;
Expand Down Expand Up @@ -4247,6 +4251,32 @@ const findFile = async (dir, filePath) => {
return matchedFiles;
};

const getArchitecture = () => {
return new Promise((resolve, reject) => {
try {
const options = {
listeners: {
stdout: (data) => {
const trimmedOutput = data.toString().trim();
core.debug(`getArchitecture::stdout: ${trimmedOutput}`);

if (trimmedOutput.toLowerCase().includes('x86_64')) {
resolve('x86_64');
} else if (trimmedOutput.toLowerCase().includes('arm64')) {
resolve('arm64');
} else {
reject(Error(`Unknown architecture: Unable to determine architecture: ${trimmedOutput}`));
}
},
},
};

exec.exec('uname -m', [], options);
} catch (error) {
reject(Error(`Failed to determine architecture: ${error.message}`));
}
});
};

// Call the main function to run the action
main();
Expand Down
12 changes: 11 additions & 1 deletion dist/unity-install.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
param(
[String]$versionFilePath,
[String]$modulesList
[String]$modulesList,
[String]$architecture
)
# Unity Editor Installation
$modules = $modulesList.Split(" ")
Expand Down Expand Up @@ -145,12 +146,21 @@ Write-Host "::group::Unity Hub Options"
Invoke-UnityHub help
Write-Host "::endgroup::"

# only show errors if github actions debug is enabled
#if ($env:GITHUB_ACTIONS -eq "true") {
Invoke-UnityHub --errors
#}

$editorPath = "{0}{1}{2}" -f $editorRootPath,$unityVersion,$editorFileEx

if ( -not (Test-Path -Path $editorPath)) {
Write-Host "Installing $unityVersion ($unityVersionChangeSet)"
$installArgs = @('install',"--version $unityVersion","--changeset $unityVersionChangeSet",'--cm')

if (-not [string]::IsNullOrEmpty($architecture)) {
$installArgs += "-a $architecture"
}

$addModules = @()

foreach ($module in $modules) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unity-setup",
"version": "7.2.0",
"version": "7.3.0",
"description": "An atomic GitHub action to download and install the Unity Editor for runners.",
"main": "src/index.js",
"scripts": {
Expand Down
32 changes: 31 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const os = require('os');
const main = async () => {
try {
var modules = '';
var architecture = '';
var buildTargets = core.getInput('build-targets');
core.debug(`buildTargets: ${buildTargets}`);

Expand All @@ -35,6 +36,9 @@ const main = async () => {
"StandaloneLinux64": "linux-il2cpp",
"WebGL": "webgl",
};

architecture = await getArchitecture();
core.debug(`architecture: ${architecture}`);
} else if (osType == 'Windows_NT') {
moduleMap = {
"StandaloneWindows64": "windows-il2cpp",
Expand Down Expand Up @@ -83,7 +87,7 @@ const main = async () => {
core.debug(`modules: ${modules}`);
core.debug(`versionFilePath: ${versionFilePath}`);

var args = `-modulesList \"${modules}\" -versionFilePath \"${versionFilePath}\"`;
var args = `-modulesList \"${modules}\" -versionFilePath \"${versionFilePath}\" -architecture \"${architecture}\"`;
var pwsh = await io.which("pwsh", true);
var install = path.resolve(__dirname, 'unity-install.ps1');
var exitCode = 0;
Expand Down Expand Up @@ -129,6 +133,32 @@ const findFile = async (dir, filePath) => {
return matchedFiles;
};

const getArchitecture = () => {
return new Promise((resolve, reject) => {
try {
const options = {
listeners: {
stdout: (data) => {
const trimmedOutput = data.toString().trim();
core.debug(`getArchitecture::stdout: ${trimmedOutput}`);

if (trimmedOutput.toLowerCase().includes('x86_64')) {
resolve('x86_64');
} else if (trimmedOutput.toLowerCase().includes('arm64')) {
resolve('arm64');
} else {
reject(Error(`Unknown architecture: Unable to determine architecture: ${trimmedOutput}`));
}
},
},
};

exec.exec('uname -m', [], options);
} catch (error) {
reject(Error(`Failed to determine architecture: ${error.message}`));
}
});
};

// Call the main function to run the action
main();
12 changes: 11 additions & 1 deletion src/unity-install.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
param(
[String]$versionFilePath,
[String]$modulesList
[String]$modulesList,
[String]$architecture
)
# Unity Editor Installation
$modules = $modulesList.Split(" ")
Expand Down Expand Up @@ -145,12 +146,21 @@ Write-Host "::group::Unity Hub Options"
Invoke-UnityHub help
Write-Host "::endgroup::"

# only show errors if github actions debug is enabled
#if ($env:GITHUB_ACTIONS -eq "true") {
Invoke-UnityHub --errors
#}

$editorPath = "{0}{1}{2}" -f $editorRootPath,$unityVersion,$editorFileEx

if ( -not (Test-Path -Path $editorPath)) {
Write-Host "Installing $unityVersion ($unityVersionChangeSet)"
$installArgs = @('install',"--version $unityVersion","--changeset $unityVersionChangeSet",'--cm')

if (-not [string]::IsNullOrEmpty($architecture)) {
$installArgs += "-a $architecture"
}

$addModules = @()

foreach ($module in $modules) {
Expand Down