diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 41738a5..cd82185 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,8 +9,6 @@ on: jobs: build: - # Guard: if this ever gets merged upstream elsewhere, - # it will be "skipped" there and won't break their CI. if: github.repository_owner == 'SAM-BIM' runs-on: windows-2022 @@ -21,7 +19,6 @@ jobs: NUGET_XMLDOC_MODE: "skip" steps: - # Checkout THIS repo into its own folder - name: Checkout SAM_Revit_UI uses: actions/checkout@v4 with: @@ -47,7 +44,6 @@ jobs: $ErrorActionPreference = 'Stop' $org = '${{ env.ORG_NAME }}' - $repo = '${{ env.REPO_NAME }}' $token = '${{ secrets.ORG_REPO_TOKEN }}' function Clone-Repo([string]$name) { @@ -57,10 +53,6 @@ jobs: git clone --depth 1 $url $name } - # Practical CI order: - # - build modules first - # - build SAM_UI before Revit bits - # - then build Revit 2025 + 2026 configs $deps = @( 'SAM' 'SAM_Systems' @@ -73,12 +65,12 @@ jobs: 'SAM_gbXML' 'SAM_GEM' 'SAM_LadybugTools' - 'SAM_Solver' # private -> token needed + 'SAM_Solver' 'SAM_SolarCalculator' 'SAM_Tas' 'SAM_Excel' 'SAM_SQLite' - 'SAM_OpenStudio' # x64 + 'SAM_OpenStudio' 'SAM_Multitasker' 'SAM_UI' 'SAM_Revit' @@ -86,11 +78,11 @@ jobs: foreach ($r in $deps) { Clone-Repo $r } - # Ensure build folders exist (some projects expect these paths) New-Item -ItemType Directory -Force -Path "SAM_Windows\build" | Out-Null New-Item -ItemType Directory -Force -Path "SAM_UI\build" | Out-Null + New-Item -ItemType Directory -Force -Path "_ci_artifacts" | Out-Null - - name: Restore + Rebuild (ordered) + Revit 2025/2026 + - name: Restore + Rebuild base dependencies (ordered) shell: powershell run: | $ErrorActionPreference = 'Stop' @@ -110,7 +102,6 @@ jobs: throw "No .sln found under: $repoName" } - # Build order up to SAM_UI $orderedRepos = @( 'SAM' 'SAM_Systems' @@ -133,20 +124,10 @@ jobs: 'SAM_UI' ) - # Revit configs (build both configs for SAM_Revit + SAM_Revit_UI) - $revitItems = @( - @{ Repo='SAM_Revit'; Configuration='Release2025'; Platform='Any CPU' }, - @{ Repo='SAM_Revit_UI'; Configuration='Release2025'; Platform='Any CPU' }, - @{ Repo='SAM_Revit'; Configuration='Release2026'; Platform='Any CPU' }, - @{ Repo='SAM_Revit_UI'; Configuration='Release2026'; Platform='Any CPU' } - ) - - # Platform overrides for specific solutions that actually have x64 configs $platformOverride = @{ 'SAM_OpenStudio' = 'x64' } - # ReferencePath: keep it simple and consistent $winBuild = (Resolve-Path 'SAM_Windows\build').Path $uiBuild = (Resolve-Path 'SAM_UI\build').Path $env:ReferencePath = "$winBuild;$uiBuild" @@ -160,45 +141,158 @@ jobs: '/p:RunPostBuildEvent=OnOutputUpdated' ) - function Msbuild-ConfigPlatform([string]$cfg, [string]$plat) { - $args = @("/p:Configuration=$cfg") - if ($plat) { $args += "/p:Platform=$plat" } # no quotes - return $args - } - function Restore-Build([string]$repoName, [string]$cfg, [string]$plat) { $sln = Find-Solution $repoName Write-Host "" Write-Host "=== $repoName ===" Write-Host "Solution: $sln" - $cfgArgs = Msbuild-ConfigPlatform $cfg $plat + $cfgArgs = @("/p:Configuration=$cfg") + if ($plat) { $cfgArgs += "/p:Platform=$plat" } - Write-Host "-> msbuild restore ($cfg | $plat)" & msbuild $sln /t:Restore @msbuildBase @cfgArgs if ($LASTEXITCODE -ne 0) { throw "MSBuild restore failed: $repoName ($cfg | $plat)" } - Write-Host "-> msbuild rebuild ($cfg | $plat)" & msbuild $sln /t:Rebuild @msbuildBase @cfgArgs if ($LASTEXITCODE -ne 0) { throw "MSBuild rebuild failed: $repoName ($cfg | $plat)" } } - # Build non-Revit repos (Release) foreach ($r in $orderedRepos) { $plat = 'Any CPU' if ($platformOverride.ContainsKey($r)) { $plat = $platformOverride[$r] } Restore-Build $r 'Release' $plat } - # Build Revit (Release2025/Release2026) - foreach ($it in $revitItems) { - Restore-Build $it.Repo $it.Configuration $it.Platform + - name: Build Revit 2025 and snapshot outputs + shell: powershell + run: | + $ErrorActionPreference = 'Stop' + + function Find-Solution([string]$repoName) { + $expected = Join-Path $repoName "$repoName.sln" + if (Test-Path $expected) { return (Resolve-Path $expected).Path } + + $rootSln = Get-ChildItem -Path $repoName -Filter *.sln -File -ErrorAction SilentlyContinue | Select-Object -First 1 + if ($rootSln) { return $rootSln.FullName } + + $anySln = Get-ChildItem -Path $repoName -Recurse -Filter *.sln -File -ErrorAction SilentlyContinue | + Where-Object { $_.FullName -notmatch '\\(bin|obj|packages)\\' } | + Select-Object -First 1 + if ($anySln) { return $anySln.FullName } + + throw "No .sln found under: $repoName" + } + + function Restore-Build([string]$repoName, [string]$cfg) { + $sln = Find-Solution $repoName + $args = @( + '/m:1' + '/nr:false' + '/v:m' + '/p:UseSharedCompilation=false' + '/p:RunPostBuildEvent=OnOutputUpdated' + "/p:Configuration=$cfg" + '/p:Platform=Any CPU' + ) + + & msbuild $sln /t:Restore @args + if ($LASTEXITCODE -ne 0) { throw "MSBuild restore failed: $repoName ($cfg)" } + + & msbuild $sln /t:Rebuild @args + if ($LASTEXITCODE -ne 0) { throw "MSBuild rebuild failed: $repoName ($cfg)" } + } + + Restore-Build 'SAM_Revit' 'Release2025' + Restore-Build 'SAM_Revit_UI' 'Release2025' + + function Copy-FolderContents([string]$src, [string]$dst) { + if (-not (Test-Path $src)) { + throw "Source folder not found: $src" + } + New-Item -ItemType Directory -Force -Path $dst | Out-Null + Copy-Item (Join-Path $src '*') $dst -Recurse -Force + } + + $out = "_ci_artifacts\Revit 2025" + New-Item -ItemType Directory -Force -Path $out | Out-Null + Copy-FolderContents "SAM_Revit\build" (Join-Path $out "SAM_Revit") + Copy-FolderContents "SAM_Revit_UI\build" (Join-Path $out "SAM_Revit_UI") + + if (-not (Test-Path (Join-Path $out "SAM_Revit_UI\SAM.Revit.UI.dll"))) { + throw "Revit 2025 snapshot is missing SAM.Revit.UI.dll" + } + + - name: Clean Revit build folders before 2026 + shell: powershell + run: | + $ErrorActionPreference = 'Stop' + foreach ($p in @('SAM_Revit\build','SAM_Revit_UI\build')) { + if (Test-Path $p) { Remove-Item $p -Recurse -Force } + New-Item -ItemType Directory -Force -Path $p | Out-Null + } + + - name: Build Revit 2026 and snapshot outputs + shell: powershell + run: | + $ErrorActionPreference = 'Stop' + + function Find-Solution([string]$repoName) { + $expected = Join-Path $repoName "$repoName.sln" + if (Test-Path $expected) { return (Resolve-Path $expected).Path } + + $rootSln = Get-ChildItem -Path $repoName -Filter *.sln -File -ErrorAction SilentlyContinue | Select-Object -First 1 + if ($rootSln) { return $rootSln.FullName } + + $anySln = Get-ChildItem -Path $repoName -Recurse -Filter *.sln -File -ErrorAction SilentlyContinue | + Where-Object { $_.FullName -notmatch '\\(bin|obj|packages)\\' } | + Select-Object -First 1 + if ($anySln) { return $anySln.FullName } + + throw "No .sln found under: $repoName" + } + + function Restore-Build([string]$repoName, [string]$cfg) { + $sln = Find-Solution $repoName + $args = @( + '/m:1' + '/nr:false' + '/v:m' + '/p:UseSharedCompilation=false' + '/p:RunPostBuildEvent=OnOutputUpdated' + "/p:Configuration=$cfg" + '/p:Platform=Any CPU' + ) + + & msbuild $sln /t:Restore @args + if ($LASTEXITCODE -ne 0) { throw "MSBuild restore failed: $repoName ($cfg)" } + + & msbuild $sln /t:Rebuild @args + if ($LASTEXITCODE -ne 0) { throw "MSBuild rebuild failed: $repoName ($cfg)" } + } + + Restore-Build 'SAM_Revit' 'Release2026' + Restore-Build 'SAM_Revit_UI' 'Release2026' + + function Copy-FolderContents([string]$src, [string]$dst) { + if (-not (Test-Path $src)) { + throw "Source folder not found: $src" + } + New-Item -ItemType Directory -Force -Path $dst | Out-Null + Copy-Item (Join-Path $src '*') $dst -Recurse -Force + } + + $out = "_ci_artifacts\Revit 2026" + New-Item -ItemType Directory -Force -Path $out | Out-Null + Copy-FolderContents "SAM_Revit\build" (Join-Path $out "SAM_Revit") + Copy-FolderContents "SAM_Revit_UI\build" (Join-Path $out "SAM_Revit_UI") + + if (-not (Test-Path (Join-Path $out "SAM_Revit_UI\SAM.Revit.UI.dll"))) { + throw "Revit 2026 snapshot is missing SAM.Revit.UI.dll" } - - name: Upload build folders (optional) + - name: Upload isolated Revit build outputs uses: actions/upload-artifact@v4 with: name: SAM_Revit_UI-build-folders - path: | - **\build\* - if-no-files-found: warn \ No newline at end of file + path: _ci_artifacts/**/* + if-no-files-found: error diff --git a/SAM_Revit_UI/SAM.Analytical.Revit.UI/IExternalCommands/Simulate.cs b/SAM_Revit_UI/SAM.Analytical.Revit.UI/IExternalCommands/Simulate.cs index b7f2cc9..8543ee6 100644 --- a/SAM_Revit_UI/SAM.Analytical.Revit.UI/IExternalCommands/Simulate.cs +++ b/SAM_Revit_UI/SAM.Analytical.Revit.UI/IExternalCommands/Simulate.cs @@ -227,7 +227,7 @@ public override Result Execute(ExternalCommandData commandData, ref string messa SimulateTo = 1 }; - analyticalModel = Tas.Modify.RunWorkflow(analyticalModel, workflowSettings); + analyticalModel = Analytical.UI.WPF.Modify.RunWorkflow(analyticalModel, workflowSettings); List results = null; diff --git a/SAM_Revit_UI/SAM.Analytical.Revit.UI/SAM.Analytical.Revit.UI.csproj b/SAM_Revit_UI/SAM.Analytical.Revit.UI/SAM.Analytical.Revit.UI.csproj index bce0670..353b5f0 100644 --- a/SAM_Revit_UI/SAM.Analytical.Revit.UI/SAM.Analytical.Revit.UI.csproj +++ b/SAM_Revit_UI/SAM.Analytical.Revit.UI/SAM.Analytical.Revit.UI.csproj @@ -92,6 +92,9 @@ ..\..\..\SAM_UI\build\SAM.Analytical.UI.dll + + ..\..\..\SAM_UI\build\SAM.Analytical.UI.WPF.dll + ..\..\..\SAM_Windows\build\SAM.Analytical.Windows.dll