|
13 | 13 | release: |
14 | 14 | runs-on: windows-2025-vs2026 # (260405Ch) net10.0-windows + WinForms setup build needs Visual Studio 18 on GitHub-hosted runners. |
15 | 15 | timeout-minutes: 30 # 260405Cl 追加: devenv ハング時に無限待ちしないようジョブ全体にタイムアウト設定 |
| 16 | + env: # 260405Cl 追加: CI で VS テレメトリを無効化し devenv ハングを防止 |
| 17 | + VSCMD_SKIP_SENDTELEMETRY: "1" |
| 18 | + DOTNET_CLI_TELEMETRY_OPTOUT: "1" |
16 | 19 |
|
17 | 20 | steps: |
18 | 21 | - name: Checkout |
@@ -203,30 +206,51 @@ jobs: |
203 | 206 |
|
204 | 207 | - name: Build installer with Visual Studio |
205 | 208 | id: build_installer |
206 | | - timeout-minutes: 10 # 260405Cl 追加: devenv ハング防止 |
| 209 | + timeout-minutes: 10 |
207 | 210 | shell: pwsh |
208 | 211 | run: | |
209 | | - # (260405Ch) Build vdproj from a packaging-only solution so setup can resolve project outputs without rebuilding managed projects. |
| 212 | + # 260405Cl devenv.com はテレメトリ(Chrome/GCM)が終了せずハングするため、 |
| 213 | + # バックグラウンドで起動し MSI 出現を監視して強制終了する。 |
210 | 214 | $devenvExe = (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -property productPath).Trim() |
211 | | - if (-not $devenvExe) { |
212 | | - throw "Visual Studio was not found." |
213 | | - } |
| 215 | + if (-not $devenvExe) { throw "Visual Studio was not found." } |
214 | 216 |
|
215 | 217 | $devenvCli = [System.IO.Path]::ChangeExtension($devenvExe, ".com") |
216 | | - if (-not (Test-Path $devenvCli)) { |
217 | | - throw "devenv.com was not found next to $devenvExe." |
218 | | - } |
| 218 | + if (-not (Test-Path $devenvCli)) { throw "devenv.com was not found next to $devenvExe." } |
219 | 219 |
|
220 | 220 | $buildLogPath = Join-Path $env:RUNNER_TEMP "devenv-build.log" |
221 | | - & $devenvCli "${{ steps.pack_solution.outputs.solution_path }}" /Build "Release|x64" /Project "ReciProSetup" /Out $buildLogPath |
222 | | - $buildExitCode = $LASTEXITCODE |
| 221 | + $msiPath = "ReciProSetup\Release\ReciProSetup.msi" |
| 222 | +
|
| 223 | + # devenv をバックグラウンド起動 |
| 224 | + $proc = Start-Process -FilePath $devenvCli -ArgumentList "`"${{ steps.pack_solution.outputs.solution_path }}`" /Build `"Release|x64`" /Project `"ReciProSetup`" /Out `"$buildLogPath`"" -PassThru -NoNewWindow |
| 225 | +
|
| 226 | + # MSI が生成されるか、devenv が自力で終了するまで待機 (最大5分) |
| 227 | + $deadline = (Get-Date).AddMinutes(5) |
| 228 | + while (-not $proc.HasExited -and (Get-Date) -lt $deadline) { |
| 229 | + if (Test-Path $msiPath) { |
| 230 | + Write-Host "MSI detected, waiting 10s for post-build events..." |
| 231 | + Start-Sleep -Seconds 10 |
| 232 | + break |
| 233 | + } |
| 234 | + Start-Sleep -Seconds 2 |
| 235 | + } |
| 236 | +
|
| 237 | + # devenv がまだ生きていたら強制終了 |
| 238 | + if (-not $proc.HasExited) { |
| 239 | + Write-Host "Stopping devenv (pid $($proc.Id)) to avoid telemetry hang..." |
| 240 | + Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue |
| 241 | + Start-Sleep -Seconds 2 |
| 242 | + } |
223 | 243 |
|
224 | | - Write-Host "devenv exit code: $buildExitCode" |
225 | 244 | if (Test-Path $buildLogPath) { |
226 | 245 | Get-Content $buildLogPath |
227 | 246 | } |
228 | 247 |
|
229 | | - "build_exit_code=$buildExitCode" >> $env:GITHUB_OUTPUT |
| 248 | + if (-not (Test-Path $msiPath)) { |
| 249 | + throw "MSI was not produced within the time limit." |
| 250 | + } |
| 251 | + Write-Host "MSI built successfully: $msiPath" |
| 252 | +
|
| 253 | + "build_exit_code=0" >> $env:GITHUB_OUTPUT |
230 | 254 | "build_log_path=$buildLogPath" >> $env:GITHUB_OUTPUT |
231 | 255 |
|
232 | 256 | - name: Confirm installer outputs |
|
0 commit comments