@@ -26,10 +26,104 @@ jobs:
2626 curl.exe --location --create-dirs -oC:\TEMP\DXSDK_Aug08.exe https://archive.org/download/dxsdk_aug08/DXSDK_Aug08.exe
2727 7z.exe x C:\TEMP\DXSDK_Aug08.exe -aoa -oC:\Tools\DXSDK_Aug08 DXSDK/Include DXSDK/Lib
2828
29- - name : Build
30- shell : cmd
31- run : |
32- for /f "delims=" %%i in ('"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath') do set VS_PATH=%%i
33- call "%VS_PATH%\VC\Auxiliary\Build\vcvarsall.bat" x86
34- cmake -B build -GNinja -DLLVM_WIDBERG="C:\Tools\llvm-widberg" -DDXSDK_DIR=C:\Tools\DXSDK_Aug08\DXSDK
35- cmake --build build
29+ - name : Build (with minilua crash capture)
30+ id : build
31+ continue-on-error : true
32+ shell : powershell
33+ run : |
34+ $ErrorActionPreference = "Stop"
35+ New-Item -ItemType Directory -Force "$env:GITHUB_WORKSPACE\dumps" | Out-Null
36+
37+ $procdumpExe = "$env:RUNNER_TEMP\procdump\procdump64.exe"
38+ if (-not (Test-Path $procdumpExe)) {
39+ Invoke-WebRequest https://download.sysinternals.com/files/Procdump.zip -OutFile "$env:RUNNER_TEMP\Procdump.zip"
40+ Expand-Archive "$env:RUNNER_TEMP\Procdump.zip" -DestinationPath "$env:RUNNER_TEMP\procdump" -Force
41+ }
42+
43+ $buildScript = @'
44+ for /f "delims=" %%i in ('"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath') do set VS_PATH=%%i
45+ call "%VS_PATH%\VC\Auxiliary\Build\vcvarsall.bat" x86
46+ cmake -B build -GNinja -DLLVM_WIDBERG="C:\Tools\llvm-widberg" -DDXSDK_DIR=C:\Tools\DXSDK_Aug08\DXSDK
47+ cmake --build build -v
48+ '@
49+ $buildScriptPath = Join-Path $env:RUNNER_TEMP "build_fmtk.cmd"
50+ Set-Content -Path $buildScriptPath -Value $buildScript -Encoding Ascii
51+
52+ $procdump = Start-Process `
53+ -FilePath $procdumpExe `
54+ -ArgumentList "-accepteula -e -t -ma -x `"$env:GITHUB_WORKSPACE\dumps`" -w minilua.exe" `
55+ -PassThru
56+ Start-Sleep -Seconds 1
57+
58+ try {
59+ & cmd.exe /c "`"$buildScriptPath`""
60+ $buildExit = $LASTEXITCODE
61+ } finally {
62+ if ($procdump -and -not $procdump.HasExited) {
63+ Stop-Process -Id $procdump.Id -Force -ErrorAction SilentlyContinue
64+ }
65+ }
66+
67+ exit $buildExit
68+
69+ - name : Print minilua stack trace
70+ if : steps.build.outcome == 'failure'
71+ shell : powershell
72+ run : |
73+ $dumpsDir = "$env:GITHUB_WORKSPACE\dumps"
74+ $dmp = Get-ChildItem $dumpsDir -Filter *.dmp -ErrorAction SilentlyContinue |
75+ Sort-Object LastWriteTime -Descending |
76+ Select-Object -First 1
77+
78+ $cdb = "C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\cdb.exe"
79+ if (-not (Test-Path $cdb)) {
80+ $cdb = "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe"
81+ }
82+ if (-not (Test-Path $cdb)) {
83+ Write-Host "::warning::cdb.exe not found in Windows Kits debugger paths."
84+ exit 0
85+ }
86+
87+ $env:_NT_SYMBOL_PATH = "srv*C:\symbols*https://msdl.microsoft.com/download/symbols;$env:GITHUB_WORKSPACE\build\dependencies\LuaJIT\src\host\cmake\minilua"
88+ if ($dmp) {
89+ Write-Host "Analyzing dump: $($dmp.FullName)"
90+ & $cdb -z $dmp.FullName -c ".symfix; .reload; !analyze -v; .ecxr; kb; kv; q"
91+ exit 0
92+ }
93+
94+ Write-Host "::warning::No dump captured from minilua.exe; rerunning minilua under cdb."
95+ $minilua = "$env:GITHUB_WORKSPACE\build\dependencies\LuaJIT\src\host\cmake\minilua\minilua.exe"
96+ $genversion = "$env:GITHUB_WORKSPACE\dependencies\LuaJIT\src\host\genversion.lua"
97+ $rolling = "$env:GITHUB_WORKSPACE\dependencies\LuaJIT\src\luajit_rolling.h"
98+ $relver = "$env:GITHUB_WORKSPACE\build\dependencies\LuaJIT\src\luajit_relver.txt"
99+ $luajith = "$env:GITHUB_WORKSPACE\build\dependencies\LuaJIT\src\luajit.h"
100+
101+ if (-not (Test-Path $minilua)) {
102+ Write-Host "::warning::minilua.exe not found at $minilua"
103+ exit 0
104+ }
105+ if (-not (Test-Path $genversion) -or -not (Test-Path $rolling)) {
106+ Write-Host "::warning::LuaJIT genversion inputs not found."
107+ exit 0
108+ }
109+
110+ New-Item -ItemType Directory -Force (Split-Path -Parent $relver) | Out-Null
111+ if (-not (Test-Path $relver)) {
112+ Set-Content -Path $relver -Value "ROLLING" -Encoding Ascii
113+ }
114+
115+ & $cdb -o -G -g -c ".symfix; .reload; sxe av; g; .echo ==== exception context ====; .ecxr; kb; kv; !analyze -v; q" `
116+ $minilua $genversion $rolling $relver $luajith
117+
118+ - name : Upload minilua dumps
119+ if : always()
120+ uses : actions/upload-artifact@v4
121+ with :
122+ name : minilua-dumps
123+ path : ${{ github.workspace }}\dumps\*.dmp
124+ if-no-files-found : ignore
125+
126+ - name : Fail job if build failed
127+ if : steps.build.outcome == 'failure'
128+ shell : powershell
129+ run : exit 1
0 commit comments