Skip to content

Commit 0936cb3

Browse files
committed
Stabilize release workflow
1 parent 8abecac commit 0936cb3

1 file changed

Lines changed: 102 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 102 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,111 @@ jobs:
100100
Write-Host "Set DisableOutOfProcBuild=1 at $msbuildKey"
101101
}
102102
103+
- name: Build native runtime binaries
104+
shell: pwsh
105+
run: |
106+
# (260405Ch) Build Crystallography.Native separately because the main solution build does not include it in Release|x64.
107+
$devenvExe = (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -property productPath).Trim()
108+
if (-not $devenvExe) {
109+
throw "Visual Studio was not found."
110+
}
111+
112+
$devenvCli = [System.IO.Path]::ChangeExtension($devenvExe, ".com")
113+
if (-not (Test-Path $devenvCli)) {
114+
throw "devenv.com was not found next to $devenvExe."
115+
}
116+
117+
$buildLogPath = Join-Path $env:RUNNER_TEMP "devenv-native-build.log"
118+
& $devenvCli "ReciPro.sln" /Build "Release|x64" /Project "Crystallography.Native" /Out $buildLogPath
119+
$buildExitCode = $LASTEXITCODE
120+
121+
if (Test-Path $buildLogPath) {
122+
Get-Content $buildLogPath
123+
}
124+
125+
if ($buildExitCode -ne 0) {
126+
throw "Crystallography.Native build failed with exit code $buildExitCode."
127+
}
128+
129+
- name: Build managed application
130+
shell: pwsh
131+
run: |
132+
# (260405Ch) Build managed projects with dotnet to avoid devenv-triggered file locking inside obj during CI.
133+
dotnet build ReciPro\ReciPro.csproj -c Release -p:Platform=x64 --no-restore
134+
135+
- name: Confirm packaging inputs
136+
shell: pwsh
137+
run: |
138+
# (260405Ch) Validate that setup packaging prerequisites exist before running the setup project.
139+
$requiredOutputs = @(
140+
"ReciPro\bin\Release\ReciPro.exe",
141+
"ReciPro\bin\Release\Crystallography.Native.dll",
142+
"ReciPro\bin\Release\Crystallography.Native.avx2.dll",
143+
"ReciPro\bin\Release\Crystallography.Native.avx512.dll"
144+
)
145+
146+
$missingOutputs = $requiredOutputs | Where-Object { -not (Test-Path $_) }
147+
if ($missingOutputs.Count -gt 0) {
148+
throw "Setup packaging inputs are missing: $($missingOutputs -join ', ')"
149+
}
150+
151+
- name: Create installer-only solution
152+
id: pack_solution
153+
shell: pwsh
154+
run: |
155+
# (260405Ch) Generate a temporary solution that keeps project output metadata for vdproj while skipping managed rebuilds.
156+
$solutionPath = Join-Path (Get-Location) "ReciProSetup.CI.sln"
157+
@'
158+
Microsoft Visual Studio Solution File, Format Version 12.00
159+
# Visual Studio Version 18
160+
VisualStudioVersion = 18.0.11205.157
161+
MinimumVisualStudioVersion = 10.0.40219.1
162+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReciPro", "ReciPro\ReciPro.csproj", "{D01883A1-458D-4127-8E9B-EEC176201483}"
163+
EndProject
164+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Crystallography", "Crystallography\Crystallography.csproj", "{3AABEFB0-E84E-4AF6-8496-4D1F33C8F517}"
165+
EndProject
166+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Crystallography.Controls", "Crystallography.Controls\Crystallography.Controls.csproj", "{FD96FE43-6DEE-4520-BB26-CFF7976DE27D}"
167+
EndProject
168+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Crystallography.OpenGL", "Crystallography.OpenGL\Crystallography.OpenGL.csproj", "{BE7CC301-70E0-4BAA-9349-FDA49B38CC93}"
169+
EndProject
170+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Crystallography.Native", "Crystallography.Native\Crystallography.Native.vcxproj", "{0A6070E5-8843-4C4B-A4ED-4ABC55BFDBDD}"
171+
EndProject
172+
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "ReciProSetup", "ReciProSetup\ReciProSetup.vdproj", "{8083E96B-786B-4351-87EF-8546C9C8B297}"
173+
EndProject
174+
Global
175+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
176+
Debug|x64 = Debug|x64
177+
Release|x64 = Release|x64
178+
EndGlobalSection
179+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
180+
{D01883A1-458D-4127-8E9B-EEC176201483}.Debug|x64.ActiveCfg = Debug|x64
181+
{D01883A1-458D-4127-8E9B-EEC176201483}.Release|x64.ActiveCfg = Release|x64
182+
{3AABEFB0-E84E-4AF6-8496-4D1F33C8F517}.Debug|x64.ActiveCfg = Debug|x64
183+
{3AABEFB0-E84E-4AF6-8496-4D1F33C8F517}.Release|x64.ActiveCfg = Release|x64
184+
{FD96FE43-6DEE-4520-BB26-CFF7976DE27D}.Debug|x64.ActiveCfg = Debug|x64
185+
{FD96FE43-6DEE-4520-BB26-CFF7976DE27D}.Release|x64.ActiveCfg = Release|x64
186+
{BE7CC301-70E0-4BAA-9349-FDA49B38CC93}.Debug|x64.ActiveCfg = Debug|x64
187+
{BE7CC301-70E0-4BAA-9349-FDA49B38CC93}.Release|x64.ActiveCfg = Release|x64
188+
{0A6070E5-8843-4C4B-A4ED-4ABC55BFDBDD}.Debug|x64.ActiveCfg = Debug|x64
189+
{0A6070E5-8843-4C4B-A4ED-4ABC55BFDBDD}.Release|x64.ActiveCfg = Release|x64
190+
{8083E96B-786B-4351-87EF-8546C9C8B297}.Debug|x64.ActiveCfg = Debug
191+
{8083E96B-786B-4351-87EF-8546C9C8B297}.Debug|x64.Build.0 = Debug
192+
{8083E96B-786B-4351-87EF-8546C9C8B297}.Release|x64.ActiveCfg = Release
193+
{8083E96B-786B-4351-87EF-8546C9C8B297}.Release|x64.Build.0 = Release
194+
EndGlobalSection
195+
GlobalSection(SolutionProperties) = preSolution
196+
HideSolutionNode = FALSE
197+
EndGlobalSection
198+
EndGlobal
199+
'@ | Set-Content -Path $solutionPath -Encoding ASCII
200+
201+
"solution_path=$solutionPath" >> $env:GITHUB_OUTPUT
202+
103203
- name: Build installer with Visual Studio
104204
id: build_installer
105205
shell: pwsh
106206
run: |
107-
# (260405Ch) Use devenv.com for command-line builds so the workflow waits for vdproj build completion and captures logs.
207+
# (260405Ch) Build vdproj from a packaging-only solution so setup can resolve project outputs without rebuilding managed projects.
108208
$devenvExe = (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -property productPath).Trim()
109209
if (-not $devenvExe) {
110210
throw "Visual Studio was not found."
@@ -116,7 +216,7 @@ jobs:
116216
}
117217
118218
$buildLogPath = Join-Path $env:RUNNER_TEMP "devenv-build.log"
119-
& $devenvCli "ReciPro.sln" /Build "Release|x64" /Project "ReciProSetup" /Out $buildLogPath
219+
& $devenvCli "${{ steps.pack_solution.outputs.solution_path }}" /Build "Release|x64" /Project "ReciProSetup" /Out $buildLogPath
120220
$buildExitCode = $LASTEXITCODE
121221
122222
Write-Host "devenv exit code: $buildExitCode"

0 commit comments

Comments
 (0)