Skip to content

Instantly share code, notes, and snippets.

@AArnott
Created June 5, 2025 02:13
Show Gist options
  • Save AArnott/a5842bccbbeb346fed6c487cb0ddc9de to your computer and use it in GitHub Desktop.
Save AArnott/a5842bccbbeb346fed6c487cb0ddc9de to your computer and use it in GitHub Desktop.
A powershell script that can be given to git bisect to run a .NET test
# git bisect start --first-parent 5283fb074640b1 23d9058db6921f0f4849cd78d726e6cbb375c46c -- src/Nerdbank.MessagePack
# git bisect run pwsh.exe ./GetSize.ps1
$env:UseSharedCompilation='false' # prevent dotnet.exe from locking up between iterations
Write-Host "Git clean" -ForegroundColor Yellow
git clean -fdX -e obj/tools :/
Write-Host "Running init" -ForegroundColor Yellow
./init.ps1 -InstallLocality repo
if ($LASTEXITCODE -ne 0) { Write-Host "Aborting after exit code $LASTEXITCODE"; exit 125 }
Write-Host "Running publish" -ForegroundColor Yellow
dotnet publish test\AotNativeConsole
if ($LASTEXITCODE -ne 0) { Write-Host "Aborting after exit code $LASTEXITCODE"; exit 125 }
Write-Host "Reporting on size" -ForegroundColor Yellow
$commit = (git rev-parse HEAD).Substring(0, 12)
$size = (gci 'bin/AotNativeConsole/release/net*/win-x64/publish/AotNativeConsole.exe').Length
Write-Host ("Size at $commit is {0:0.0} MB" -f ($size / 1024 / 1024))
if ($size -gt 13*1024*1024) {
exit 1
} else {
exit 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment