Skip to content

Commit 9a8a6ac

Browse files
unity-cli@v1.1.0 (#15)
- Process cleanup - Replaced `TryKillProcess` with async `KillProcess` that escalates to SIGKILL / `taskkill` after a timeout. - `KillChildProcesses` now collects and awaits child-kill promises instead of fire-and-forget. - Call sites updated to use/await the new APIs where applicable. - Log/tailing & stdout handling - Added `TailLogFile` to tail Unity log files robustly (periodic reads + final flush + EPIPE handling). - `Exec` and spawn wrappers now buffer incomplete lines, flush on close, and write whole lines to stdout. - Helpers added to wait for files to be created/readable and to wait for file unlocks. - Unity Editor & Hub lifecycle - `UnityEditor.Run`: ensures `-automated`/`-batchmode`/`-logFile` args, waits for log file, tails logs while process runs. - Cancellation triggers `KillProcess` + `KillChildProcesses` to ensure cleanup. - `UnityHub` now parses streamed output more safely, triggers `KillProcess` on completion messages. - CLI & GitHub Actions integration - CLI commands call `Logger.instance.setEnvironmentVariable` to persist `UNITY_*` values for subsequent workflow steps. - `Logger` writes to `GITHUB_ENV` / `GITHUB_OUTPUT` when available. - CI/workflow - Workflow split into `setup unity-cli` and `setup unity` steps, added env verification steps. - Misc - Version bump to `1.0.14` and multiple lockfile/devDependency updates. - Added small utilities: `PromptForSecretInput`, `Delay`, `TestFileAccess`. - Several listener cleanup and robustness fixes (removeListener guards, safer regex parsing).
1 parent 7836b16 commit 9a8a6ac

12 files changed

Lines changed: 963 additions & 649 deletions

.github/workflows/build-options.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"2022.3.x",
99
"6000.0.x",
1010
"6000.1.x",
11-
"6000"
11+
"6000.2.x"
1212
],
1313
"include": [
1414
{

.github/workflows/integration-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
push:
44
branches: ['main']
55
pull_request:
6-
branches: ['*']
6+
branches: ['**']
77
types: [opened, reopened, synchronize, ready_for_review]
88
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
99
concurrency:

.github/workflows/unity-build.yml

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,36 +21,73 @@ jobs:
2121
runs-on: ${{ matrix.os }}
2222
permissions:
2323
contents: read
24-
timeout-minutes: 25
24+
timeout-minutes: 30
2525
steps:
2626
- uses: actions/checkout@v4
2727
- uses: actions/setup-node@v4
2828
with:
2929
node-version: 22.x
30-
- name: unity-cli
30+
- name: setup unity-cli
3131
shell: bash
3232
run: |
33-
set -xe
3433
npm ci
3534
npm run build
3635
npm run link
3736
unity-cli --version
37+
- name: setup unity
38+
shell: bash
39+
run: |
3840
unity-cli hub-install --auto-update
3941
unity-cli activate-license --license personal --email "${{ secrets.UNITY_USERNAME }}" --password "${{ secrets.UNITY_PASSWORD }}"
40-
setup_output=$(unity-cli setup-unity --unity-version "${{ matrix.unity-version }}" --build-targets "${{ matrix.build-targets }}" --json)
41-
unity_editor_path=$(echo "$setup_output" | tail -n 1 | jq -r '.UNITY_EDITOR_PATH')
42-
echo "$unity_editor_path"
43-
create_project_output=$(unity-cli create-project --name "Unity Project" --unity-editor "${unity_editor_path}" --json --verbose)
44-
project_path=$(echo "$create_project_output" | tail -n 1 | jq -r '.UNITY_PROJECT_PATH')
45-
echo "${project_path}"
42+
unity-cli setup-unity --unity-version "${{ matrix.unity-version }}" --build-targets "${{ matrix.build-target }}" --json
43+
- name: verify UNITY_HUB_PATH and UNITY_EDITOR_PATH variables
44+
shell: bash
45+
run: |
46+
echo "UNITY_HUB_PATH: ${UNITY_HUB_PATH}"
47+
echo "UNITY_EDITOR_PATH: ${UNITY_EDITOR_PATH}"
48+
echo "UNITY_PROJECT_PATH: ${UNITY_PROJECT_PATH}" # Expected to be empty at this point
49+
50+
if [ -z "${UNITY_HUB_PATH}" ]; then
51+
echo "Error: UNITY_HUB_PATH is not set"
52+
exit 1
53+
fi
54+
55+
if [ -z "${UNITY_EDITOR_PATH}" ]; then
56+
echo "Error: UNITY_EDITOR_PATH is not set"
57+
exit 1
58+
fi
59+
- name: create unity project
60+
shell: bash
61+
run: |
62+
unity-cli create-project --name "Unity Project" --unity-editor "${UNITY_EDITOR_PATH}" --json
63+
- name: verify UNITY_PROJECT_PATH variable
64+
shell: bash
65+
run: |
66+
if [ -z "${UNITY_PROJECT_PATH}" ]; then
67+
echo "Error: UNITY_PROJECT_PATH is not set"
68+
exit 1
69+
fi
70+
- name: Install OpenUPM and build pipeline package
71+
shell: bash
72+
run: |
4673
npm install -g openupm-cli
47-
cd "${project_path}"
74+
cd "${UNITY_PROJECT_PATH}"
4875
openupm add com.utilities.buildpipeline
49-
unity-cli run --unity-editor "${unity_editor_path}" --unity-project "${project_path}" --log-name Validate -quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset
50-
unity-cli run --unity-editor "${unity_editor_path}" --unity-project "${project_path}" --log-name Build -quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild -sceneList Assets/Scenes/SampleScene.unity
76+
- name: Build project
77+
shell: bash
78+
run: |
79+
unity-cli run --unity-editor "${UNITY_EDITOR_PATH}" --unity-project "${UNITY_PROJECT_PATH}" --log-name Validate -quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset
80+
unity-cli run --unity-editor "${UNITY_EDITOR_PATH}" --unity-project "${UNITY_PROJECT_PATH}" --log-name Build -quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild -sceneList Assets/Scenes/SampleScene.unity
5181
- name: Post Run
5282
if: always()
5383
shell: bash
5484
run: |
55-
set -xe
5685
unity-cli return-license --license personal
86+
- name: upload logs
87+
if: always()
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: ${{ github.run_id }}.${{ github.run_attempt }} ${{ matrix.unity-version }} ${{ matrix.build-target }} logs
91+
retention-days: 1
92+
path: |
93+
${{ github.workspace }}/**/*.log

0 commit comments

Comments
 (0)