build.yml (20877B)
1 name: build 2 3 on: 4 push: 5 pull_request: 6 workflow_run: 7 # Use a workflow as a trigger of scheduled builds. Forked repositories can disable scheduled builds by disabling 8 # "scheduled" workflow, while maintaining ability to perform local CI builds. 9 workflows: 10 - scheduled 11 branches: 12 - master 13 - docking 14 types: 15 - requested 16 17 jobs: 18 Windows: 19 runs-on: windows-2019 20 env: 21 VS_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\ 22 MSBUILD_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\ 23 steps: 24 - uses: actions/checkout@v2 25 26 - name: Install Dependencies 27 shell: powershell 28 run: | 29 Invoke-WebRequest -Uri "https://www.libsdl.org/release/SDL2-devel-2.0.10-VC.zip" -OutFile "SDL2-devel-2.0.10-VC.zip" 30 Expand-Archive -Path SDL2-devel-2.0.10-VC.zip 31 echo "SDL2_DIR=$(pwd)\SDL2-devel-2.0.10-VC\SDL2-2.0.10\" >>${env:GITHUB_ENV} 32 33 Invoke-WebRequest -Uri "https://github.com/ocornut/imgui/files/3789205/vulkan-sdk-1.1.121.2.zip" -OutFile vulkan-sdk-1.1.121.2.zip 34 Expand-Archive -Path vulkan-sdk-1.1.121.2.zip 35 echo "VULKAN_SDK=$(pwd)\vulkan-sdk-1.1.121.2\" >>${env:GITHUB_ENV} 36 37 - name: Fix Projects 38 shell: powershell 39 run: | 40 # WARNING: This will need updating if toolset/sdk change in project files! 41 gci -recurse -filter "*.vcxproj" | ForEach-Object { 42 # Fix SDK and toolset for most samples. 43 (Get-Content $_.FullName) -Replace "<PlatformToolset>v110</PlatformToolset>","<PlatformToolset>v142</PlatformToolset>" | Set-Content -Path $_.FullName 44 (Get-Content $_.FullName) -Replace "<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>","<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>" | Set-Content -Path $_.FullName 45 # Fix SDK and toolset for samples that require newer SDK/toolset. At the moment it is only dx12. 46 (Get-Content $_.FullName) -Replace "<PlatformToolset>v140</PlatformToolset>","<PlatformToolset>v142</PlatformToolset>" | Set-Content -Path $_.FullName 47 (Get-Content $_.FullName) -Replace "<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>","<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>" | Set-Content -Path $_.FullName 48 } 49 50 # Not using matrix here because it would inflate job count too much. Check out and setup is done for every job and that makes build times way too long. 51 - name: Build example_null (extra warnings, mingw 64-bit) 52 run: mingw32-make -C examples/example_null WITH_EXTRA_WARNINGS=1 53 54 - name: Build example_null (extra warnings, msvc 64-bit) 55 shell: cmd 56 run: | 57 cd examples\example_null 58 call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat" 59 .\build_win32.bat /W4 60 61 - name: Build example_null (single file build) 62 shell: bash 63 run: | 64 cat > example_single_file.cpp <<'EOF' 65 66 #define IMGUI_IMPLEMENTATION 67 #include "misc/single_file/imgui_single_file.h" 68 #include "examples/example_null/main.cpp" 69 70 EOF 71 g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp -limm32 72 73 - name: Build example_null (with IMGUI_DISABLE_WIN32_FUNCTIONS) 74 shell: bash 75 run: | 76 cat > example_single_file.cpp <<'EOF' 77 78 #define IMGUI_DISABLE_WIN32_FUNCTIONS 79 #define IMGUI_IMPLEMENTATION 80 #include "misc/single_file/imgui_single_file.h" 81 #include "examples/example_null/main.cpp" 82 83 EOF 84 g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp -limm32 85 86 - name: Build example_null (as DLL) 87 shell: cmd 88 run: | 89 call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat" 90 91 echo #ifdef _EXPORT > example_single_file.cpp 92 echo # define IMGUI_API __declspec(dllexport) >> example_single_file.cpp 93 echo #else >> example_single_file.cpp 94 echo # define IMGUI_API __declspec(dllimport) >> example_single_file.cpp 95 echo #endif >> example_single_file.cpp 96 echo #define IMGUI_IMPLEMENTATION >> example_single_file.cpp 97 echo #include "misc/single_file/imgui_single_file.h" >> example_single_file.cpp 98 99 cl.exe /D_USRDLL /D_WINDLL /D_EXPORT /I. example_single_file.cpp /LD /FeImGui.dll /link 100 cl.exe /I. ImGui.lib /Feexample_null.exe examples/example_null/main.cpp 101 102 - name: Build Win32 example_glfw_opengl2 103 shell: cmd 104 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release' 105 106 - name: Build Win32 example_glfw_opengl3 107 shell: cmd 108 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release' 109 if: github.event_name == 'workflow_run' 110 111 - name: Build Win32 example_glfw_vulkan 112 shell: cmd 113 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release' 114 if: github.event_name == 'workflow_run' 115 116 - name: Build Win32 example_sdl_vulkan 117 shell: cmd 118 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release' 119 if: github.event_name == 'workflow_run' 120 121 - name: Build Win32 example_sdl_opengl2 122 shell: cmd 123 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release' 124 if: github.event_name == 'workflow_run' 125 126 - name: Build Win32 example_sdl_opengl3 127 shell: cmd 128 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release' 129 130 - name: Build Win32 example_sdl_directx11 131 shell: cmd 132 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_directx11/example_sdl_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release' 133 if: github.event_name == 'workflow_run' 134 135 - name: Build Win32 example_win32_directx9 136 shell: cmd 137 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx9/example_win32_directx9.vcxproj /p:Platform=Win32 /p:Configuration=Release' 138 139 - name: Build Win32 example_win32_directx10 140 shell: cmd 141 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx10/example_win32_directx10.vcxproj /p:Platform=Win32 /p:Configuration=Release' 142 143 - name: Build Win32 example_win32_directx11 144 shell: cmd 145 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release' 146 if: github.event_name == 'workflow_run' 147 148 - name: Build x64 example_glfw_opengl2 149 shell: cmd 150 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release' 151 if: github.event_name == 'workflow_run' 152 153 - name: Build x64 example_glfw_opengl3 154 shell: cmd 155 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release' 156 157 - name: Build x64 example_glfw_vulkan 158 shell: cmd 159 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release' 160 161 - name: Build x64 example_sdl_vulkan 162 shell: cmd 163 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release' 164 if: github.event_name == 'workflow_run' 165 166 - name: Build x64 example_sdl_opengl2 167 shell: cmd 168 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release' 169 if: github.event_name == 'workflow_run' 170 171 - name: Build x64 example_sdl_opengl3 172 shell: cmd 173 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release' 174 if: github.event_name == 'workflow_run' 175 176 - name: Build x64 example_sdl_directx11 177 shell: cmd 178 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_directx11/example_sdl_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release' 179 180 - name: Build x64 example_win32_directx9 181 shell: cmd 182 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx9/example_win32_directx9.vcxproj /p:Platform=x64 /p:Configuration=Release' 183 if: github.event_name == 'workflow_run' 184 185 - name: Build x64 example_win32_directx10 186 shell: cmd 187 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx10/example_win32_directx10.vcxproj /p:Platform=x64 /p:Configuration=Release' 188 if: github.event_name == 'workflow_run' 189 190 - name: Build x64 example_win32_directx11 191 shell: cmd 192 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release' 193 if: github.event_name == 'workflow_run' 194 195 - name: Build x64 example_win32_directx12 196 shell: cmd 197 run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx12/example_win32_directx12.vcxproj /p:Platform=x64 /p:Configuration=Release' 198 199 Linux: 200 runs-on: ubuntu-20.04 201 steps: 202 - uses: actions/checkout@v2 203 204 - name: Install Dependencies 205 run: | 206 sudo apt-get update 207 sudo apt-get install -y libglfw3-dev libsdl2-dev gcc-multilib g++-multilib libfreetype6-dev 208 209 - name: Build example_null (extra warnings, gcc 32-bit) 210 run: | 211 make -C examples/example_null clean 212 CXXFLAGS="$CXXFLAGS -m32 -Werror" make -C examples/example_null WITH_EXTRA_WARNINGS=1 213 214 - name: Build example_null (extra warnings, gcc 64-bit) 215 run: | 216 make -C examples/example_null clean 217 CXXFLAGS="$CXXFLAGS -m64 -Werror" make -C examples/example_null WITH_EXTRA_WARNINGS=1 218 219 - name: Build example_null (extra warnings, clang 32-bit) 220 run: | 221 make -C examples/example_null clean 222 CXXFLAGS="$CXXFLAGS -m32 -Werror" CXX=clang++ make -C examples/example_null WITH_EXTRA_WARNINGS=1 223 224 - name: Build example_null (extra warnings, clang 64-bit) 225 run: | 226 make -C examples/example_null clean 227 CXXFLAGS="$CXXFLAGS -m64 -Werror" CXX=clang++ make -C examples/example_null WITH_EXTRA_WARNINGS=1 228 229 - name: Build example_null (freetype) 230 run: | 231 make -C examples/example_null clean 232 make -C examples/example_null WITH_FREETYPE=1 233 234 - name: Build example_null (single file build) 235 run: | 236 cat > example_single_file.cpp <<'EOF' 237 238 #define IMGUI_IMPLEMENTATION 239 #include "misc/single_file/imgui_single_file.h" 240 #include "examples/example_null/main.cpp" 241 242 EOF 243 g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp 244 245 - name: Build example_null (with ImWchar32) 246 run: | 247 cat > example_single_file.cpp <<'EOF' 248 249 #define IMGUI_USE_WCHAR32 250 #define IMGUI_IMPLEMENTATION 251 #include "misc/single_file/imgui_single_file.h" 252 #include "examples/example_null/main.cpp" 253 254 EOF 255 g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp 256 257 - name: Build example_null (with large ImDrawIdx + pointer ImTextureID) 258 run: | 259 cat > example_single_file.cpp <<'EOF' 260 261 #define ImTextureID void* 262 #define ImDrawIdx unsigned int 263 #define IMGUI_IMPLEMENTATION 264 #include "misc/single_file/imgui_single_file.h" 265 #include "examples/example_null/main.cpp" 266 267 EOF 268 g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp 269 270 - name: Build example_null (with IMGUI_DISABLE_OBSOLETE_FUNCTIONS) 271 run: | 272 cat > example_single_file.cpp <<'EOF' 273 274 #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 275 #define IMGUI_IMPLEMENTATION 276 #include "misc/single_file/imgui_single_file.h" 277 #include "examples/example_null/main.cpp" 278 279 EOF 280 g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp 281 282 - name: Build example_null (with IMGUI_DISABLE_DEMO_WINDOWS and IMGUI_DISABLE_METRICS_WINDOW) 283 run: | 284 cat > example_single_file.cpp <<'EOF' 285 286 #define IMGUI_DISABLE_DEMO_WINDOWS 287 #define IMGUI_DISABLE_METRICS_WINDOW 288 #define IMGUI_IMPLEMENTATION 289 #include "misc/single_file/imgui_single_file.h" 290 #include "examples/example_null/main.cpp" 291 292 EOF 293 g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp 294 295 - name: Build example_null (with IMGUI_DISABLE_FILE_FUNCTIONS) 296 run: | 297 cat > example_single_file.cpp <<'EOF' 298 299 #define IMGUI_DISABLE_FILE_FUNCTIONS 300 #define IMGUI_IMPLEMENTATION 301 #include "misc/single_file/imgui_single_file.h" 302 #include "examples/example_null/main.cpp" 303 304 EOF 305 g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp 306 307 - name: Build example_null (with IMGUI_USE_BGRA_PACKED_COLOR) 308 run: | 309 cat > example_single_file.cpp <<'EOF' 310 311 #define IMGUI_USE_BGRA_PACKED_COLOR 312 #define IMGUI_IMPLEMENTATION 313 #include "misc/single_file/imgui_single_file.h" 314 #include "examples/example_null/main.cpp" 315 316 EOF 317 g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp 318 319 - name: Build example_null (with IM_VEC2_CLASS_EXTRA and IM_VEC4_CLASS_EXTRA) 320 run: | 321 cat > example_single_file.cpp <<'EOF' 322 323 struct MyVec2 { float x; float y; MyVec2(float x, float y) : x(x), y(y) { } }; 324 struct MyVec4 { float x; float y; float z; float w; 325 MyVec4(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) { } }; 326 #define IM_VEC2_CLASS_EXTRA \ 327 ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \ 328 operator MyVec2() const { return MyVec2(x, y); } 329 #define IM_VEC4_CLASS_EXTRA \ 330 ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \ 331 operator MyVec4() const { return MyVec4(x, y, z, w); } 332 #define IMGUI_IMPLEMENTATION 333 #include "misc/single_file/imgui_single_file.h" 334 #include "examples/example_null/main.cpp" 335 336 EOF 337 g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp 338 339 - name: Build example_null (without c++ runtime, Clang) 340 run: | 341 cat > example_single_file.cpp <<'EOF' 342 343 #define IMGUI_IMPLEMENTATION 344 #define IMGUI_DISABLE_DEMO_WINDOWS 345 #include "misc/single_file/imgui_single_file.h" 346 #include "examples/example_null/main.cpp" 347 348 EOF 349 clang++ -I. -Wall -Wformat -nodefaultlibs -fno-rtti -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp 350 351 - name: Build example_glfw_opengl2 352 run: make -C examples/example_glfw_opengl2 353 354 - name: Build example_glfw_opengl3 355 run: make -C examples/example_glfw_opengl3 356 if: github.event_name == 'workflow_run' 357 358 - name: Build example_sdl_opengl2 359 run: make -C examples/example_sdl_opengl2 360 if: github.event_name == 'workflow_run' 361 362 - name: Build example_sdl_opengl3 363 run: make -C examples/example_sdl_opengl3 364 365 MacOS: 366 runs-on: macos-latest 367 steps: 368 - uses: actions/checkout@v2 369 370 - name: Install Dependencies 371 run: | 372 brew install glfw3 sdl2 373 374 - name: Build example_null (extra warnings, clang 64-bit) 375 run: make -C examples/example_null WITH_EXTRA_WARNINGS=1 376 377 - name: Build example_null (single file build) 378 run: | 379 cat > example_single_file.cpp <<'EOF' 380 381 #define IMGUI_IMPLEMENTATION 382 #include "misc/single_file/imgui_single_file.h" 383 #include "examples/example_null/main.cpp" 384 385 EOF 386 clang++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp 387 388 - name: Build example_null (without c++ runtime) 389 run: | 390 cat > example_single_file.cpp <<'EOF' 391 392 #define IMGUI_IMPLEMENTATION 393 #include "misc/single_file/imgui_single_file.h" 394 #include "examples/example_null/main.cpp" 395 396 EOF 397 clang++ -I. -Wall -Wformat -nodefaultlibs -fno-rtti -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp 398 399 - name: Build example_glfw_opengl2 400 run: make -C examples/example_glfw_opengl2 401 402 - name: Build example_glfw_opengl3 403 run: make -C examples/example_glfw_opengl3 404 if: github.event_name == 'workflow_run' 405 406 - name: Build example_glfw_metal 407 run: make -C examples/example_glfw_metal 408 409 - name: Build example_sdl_metal 410 run: make -C examples/example_sdl_metal 411 412 - name: Build example_sdl_opengl2 413 run: make -C examples/example_sdl_opengl2 414 if: github.event_name == 'workflow_run' 415 416 - name: Build example_sdl_opengl3 417 run: make -C examples/example_sdl_opengl3 418 419 - name: Build example_apple_metal 420 run: xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_macos 421 422 - name: Build example_apple_opengl2 423 run: xcodebuild -project examples/example_apple_opengl2/example_apple_opengl2.xcodeproj -target example_osx_opengl2 424 425 iOS: 426 runs-on: macos-latest 427 steps: 428 - uses: actions/checkout@v2 429 430 - name: Build example_apple_metal 431 run: | 432 # Code signing is required, but we disable it because it is irrelevant for CI builds. 433 xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_ios CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO 434 435 Emscripten: 436 runs-on: ubuntu-18.04 437 steps: 438 - uses: actions/checkout@v2 439 440 - name: Install Dependencies 441 run: | 442 wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz 443 tar -xvf master.tar.gz 444 emsdk-master/emsdk update 445 emsdk-master/emsdk install latest 446 emsdk-master/emsdk activate latest 447 448 - name: Build example_emscripten_opengl3 449 run: | 450 pushd emsdk-master 451 source ./emsdk_env.sh 452 popd 453 make -C examples/example_emscripten_opengl3 454 455 - name: Build example_emscripten_wgpu 456 run: | 457 pushd emsdk-master 458 source ./emsdk_env.sh 459 popd 460 make -C examples/example_emscripten_wgpu 461 462 Android: 463 runs-on: ubuntu-18.04 464 steps: 465 - uses: actions/checkout@v2 466 467 - name: Build example_android_opengl3 468 run: | 469 cd examples/example_android_opengl3/android 470 gradle assembleDebug 471 472 Discord-CI: 473 runs-on: ubuntu-18.04 474 if: always() 475 needs: [Windows, Linux, MacOS, iOS, Emscripten, Android] 476 steps: 477 - uses: dearimgui/github_discord_notifier@latest 478 with: 479 discord-webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} 480 github-token: ${{ github.token }} 481 action-task: discord-jobs 482 discord-filter: "'{{ github.branch }}'.match(/master|docking/g) != null && '{{ run.conclusion }}' != '{{ last_run.conclusion }}'" 483 discord-username: GitHub Actions 484 discord-job-new-failure-message: '' 485 discord-job-fixed-failure-message: '' 486 discord-job-new-failure-embed: | 487 { 488 "title": "`{{ job.name }}` job is failing on `{{ github.branch }}`!", 489 "description": "Commit [{{ github.context.payload.head_commit.title }}]({{ github.context.payload.head_commit.url }}) pushed to [{{ github.branch }}]({{ github.branch_url }}) broke [{{ job.name }}]({{ job.url }}) build job.\nFailing steps: {{ failing_steps }}", 490 "url": "{{ job.url }}", 491 "color": "0xFF0000", 492 "timestamp": "{{ run.updated_at }}" 493 } 494 discord-job-fixed-failure-embed: | 495 { 496 "title": "`{{ github.branch }}` branch is no longer failing!", 497 "description": "Build failures were fixed on [{{ github.branch }}]({{ github.branch_url }}) branch.", 498 "color": "0x00FF00", 499 "url": "{{ github.context.payload.head_commit.url }}", 500 "timestamp": "{{ run.completed_at }}" 501 }