-
Notifications
You must be signed in to change notification settings - Fork 158
163 lines (146 loc) · 6.88 KB
/
Copy pathbuild-win32.yml
File metadata and controls
163 lines (146 loc) · 6.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Build Win32
on:
workflow_call:
inputs:
platform:
required: true
type: string
napi-type:
required: false
type: string
default: direct
graphics-api:
required: false
type: string
default: D3D11
enable-sanitizers:
required: false
type: boolean
default: false
jobs:
build:
runs-on: windows-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v5
- name: Cache FetchContent deps
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.fc-cache
!${{ github.workspace }}/.fc-cache/*-build
!${{ github.workspace }}/.fc-cache/*-build/**
key: fc-v2-win32-${{ inputs.platform }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
fc-v2-win32-${{ inputs.platform }}-
- name: Set variables
id: vars
shell: bash
run: |
SUFFIX=""
JS_DEFINE=""
if [ "${{ inputs.napi-type }}" = "jsi" ]; then
SUFFIX="_JSI"
JS_DEFINE="-DNAPI_JAVASCRIPT_ENGINE=JSI"
elif [ "${{ inputs.napi-type }}" = "V8" ]; then
SUFFIX="_V8"
JS_DEFINE="-DNAPI_JAVASCRIPT_ENGINE=V8"
fi
echo "suffix=$SUFFIX" >> "$GITHUB_OUTPUT"
echo "js_define=$JS_DEFINE" >> "$GITHUB_OUTPUT"
echo "solution_name=Win32_${{ inputs.platform }}${SUFFIX}" >> "$GITHUB_OUTPUT"
echo "sanitizer_flag=${{ inputs.enable-sanitizers && 'ON' || 'OFF' }}" >> "$GITHUB_OUTPUT"
- name: Generate solution
shell: cmd
run: |
cmake -G "Visual Studio 17 2022" ^
-B build/${{ steps.vars.outputs.solution_name }} ^
-A ${{ inputs.platform }} ^
-D FETCHCONTENT_BASE_DIR=${{ github.workspace }}/.fc-cache ^
-D FETCHCONTENT_UPDATES_DISCONNECTED=ON ^
${{ steps.vars.outputs.js_define }} ^
-D BX_CONFIG_DEBUG=ON ^
-D GRAPHICS_API=${{ inputs.graphics-api }} ^
-D BGFX_CONFIG_MAX_FRAME_BUFFERS=256 ^
-D BABYLON_DEBUG_TRACE=ON ^
-D ENABLE_SANITIZERS=${{ steps.vars.outputs.sanitizer_flag }}
- name: Build
shell: cmd
run: |
cmake --build build/${{ steps.vars.outputs.solution_name }} --config RelWithDebInfo -- /m
- name: Enable Crash Dumps
shell: cmd
run: |
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Playground.exe" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Playground.exe" /v DumpType /t REG_DWORD /d 2 /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Playground.exe" /v DumpCount /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Playground.exe" /v DumpFolder /t REG_SZ /d "%RUNNER_TEMP%\Dumps" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\UnitTests.exe" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\UnitTests.exe" /v DumpType /t REG_DWORD /d 2 /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\UnitTests.exe" /v DumpCount /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\UnitTests.exe" /v DumpFolder /t REG_SZ /d "%RUNNER_TEMP%\Dumps" /f
- name: Add ASAN runtime DLLs to PATH
if: ${{ inputs.enable-sanitizers }}
shell: powershell
run: |
$vs = vswhere -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
$msvc = Get-ChildItem "$vs\VC\Tools\MSVC" | Sort-Object Name -Descending | Select-Object -First 1
$asanPath = "$($msvc.FullName)\bin\Hostx64\x64"
Write-Host "Adding ASAN runtime folder to PATH: $asanPath"
echo "$asanPath" >> $env:GITHUB_PATH
- name: Disable JIT Debugger for Script
shell: cmd
run: |
for /f %%i in ('vswhere -property instanceId') do (
reg add HKCU\Software\Microsoft\VisualStudio\Debugger\JIT\{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}\%%i /f /v Disabled /t REG_DWORD /d 1
)
- name: Validation Tests
if: ${{ inputs.graphics-api != 'D3D12' }}
shell: cmd
run: |
cd build\${{ steps.vars.outputs.solution_name }}\Apps\Playground\RelWithDebInfo
Playground app:///Scripts/validation_native.js
- name: Upload Rendered Pictures
if: ${{ inputs.graphics-api != 'D3D12' && !cancelled() }}
uses: actions/upload-artifact@v6
with:
name: ${{ steps.vars.outputs.solution_name }}-${{ inputs.graphics-api }}${{ inputs.enable-sanitizers && '-sanitizer' || '' }}-rendered-pictures
path: build/${{ steps.vars.outputs.solution_name }}/Apps/Playground/Results
if-no-files-found: ignore
- name: Upload Error Pictures
if: failure()
uses: actions/upload-artifact@v6
with:
name: ${{ steps.vars.outputs.solution_name }}-${{ inputs.graphics-api }}${{ inputs.enable-sanitizers && '-sanitizer' || '' }}-error-pictures
path: build/${{ steps.vars.outputs.solution_name }}/Apps/Playground/Errors
if-no-files-found: ignore
- name: Stage Playground Crash Dump
if: failure()
shell: powershell
run: |
New-Item -ItemType Directory -Force -Path "$env:RUNNER_TEMP\Dumps" | Out-Null
Copy-Item -Path "build\${{ steps.vars.outputs.solution_name }}\Apps\Playground\RelWithDebInfo\Playground.*" -Destination "$env:RUNNER_TEMP\Dumps\" -ErrorAction SilentlyContinue
- name: Unit Tests
if: ${{ inputs.graphics-api != 'D3D12' }}
shell: cmd
run: |
cd build\${{ steps.vars.outputs.solution_name }}\Apps\UnitTests\RelWithDebInfo
UnitTests
- name: Module Load Test
if: ${{ !inputs.enable-sanitizers }}
shell: cmd
run: |
cd build\${{ steps.vars.outputs.solution_name }}\Apps\ModuleLoadTest\RelWithDebInfo
ModuleLoadTest
- name: Stage UnitTests Crash Dump
if: failure()
shell: powershell
run: |
Copy-Item -Path "build\${{ steps.vars.outputs.solution_name }}\Apps\UnitTests\RelWithDebInfo\UnitTests.*" -Destination "$env:RUNNER_TEMP\Dumps\" -ErrorAction SilentlyContinue
- name: Upload Crash Dumps
if: failure()
uses: actions/upload-artifact@v6
with:
name: ${{ steps.vars.outputs.solution_name }}-${{ inputs.graphics-api }}${{ inputs.enable-sanitizers && '-sanitizer' || '' }}-crash-dumps
path: ${{ runner.temp }}/Dumps/
if-no-files-found: ignore