| Crates.io | unity-ci |
| lib.rs | unity-ci |
| version | 0.5.1 |
| created_at | 2025-11-05 12:08:12.895424+00 |
| updated_at | 2025-11-09 14:38:41.066322+00 |
| description | CLI Tool for Unity CI Workflows |
| homepage | |
| repository | https://github.com/sator-imaging/unity-ci |
| max_upload_size | |
| id | 1917908 |
| size | 135,415 |
unity-ciunity-ci is a Rust CLI that automates the repeatable pieces of building a
Unity project in continuous integration. It detects which Unity editor version a
project requires, makes sure the matching Unity Hub and editor binaries are
available, optionally activates a license, and finally shells out to the Unity
editor with the arguments you specify.
The tool is intentionally chatty. Every major operation is wrapped in structured logging so CI logs show exactly which checks passed, which resources were downloaded, and how Unity was eventually invoked.
Normalises paths and prints a full command preview with optional prompts.
Scans the Unity log and fails fast when errors are detected.
crates.io (preferred)Install the latest release directly from the public cargo registry:
cargo install unity-ci
When working from a specific revision of this repository, build with the stable Rust toolchain (1.75 or newer is recommended):
cargo install --path .
You can also install straight from git without cloning first:
cargo install --git https://github.com/sator-imaging/unity-ci
The CLI currently exposes a single subcommand, build:
unity-ci build [OPTIONS] --execute <UNITY_METHOD> <PROJECT_PATH>
Options:
-f, --force Skip the confirmation prompt
-t, --target <UNITY_TARGET> Unity build target passed to -buildTarget
-l, --log <LOG_PATH> Destination for Unity's log file (defaults to ./build.log)
-m, --module <MODULES> Comma-separated Unity modules to install alongside the editor
-e, --execute <UNITY_METHOD> Fully-qualified static method invoked via -executeMethod (required)
--no-graphics Include -nographics when invoking Unity
Example:
unity-ci build \
--execute Company.Product.Build.Perform \
--target Win64 \
--module android,android-sdk-ndk-tools \
--log out/unity-build.log \
/path/to/MyUnityProject
What happens when you run the command:
ProjectVersion.txt for the editor version and changeset (m_EditorVersion
and m_EditorVersionWithRevision). Missing revision metadata now causes the
command to fail early so Unity Hub always receives a --changeset value.--module and automatically passing the correct --architecture flag
(x86_64 or arm64).--force is not supplied, prompt for
confirmation.-batchmode, -quit, the project path, optional build
target, requested log file, and the -executeMethod payload. Supply
--no-graphics to append Unity's -nographics switch.--no-graphics choice, even when the Unity command is
cancelled after activation.The default log location is ./build.log relative to the current working
directory. Supplying --log replaces this path and accepts relative or
absolute values.
UNITY_SERIAL, UNITY_USERNAME, UNITY_PASSWORD: When all three are
present and non-empty, the CLI will activate a seat before running the build
and return it afterwards. If any are missing the licensing phase is skipped
and a warning is emitted.
UNITY_HUB_PATH: Absolute path to an existing Unity Hub binary.
UNITY_EDITOR_INSTALL_ROOT: Directory containing Hub-managed installations;
the tool will append the required version & standard subdirectories.
UNITY_CI_CACHE_DIR: Overrides the cache directory used for downloads.
Cache downloads underneath UNITY_CI_CACHE_DIR when set; otherwise the path
falls back to Rustβs std::env::temp_dir().
Windows: Unity Hub commands run through PowerShell using the & call
operator so quoted paths with spaces are forwarded reliably.
macOS: Unity Hub commands run through the current shell (falling back to
/bin/zsh) to match how Hub is typically launched interactively.
Unity Hub's AppImage bundles a Chromium runtime that expects a working user
namespace sandbox. Please note that this tool always appends --no-sandbox
flag when launching Unity Hub on Linux to keep CI runs working out of the box.
Running without the sandbox weakens isolation, so on self-managed runners you should still prefer running Unity as an unprivileged user. If you require the sandbox, fork or wrap the CLI so you can remove the flag and ensure your environment provides working user namespaces before running Unity Hub.
Every significant step prints a [unity-ci] prefixed message. Helper functions
produce explicit [SUCCESS] and [FAILURE] markers, making it easy to scan CI
logs. Sensitive values such as licensing credentials are never echoed; the tool
only reports whether a given variable was found.
This repository uses the standard Rust tooling workflow:
cargo fmt
cargo clippy --all-targets
cargo test
Network access is required when Unity Hub or editor installers need to be
downloaded. Tests currently depend on the surrounding Unity project fixture
under test-unity-project/.
Contributions are welcome! Please open an issue or pull request describing the
change you have in mind. The codebase avoids caching derived string versions of
pathsβprefer using the shared sanitising trait in src/path_ext.rs when adding
new filesystem interactions.