Skip to content

(do not merge) experiment custom mimalloc #404

(do not merge) experiment custom mimalloc

(do not merge) experiment custom mimalloc #404

name: Cross-Platform Tests
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: cross-platform-tests-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
windows-tests:
name: Windows Tests (aarch64-windows)
runs-on: windows-11-arm
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- name: Show Git version
shell: pwsh
run: git --version
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Install ProcDump for Windows ARM test crashes
shell: pwsh
run: |
$dumpDir = 'C:\CrashDumps'
$procDumpDir = Join-Path $env:RUNNER_TEMP 'procdump'
$procDumpArchive = Join-Path $env:RUNNER_TEMP 'Procdump.zip'
$procDumpExe = Join-Path $procDumpDir 'procdump64a.exe'
New-Item -ItemType Directory -Force $dumpDir | Out-Null
New-Item -ItemType Directory -Force $procDumpDir | Out-Null
Invoke-WebRequest 'https://download.sysinternals.com/files/Procdump.zip' -OutFile $procDumpArchive -UseBasicParsing
Expand-Archive -Path $procDumpArchive -DestinationPath $procDumpDir -Force
if (-not (Test-Path $procDumpExe)) {
throw "ProcDump ARM64 binary not found at $procDumpExe"
}
"CRASH_DUMP_DIR=$dumpDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"PROCDUMP_EXE=$procDumpExe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Run workspace tests except gitcomet harness
shell: pwsh
run: |
cargo test --workspace `
--exclude gitcomet `
--exclude gitcomet-ui `
--exclude gitcomet-ui-gpui `
--no-default-features `
--locked `
--verbose
- name: Build gitcomet test harness
shell: pwsh
run: |
cargo test -p gitcomet `
--bin gitcomet `
--no-run `
--no-default-features `
--features gix `
--locked `
--verbose
- name: Capture gitcomet test harness crash dump with ProcDump
shell: pwsh
run: |
$dumpDir = $env:CRASH_DUMP_DIR
$procDumpExe = $env:PROCDUMP_EXE
$procDumpStdoutLog = Join-Path $dumpDir 'procdump.stdout.log'
$procDumpStderrLog = Join-Path $dumpDir 'procdump.stderr.log'
$harness = Get-ChildItem -Path 'target\debug\deps' -Filter 'gitcomet-*.exe' |
Sort-Object LastWriteTime -Descending |
Select-Object -First 1
if (-not $harness) {
throw 'gitcomet test harness executable was not found under target\debug\deps.'
}
Get-ChildItem -Path $dumpDir -Filter *.dmp -ErrorAction SilentlyContinue |
Remove-Item -Force -ErrorAction SilentlyContinue
Remove-Item $procDumpStdoutLog, $procDumpStderrLog -Force -ErrorAction SilentlyContinue
Write-Host "Running $($harness.Name) directly under ProcDump."
$procDumpArgs = @(
'-accepteula'
'-ma'
'-e'
'-n'
'1'
'-x'
$dumpDir
$harness.FullName
'--nocapture'
)
$procDump = Start-Process -FilePath $procDumpExe `
-ArgumentList $procDumpArgs `
-PassThru `
-WindowStyle Hidden `
-Wait `
-RedirectStandardOutput $procDumpStdoutLog `
-RedirectStandardError $procDumpStderrLog
Write-Host "ProcDump exited with code $($procDump.ExitCode)"
$dumps = @(Get-ChildItem -Path $dumpDir -Filter *.dmp -ErrorAction SilentlyContinue)
if ($dumps.Count -eq 0) {
throw 'ProcDump did not produce a crash dump.'
}
throw "ProcDump captured crash dump(s) for $($harness.Name); collecting artifacts and stack trace next."
- name: Collect crash dump and print stack trace
if: failure()
continue-on-error: true
shell: pwsh
run: |
$dumpDir = if ($env:CRASH_DUMP_DIR) { $env:CRASH_DUMP_DIR } else { 'C:\CrashDumps' }
$procDumpStdoutLog = Join-Path $dumpDir 'procdump.stdout.log'
$procDumpStderrLog = Join-Path $dumpDir 'procdump.stderr.log'
$deadline = (Get-Date).AddSeconds(60)
do {
$dumps = @(Get-ChildItem -Path $dumpDir -Filter *.dmp -ErrorAction SilentlyContinue)
if ($dumps.Count -gt 0) { break }
Start-Sleep -Seconds 5
} while ((Get-Date) -lt $deadline)
Write-Host 'Crash dump directory contents:'
if (Test-Path $dumpDir) {
Get-ChildItem -Path $dumpDir -Force |
Sort-Object Name |
Format-Table -AutoSize Name,Length,LastWriteTime
} else {
Write-Host "$dumpDir does not exist."
}
if (Test-Path $procDumpStdoutLog) {
Write-Host 'ProcDump stdout:'
Get-Content $procDumpStdoutLog
}
if (Test-Path $procDumpStderrLog) {
Write-Host 'ProcDump stderr:'
Get-Content $procDumpStderrLog
}
$dump = Get-ChildItem -Path $dumpDir -Filter *.dmp -ErrorAction SilentlyContinue |
Sort-Object LastWriteTime -Descending |
Select-Object -First 1
if (-not $dump) {
Write-Host 'No crash dump was captured.'
return
}
function Find-Cdb {
$command = Get-Command cdb.exe -ErrorAction SilentlyContinue
if ($command) {
return $command.Source
}
$searchRoots = @(
'C:\Program Files (x86)\Windows Kits\10\Debuggers'
'C:\Program Files\Windows Kits\10\Debuggers'
) | Where-Object { Test-Path $_ }
$candidates = @()
foreach ($root in $searchRoots) {
$candidates += Get-ChildItem -Path $root -Filter cdb.exe -Recurse -ErrorAction SilentlyContinue
}
if ($candidates.Count -eq 0) {
return $null
}
$arm64 = $candidates |
Where-Object { $_.FullName -match '\\arm64\\' } |
Select-Object -First 1
if ($arm64) {
return $arm64.FullName
}
return ($candidates | Select-Object -First 1).FullName
}
$cdb = Find-Cdb
if (-not $cdb) {
Write-Host 'cdb.exe was not found on the runner; skipping automated stack trace extraction.'
return
}
$stackTracePath = Join-Path $dumpDir 'latest-dump-stack.txt'
$workspace = (Get-Location).Path
$symbolCache = Join-Path $env:RUNNER_TEMP 'symbols'
New-Item -ItemType Directory -Force $symbolCache | Out-Null
$symbolPath = "srv*$symbolCache*https://msdl.microsoft.com/download/symbols;$workspace\target\debug\deps;$workspace\target\debug"
$imagePath = "$workspace\target\debug;$workspace\target\debug\deps"
Write-Host "Analyzing $($dump.Name) with $cdb"
$analysis = & $cdb `
-y $symbolPath `
-i $imagePath `
-z $dump.FullName `
-c "!analyze -v; .ecxr; kb; ~*kb; q" 2>&1
$analysis | Tee-Object -FilePath $stackTracePath
- name: Upload Windows ARM crash dumps
if: failure()
uses: actions/upload-artifact@v7
with:
name: windows-arm64-crash-dumps
if-no-files-found: warn
path: |
C:\CrashDumps\*.dmp
C:\CrashDumps\*.txt
- name: Upload Windows ARM symbols and binaries
if: failure()
uses: actions/upload-artifact@v7
with:
name: windows-arm64-symbols
if-no-files-found: warn
path: |
target\**\*.pdb
target\**\gitcomet*.exe