initial
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string]$Target
|
||||
)
|
||||
|
||||
$config = Get-Content ".\ci\toolchain.json" | ConvertFrom-Json
|
||||
|
||||
if (-not $config.targets.$Target) {
|
||||
throw "Unknown target: $Target"
|
||||
}
|
||||
|
||||
$t = $config.targets.$Target
|
||||
|
||||
$UnityExe = .\ci\Ensure-UnityToolchain.ps1
|
||||
|
||||
Write-Host "Building target: $Target"
|
||||
Write-Host "Method: $($t.method)"
|
||||
Write-Host "Output: $($t.outputPath)"
|
||||
|
||||
& $UnityExe `
|
||||
-batchmode `
|
||||
-nographics `
|
||||
-quit `
|
||||
-projectPath $PWD `
|
||||
-executeMethod $t.method `
|
||||
-logFile -
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Unity build failed: $Target"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
param(
|
||||
[string]$ConfigPath = ".\ci\toolchain.json"
|
||||
)
|
||||
|
||||
$config = Get-Content $ConfigPath | ConvertFrom-Json
|
||||
|
||||
$UnityVersion = $config.unityVersion
|
||||
$UnityExe = Join-Path $config.unityRoot "$UnityVersion\Editor\Unity.exe"
|
||||
|
||||
Write-Host "Checking Unity $UnityVersion..."
|
||||
|
||||
if (!(Test-Path $UnityExe)) {
|
||||
throw "Unity version not installed: $UnityVersion"
|
||||
}
|
||||
|
||||
Write-Host "Unity found: $UnityExe"
|
||||
|
||||
# expose for later steps
|
||||
$env:UNITY_VERSION = $UnityVersion
|
||||
$env:UNITY_EXE = $UnityExe
|
||||
|
||||
return $UnityExe
|
||||
@@ -0,0 +1,192 @@
|
||||
import jetbrains.buildServer.configs.kotlin.*
|
||||
|
||||
version = "2026.1"
|
||||
|
||||
project {
|
||||
|
||||
description = "Unity CI pipeline with multi-target build fan-out"
|
||||
|
||||
// =========================
|
||||
// CORE BUILD (shared logic)
|
||||
// =========================
|
||||
buildType(UnityBuildCore)
|
||||
|
||||
// =========================
|
||||
// TRIGGERED BUILDS (fan-out)
|
||||
// =========================
|
||||
buildType(WindowsBuild)
|
||||
buildType(AndroidBuild)
|
||||
|
||||
// Future-ready (disabled until you enable them)
|
||||
buildType(MacBuild)
|
||||
buildType(IOSBuild)
|
||||
}
|
||||
|
||||
/**
|
||||
* =========================
|
||||
* CORE UNITY BUILD PIPELINE
|
||||
* =========================
|
||||
* This is the ONLY build that actually runs Unity.
|
||||
* Everything else just sets parameters and depends on this.
|
||||
*/
|
||||
object UnityBuildCore : BuildType({
|
||||
|
||||
name = "Unity Build (Core)"
|
||||
|
||||
description = "Runs Unity with a selected target"
|
||||
|
||||
params {
|
||||
|
||||
// Default fallback (should never be used in real triggers)
|
||||
param("unity.target", "")
|
||||
|
||||
// Optional CI metadata
|
||||
param("build.configuration", "Release")
|
||||
}
|
||||
|
||||
vcs {
|
||||
root(DslContext.settingsRoot)
|
||||
}
|
||||
|
||||
steps {
|
||||
|
||||
powerShell {
|
||||
name = "Run Unity Build"
|
||||
scriptMode = file {
|
||||
path = "ci/Build-Unity.ps1"
|
||||
}
|
||||
|
||||
scriptArgs = "-Target %unity.target%"
|
||||
}
|
||||
}
|
||||
|
||||
features {
|
||||
// Ensures build log is captured cleanly
|
||||
feature {
|
||||
type = "xml-report-plugin"
|
||||
}
|
||||
}
|
||||
|
||||
artifactRules = """
|
||||
Builds/** => builds.zip
|
||||
""".trimIndent()
|
||||
})
|
||||
|
||||
/**
|
||||
* =========================
|
||||
* WINDOWS BUILD ENTRYPOINT
|
||||
* =========================
|
||||
* Triggered automatically on VCS changes
|
||||
*/
|
||||
object WindowsBuild : BuildType({
|
||||
|
||||
name = "Unity - Windows"
|
||||
|
||||
description = "Build Windows standalone"
|
||||
|
||||
params {
|
||||
param("unity.target", "Windows")
|
||||
}
|
||||
|
||||
vcs {
|
||||
root(DslContext.settingsRoot)
|
||||
}
|
||||
|
||||
steps {
|
||||
// Snapshot dependency ensures correct ordering
|
||||
}
|
||||
|
||||
dependencies {
|
||||
snapshot(UnityBuildCore) {
|
||||
onDependencyFailure = FailureAction.FAIL_TO_START
|
||||
}
|
||||
}
|
||||
|
||||
artifactRules = """
|
||||
Builds/Windows/** => WindowsBuild.zip
|
||||
""".trimIndent()
|
||||
})
|
||||
|
||||
/**
|
||||
* =========================
|
||||
* ANDROID BUILD ENTRYPOINT
|
||||
* =========================
|
||||
*/
|
||||
object AndroidBuild : BuildType({
|
||||
|
||||
name = "Unity - Android"
|
||||
|
||||
description = "Build Android AAB/APK"
|
||||
|
||||
params {
|
||||
param("unity.target", "Android")
|
||||
}
|
||||
|
||||
vcs {
|
||||
root(DslContext.settingsRoot)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
snapshot(UnityBuildCore) {
|
||||
onDependencyFailure = FailureAction.FAIL_TO_START
|
||||
}
|
||||
}
|
||||
|
||||
artifactRules = """
|
||||
Builds/Android/** => AndroidBuild.zip
|
||||
""".trimIndent()
|
||||
})
|
||||
|
||||
/**
|
||||
* =========================
|
||||
* MAC BUILD (future ready)
|
||||
* =========================
|
||||
* Requires macOS agent + Xcode
|
||||
*/
|
||||
object MacBuild : BuildType({
|
||||
|
||||
name = "Unity - Mac (Disabled)"
|
||||
|
||||
description = "Future macOS build target"
|
||||
|
||||
params {
|
||||
param("unity.target", "Mac")
|
||||
}
|
||||
|
||||
vcs {
|
||||
root(DslContext.settingsRoot)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
snapshot(UnityBuildCore) {}
|
||||
}
|
||||
|
||||
enabled = false
|
||||
})
|
||||
|
||||
/**
|
||||
* =========================
|
||||
* iOS BUILD (future ready)
|
||||
* =========================
|
||||
* Requires macOS agent + Xcode + provisioning profiles
|
||||
*/
|
||||
object IOSBuild : BuildType({
|
||||
|
||||
name = "Unity - iOS (Disabled)"
|
||||
|
||||
description = "Future iOS build target"
|
||||
|
||||
params {
|
||||
param("unity.target", "iOS")
|
||||
}
|
||||
|
||||
vcs {
|
||||
root(DslContext.settingsRoot)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
snapshot(UnityBuildCore) {}
|
||||
}
|
||||
|
||||
enabled = false
|
||||
})
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"unityVersion": "2022.3.62f1",
|
||||
|
||||
"unityRoot": "C:\\Program Files\\Unity\\Hub\\Editor",
|
||||
|
||||
"targets": {
|
||||
"Windows": {
|
||||
"method": "BuildScript.Windows",
|
||||
"outputPath": "Builds/Windows/Game.exe",
|
||||
"buildTarget": "StandaloneWindows64"
|
||||
},
|
||||
|
||||
"Android": {
|
||||
"method": "BuildScript.Android",
|
||||
"outputPath": "Builds/Android/Game.aab",
|
||||
"buildTarget": "Android"
|
||||
},
|
||||
|
||||
"Mac": {
|
||||
"method": "BuildScript.Mac",
|
||||
"outputPath": "Builds/Mac/Game.app",
|
||||
"buildTarget": "StandaloneOSX"
|
||||
},
|
||||
|
||||
"iOS": {
|
||||
"method": "BuildScript.iOS",
|
||||
"outputPath": "Builds/iOS",
|
||||
"buildTarget": "iOS"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user