Skip to content

Commit

Permalink
Windows long path enable in CICD (#3819)
Browse files Browse the repository at this point in the history
* windows long path enabling

* Setting AppModelUnlock

* Git clone path
  • Loading branch information
denis256 authored Jan 30, 2025
1 parent 8ae9167 commit 74e2eee
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions _ci/install-golang.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,31 @@ choco install golang --version 1.23.1 -y
Get-Command go
go version

# Configure long paths
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
try {
# Enable Developer Mode
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
# Enable long paths in Git configuration
Write-Output "Enabling long paths in Git..."
git config --system core.longpaths true
git config --global core.longpaths true
git config --local core.longpaths true

# Enable long paths in Windows Registry
Write-Output "Enabling long paths in Windows Registry..."
$regPath = "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem"
Set-ItemProperty -Path $regPath -Name "LongPathsEnabled" -Value 1 -Type DWord

git config --system core.longpaths true
$longPathsEnabled = Get-ItemProperty -Path $regPath -Name "LongPathsEnabled"
$gitConfig = git config --system --get core.longpaths

if ($longPathsEnabled.LongPathsEnabled -eq 1 -and $gitConfig -eq "true") {
Write-Output "Successfully enabled long paths support"
exit 0
} else {
Write-Error "Failed to verify changes"
exit 1
}
} catch {
Write-Error "An error occurred: $_"
exit 1
}

0 comments on commit 74e2eee

Please sign in to comment.