Skip to content

Commit b564fd3

Browse files
committed
Disable VS telemetry in CI to prevent devenv hang
1 parent 59303f7 commit b564fd3

1 file changed

Lines changed: 36 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ jobs:
1313
release:
1414
runs-on: windows-2025-vs2026 # (260405Ch) net10.0-windows + WinForms setup build needs Visual Studio 18 on GitHub-hosted runners.
1515
timeout-minutes: 30 # 260405Cl 追加: devenv ハング時に無限待ちしないようジョブ全体にタイムアウト設定
16+
env: # 260405Cl 追加: CI で VS テレメトリを無効化し devenv ハングを防止
17+
VSCMD_SKIP_SENDTELEMETRY: "1"
18+
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
1619

1720
steps:
1821
- name: Checkout
@@ -203,30 +206,51 @@ jobs:
203206
204207
- name: Build installer with Visual Studio
205208
id: build_installer
206-
timeout-minutes: 10 # 260405Cl 追加: devenv ハング防止
209+
timeout-minutes: 10
207210
shell: pwsh
208211
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 出現を監視して強制終了する。
210214
$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." }
214216
215217
$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." }
219219
220220
$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+
}
223243
224-
Write-Host "devenv exit code: $buildExitCode"
225244
if (Test-Path $buildLogPath) {
226245
Get-Content $buildLogPath
227246
}
228247
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
230254
"build_log_path=$buildLogPath" >> $env:GITHUB_OUTPUT
231255
232256
- name: Confirm installer outputs

0 commit comments

Comments
 (0)