Skip to content

Commit

Permalink
CI: Expand GHA logic for windows compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
Repiteo committed Sep 23, 2024
1 parent 0a4aedb commit 22f3919
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 88 deletions.
96 changes: 50 additions & 46 deletions .github/workflows/runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,57 @@ concurrency:
cancel-in-progress: true

jobs:
# First stage: Only static checks, fast and prevent expensive builds from running.

static-checks:
if: '!vars.DISABLE_GODOT_CI'
name: 📊 Static checks
uses: ./.github/workflows/static_checks.yml

# Second stage: Run all the builds and some of the tests.

android-build:
name: 🤖 Android
needs: static-checks
uses: ./.github/workflows/android_builds.yml

ios-build:
name: 🍏 iOS
needs: static-checks
uses: ./.github/workflows/ios_builds.yml

linux-build:
name: 🐧 Linux
needs: static-checks
uses: ./.github/workflows/linux_builds.yml

macos-build:
name: 🍎 macOS
needs: static-checks
uses: ./.github/workflows/macos_builds.yml

windows-build:
name: 🏁 Windows
needs: static-checks
uses: ./.github/workflows/windows_builds.yml

web-build:
name: 🌐 Web
needs: static-checks
uses: ./.github/workflows/web_builds.yml

# Third stage: Run auxiliary tests using build artifacts from previous jobs.

# Can be turned off for PRs that intentionally break compat with godot-cpp,
# until both the upstream PR and the matching godot-cpp changes are merged.
godot-cpp-test:
name: 🪲 Godot CPP
# This can be changed to depend on another platform, if we decide to use it for
# godot-cpp instead. Make sure to move the .github/actions/godot-api-dump step
# appropriately.
needs: linux-build
uses: ./.github/workflows/godot_cpp_test.yml
# # First stage: Only static checks, fast and prevent expensive builds from running.

# static-checks:
# if: '!vars.DISABLE_GODOT_CI'
# name: 📊 Static checks
# uses: ./.github/workflows/static_checks.yml

# # Second stage: Run all the builds and some of the tests.

# android-build:
# name: 🤖 Android
# needs: static-checks
# uses: ./.github/workflows/android_builds.yml

# ios-build:
# name: 🍏 iOS
# needs: static-checks
# uses: ./.github/workflows/ios_builds.yml

# linux-build:
# name: 🐧 Linux
# needs: static-checks
# uses: ./.github/workflows/linux_builds.yml

# macos-build:
# name: 🍎 macOS
# needs: static-checks
# uses: ./.github/workflows/macos_builds.yml

# windows-build:
# name: 🏁 Windows
# needs: static-checks
# uses: ./.github/workflows/windows_builds.yml

# web-build:
# name: 🌐 Web
# needs: static-checks
# uses: ./.github/workflows/web_builds.yml

# # Third stage: Run auxiliary tests using build artifacts from previous jobs.

# # Can be turned off for PRs that intentionally break compat with godot-cpp,
# # until both the upstream PR and the matching godot-cpp changes are merged.
# godot-cpp-test:
# name: 🪲 Godot CPP
# # This can be changed to depend on another platform, if we decide to use it for
# # godot-cpp instead. Make sure to move the .github/actions/godot-api-dump step
# # appropriately.
# needs: linux-build
# uses: ./.github/workflows/godot_cpp_test.yml
77 changes: 39 additions & 38 deletions .github/workflows/windows_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ on:
env:
# Used for the cache key. Add version suffix to force clean build.
GODOT_BASE_BRANCH: master
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes d3d12=yes strict_checks=yes "angle_libs=${{ github.workspace }}/"
SCONSFLAGS: >-
dev_mode=yes
module_text_server_fb_enabled=yes
d3d12=yes
angle_libs=.
debug_symbols=no
vsproj_gen_only=no
windows_subsystem=console
SCONS_CACHE_MSVC_CONFIG: true

concurrency:
Expand All @@ -18,45 +25,31 @@ jobs:
build-windows:
# Windows 10 with latest image
runs-on: windows-latest
name: ${{ matrix.name }}
name: >-
${{ matrix.target == 'editor' && 'Editor' || 'Template'}} -
${{ matrix.compiler == 'msvc' && 'MSVC/cl' || matrix.compiler == 'clang' && 'MSVC/LLVM' || 'MinGW/GCC'}}
strategy:
fail-fast: false
matrix:
include:
- name: Editor (target=editor, tests=yes)
cache-name: windows-editor
target: editor
tests: true
# Skip debug symbols, they're way too big with MSVC.
sconsflags: debug_symbols=no vsproj=yes vsproj_gen_only=no windows_subsystem=console
bin: ./bin/godot.windows.editor.x86_64.exe
artifact: true

- name: Editor w/ clang-cl (target=editor, tests=yes, use_llvm=yes)
cache-name: windows-editor-clang
target: editor
tests: true
sconsflags: debug_symbols=no windows_subsystem=console use_llvm=yes
bin: ./bin/godot.windows.editor.x86_64.llvm.exe

- name: Template (target=template_release, tests=yes)
cache-name: windows-template
target: template_release
tests: true
sconsflags: debug_symbols=no
bin: ./bin/godot.windows.template_release.x86_64.console.exe
artifact: true
target: [editor, template_release]
compiler: [msvc, clang, gcc]

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Create environment variables
run: |
echo "CACHE_NAME=windows-${{ matrix.target }}-${{ matrix.compiler }}" >> $env:GITHUB_ENV
# TODO: concatenate variable beforehand
echo "BIN=./bin/godot.windows.${{ matrix.target }}.x86_64${{ matrix.compiler == 'clang' && '.llvm' || '' }}.exe" >> $env:GITHUB_ENV
- name: Restore Godot build cache
uses: ./.github/actions/godot-cache-restore
with:
cache-name: ${{ matrix.cache-name }}
cache-name: ${{ (matrix.target == 'editor' && matrix.compiler == 'gcc') && 'windows-template_release-gcc' || env.CACHE_NAME }}
continue-on-error: true

- name: Setup Python and SCons
Expand All @@ -69,44 +62,52 @@ jobs:
uses: dsaltares/fetch-gh-release-asset@1.1.2
with:
repo: godotengine/godot-angle-static
version: tags/chromium/6029
file: Windows.6029-1.MSVC_17.x86_64.x86_32.zip
version: tags/chromium/6601.2
file: godot-angle-static-x86_64-${{ matrix.compiler == 'gcc' && 'gcc' || 'msvc' }}-release.zip
target: angle/angle.zip

- name: Extract pre-built ANGLE static libraries
run: Expand-Archive -Force angle/angle.zip ${{ github.workspace }}/

- name: Setup MSVC problem matcher
if: matrix.compiler == 'msvc'
uses: ammaraskar/msvc-problem-matcher@master

- name: Setup GCC problem matcher
if: matrix.compiler != 'msvc'
uses: ammaraskar/gcc-problem-matcher@master

- name: Compilation
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
sconsflags: >-
${{ env.SCONSFLAGS }}
${{ matrix.sconsflags }}
vsproj=${{ matrix.compiler == 'msvc' && matrix.target == 'editor' }}
use_mingw=${{ matrix.compiler == 'gcc' }}
use_llvm=${{ matrix.compiler == 'clang' }}
platform: windows
target: ${{ matrix.target }}
tests: ${{ matrix.tests }}
tests: true

- name: Save Godot build cache
uses: ./.github/actions/godot-cache-save
with:
cache-name: ${{ matrix.cache-name }}
cache-name: ${{ env.CACHE_NAME }}
continue-on-error: true

- name: Prepare artifact
if: ${{ matrix.artifact }}
run: |
Remove-Item bin/* -Include *.exp,*.lib,*.pdb -Force
- name: Upload artifact
if: ${{ matrix.artifact }}
uses: ./.github/actions/upload-artifact
with:
name: ${{ matrix.cache-name }}
name: ${{ env.CACHE_NAME }}

- name: Unit tests
if: matrix.tests
run: |
${{ matrix.bin }} --version
${{ matrix.bin }} --help
${{ matrix.bin }} --test --force-colors
${{ env.BIN }} --version
${{ env.BIN }} --help
${{ env.BIN }} --test --force-colors
2 changes: 2 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,8 @@ else: # GCC, Clang
common_warnings += ["-Wno-type-limits"]
if cc_version_major >= 12: # False positives in our error macros, see GH-58747.
common_warnings += ["-Wno-return-type"]
if cc_version_major < 13: # `region` & `endregion` not recognized as valid pragmas.
common_warnings += ["-Wno-unknown-pragmas"]
elif methods.using_clang(env) or methods.using_emcc(env):
common_warnings += ["-Wshadow-field-in-constructor", "-Wshadow-uncaptured-local"]
# We often implement `operator<` for structs of pointers as a requirement
Expand Down
2 changes: 1 addition & 1 deletion drivers/d3d12/dxil_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void compute_dxil_hash(const BYTE *pData, UINT byteCount, BYTE *pOutHash) {
UINT NextEndState = bTwoRowsPadding ? N - 2 : N - 1;
const BYTE *pCurrData = pData;
for (UINT i = 0; i < N; i++, offset += 64, pCurrData += 64) {
UINT x[16];
UINT x[16] = {};
const UINT *pX;
if (i == NextEndState) {
if (!bTwoRowsPadding && i == N - 1) {
Expand Down
9 changes: 7 additions & 2 deletions drivers/d3d12/rendering_device_driver_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,14 @@ RDD::TextureID RenderingDeviceDriverD3D12::texture_create(const TextureFormat &p
}
tex_info->states_ptr = &tex_info->owner_info.states;
tex_info->format = p_format.format;
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
tex_info->desc = *(CD3DX12_RESOURCE_DESC *)&resource_desc;
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
tex_info->base_layer = 0;
tex_info->layers = resource_desc.ArraySize();
tex_info->base_mip = 0;
Expand Down Expand Up @@ -6645,8 +6652,6 @@ static Error create_command_signature(ID3D12Device *device, D3D12_INDIRECT_ARGUM

Error RenderingDeviceDriverD3D12::_initialize_frames(uint32_t p_frame_count) {
Error err;
D3D12MA::ALLOCATION_DESC allocation_desc = {};
allocation_desc.HeapType = D3D12_HEAP_TYPE_DEFAULT;

//CD3DX12_RESOURCE_DESC resource_desc = CD3DX12_RESOURCE_DESC::Buffer(D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT);
uint32_t resource_descriptors_per_frame = GLOBAL_GET("rendering/rendering_device/d3d12/max_resource_descriptors_per_frame");
Expand Down
6 changes: 5 additions & 1 deletion platform/windows/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def spawn_capture(sh, escape, cmd, args, env):
env.AppendUnique(CPPDEFINES=["GLES3_ENABLED"])
if env["angle_libs"] != "":
env.AppendUnique(CPPDEFINES=["EGL_STATIC"])
env.Append(LIBPATH=[env["angle_libs"]])
env.Append(LIBPATH=[os.path.normpath(env["angle_libs"]).replace("\\", "/")])
LIBS += [
"libANGLE.windows." + env["arch"] + prebuilt_lib_extra_suffix,
"libEGL.windows." + env["arch"] + prebuilt_lib_extra_suffix,
Expand Down Expand Up @@ -727,6 +727,10 @@ def configure_mingw(env: "SConsEnvironment"):
if os.name == "nt":
env["TEMPFILEARGESCFUNC"] = tempfile_arg_esc_func

# FIXME: While MinGW *should* support this limit (documentation is inconsistent), it's only
# needed because the GHA for Windows MinGW/GCC fails to recognize the above link method.
env["MAXLINELENGTH"] = 32768

## Build type

if not env["use_llvm"] and not try_cmd("gcc --version", env["mingw_prefix"], env["arch"]):
Expand Down

0 comments on commit 22f3919

Please sign in to comment.