Skip to content

Add Windows CI#55

Open
Shakai-Dev wants to merge 2 commits into
Redot-Engine:masterfrom
Shakai-Dev:windows-ci
Open

Add Windows CI#55
Shakai-Dev wants to merge 2 commits into
Redot-Engine:masterfrom
Shakai-Dev:windows-ci

Conversation

@Shakai-Dev

@Shakai-Dev Shakai-Dev commented Jul 14, 2026

Copy link
Copy Markdown
Member

Adds CI for Windows

Summary by CodeRabbit

  • Chores
    • Added automated Windows build validation for every code change, including toolchain setup, compilation, unit test runs, and artifact upload for easier troubleshooting.
    • Updated the Linux build workflow to avoid persisting Git credentials after repository checkout.
    • Improves confidence that changes remain compatible across Windows and Linux CI runs.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9670448e-dbd3-46fc-9076-768abe81617a

📥 Commits

Reviewing files that changed from the base of the PR and between 24211a1 and d17d99f.

📒 Files selected for processing (2)
  • .github/workflows/linux_build.yml
  • .github/workflows/windows_build.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/windows_build.yml

📝 Walkthrough

Walkthrough

Adds a Windows GitHub Actions workflow that provisions Clang and Vulkan, configures and builds the debug target with CMake and Ninja, runs unit tests, and uploads the resulting artifact. Linux checkout is updated to avoid persisting credentials.

Changes

Cross-Platform CI Workflows

Layer / File(s) Summary
Workflow and environment setup
.github/workflows/windows_build.yml, .github/workflows/linux_build.yml
Adds Windows workflow triggers and checkout, installs and verifies Clang and Vulkan, and disables persisted checkout credentials in Linux CI.
Build configuration and caching
.github/workflows/windows_build.yml
Configures ccache and the debug CMake preset with Ninja and Clang.
Build validation and artifact publication
.github/workflows/windows_build.yml
Builds the debug target, runs parallel CTest execution, and uploads build/debug/ as windows_debug for seven days.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding Windows CI.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
.github/workflows/windows_build.yml (3)

26-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Standardize shell selection.

This step specifies shell: powershell (Windows PowerShell 5.1), while the rest of the workflow uses shell: pwsh (PowerShell Core). It is recommended to use pwsh consistently across all steps for uniform behavior, as both shells fully support the Chocolatey commands and syntax used here.

♻️ Proposed consistency fix
       - name: Install System Dependencies
-        shell: powershell
+        shell: pwsh
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/windows_build.yml around lines 26 - 27, Update the
“Install System Dependencies” workflow step to use shell `pwsh` instead of
`powershell`, matching the shell selection used throughout the workflow while
preserving its existing Chocolatey commands.

16-19: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low value

Disable credential persistence to improve security posture.

It is a security best practice to set persist-credentials: false when checking out the code, especially for public repositories. This ensures that the GitHub API token is not left lingering in the local Git configuration, eliminating the risk of it being inadvertently read or exported by subsequent build scripts or uploaded artifacts.

🛡️ Proposed fix to secure the checkout
       - name: Checkout Source Code
         uses: actions/checkout@v4
         with:
           submodules: recursive
+          persist-credentials: false
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/windows_build.yml around lines 16 - 19, Update the
“Checkout Source Code” step using actions/checkout@v4 to set persist-credentials
to false, while preserving the existing recursive submodules configuration.

Source: Linters/SAST tools


48-64: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Consider using sccache for native Windows caching stability.

The hendrikmuhs/ccache-action documentation explicitly recommends sccache for stable caching on Windows. The standard ccache distribution provided by the action relies on MSYS2, which can occasionally introduce path translation quirks or certificate issues in native Windows CI pipelines.

If you adopt this, ensure both the action variant and the CMake compiler launchers are updated to use sccache.

♻️ Proposed refactoring to use sccache
       - name: Cache Build Artifacts
         uses: hendrikmuhs/ccache-action@v1.2
         with:
-          key: ${{ runner.os }}-ccache-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
+          variant: sccache
+          key: ${{ runner.os }}-sccache-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
           restore-keys: |
-            ${{ runner.os }}-ccache-
+            ${{ runner.os }}-sccache-
           max-size: "500M"
 
       - name: Configure Build System
         shell: pwsh
         run: |
           cmake --preset debug `
             -G Ninja `
             -DCMAKE_C_COMPILER=clang `
             -DCMAKE_CXX_COMPILER=clang++ `
-            -DCMAKE_C_COMPILER_LAUNCHER=ccache `
-            -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
+            -DCMAKE_C_COMPILER_LAUNCHER=sccache `
+            -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/windows_build.yml around lines 48 - 64, Replace the
Windows cache setup using hendrikmuhs/ccache-action and the ccache compiler
launchers with the action’s sccache-compatible variant. Update both
CMAKE_C_COMPILER_LAUNCHER and CMAKE_CXX_COMPILER_LAUNCHER in the Configure Build
System step to use sccache, while preserving the existing cache key and size
settings.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/windows_build.yml:
- Around line 32-36: Update the Vulkan version extraction in the PowerShell
block guarded by Test-Path so Get-ChildItem is coerced to an array before
selecting the first item's Name. Preserve the existing VULKAN_SDK and
GITHUB_PATH assignments while ensuring a single installed SDK directory yields
its complete version name rather than the first character.
- Around line 32-36: Update the Vulkan SDK version assignment in the Test-Path
block to use the full selected child item's Name rather than indexing the Name
string with [0]. Preserve selecting the installed SDK directory and use that
complete version when setting VULKAN_SDK and VULKAN_PATH.

---

Nitpick comments:
In @.github/workflows/windows_build.yml:
- Around line 26-27: Update the “Install System Dependencies” workflow step to
use shell `pwsh` instead of `powershell`, matching the shell selection used
throughout the workflow while preserving its existing Chocolatey commands.
- Around line 16-19: Update the “Checkout Source Code” step using
actions/checkout@v4 to set persist-credentials to false, while preserving the
existing recursive submodules configuration.
- Around line 48-64: Replace the Windows cache setup using
hendrikmuhs/ccache-action and the ccache compiler launchers with the action’s
sccache-compatible variant. Update both CMAKE_C_COMPILER_LAUNCHER and
CMAKE_CXX_COMPILER_LAUNCHER in the Configure Build System step to use sccache,
while preserving the existing cache key and size settings.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e7c9c4e0-3930-47c4-a305-dffa10953d2d

📥 Commits

Reviewing files that changed from the base of the PR and between da9ea3c and 24211a1.

📒 Files selected for processing (1)
  • .github/workflows/windows_build.yml

Comment on lines +32 to +36
if (Test-Path "C:\VulkanSDK") {
$vulkanVersion = (Get-ChildItem "C:\VulkanSDK").Name[0]
echo "VULKAN_SDK=C:\VulkanSDK\$vulkanVersion" >> $env:GITHUB_ENV
echo "C:\VulkanSDK\$vulkanVersion\Bin" >> $env:GITHUB_PATH
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Fix PowerShell array indexing bug to prevent invalid Vulkan SDK paths.

In PowerShell, when Get-ChildItem returns a single item (which is standard after a clean Vulkan SDK install), it returns a single DirectoryInfo object instead of an array. Accessing the .Name property returns a string, and [0] extracts the first character of that string (e.g., "1" instead of "1.3.268.0"). This results in a broken environment path like C:\VulkanSDK\1.

Coerce the result into an array using @(...) to ensure consistent indexing behavior regardless of the number of child items.

🐛 Proposed fix for the path extraction
           # Add Vulkan SDK paths to environment
           if (Test-Path "C:\VulkanSDK") {
-              $vulkanVersion = (Get-ChildItem "C:\VulkanSDK").Name[0]
+              $vulkanVersion = @(Get-ChildItem "C:\VulkanSDK")[0].Name
               echo "VULKAN_SDK=C:\VulkanSDK\$vulkanVersion" >> $env:GITHUB_ENV
               echo "C:\VulkanSDK\$vulkanVersion\Bin" >> $env:GITHUB_PATH
           }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (Test-Path "C:\VulkanSDK") {
$vulkanVersion = (Get-ChildItem "C:\VulkanSDK").Name[0]
echo "VULKAN_SDK=C:\VulkanSDK\$vulkanVersion" >> $env:GITHUB_ENV
echo "C:\VulkanSDK\$vulkanVersion\Bin" >> $env:GITHUB_PATH
}
if (Test-Path "C:\VulkanSDK") {
$vulkanVersion = @(Get-ChildItem "C:\VulkanSDK")[0].Name
echo "VULKAN_SDK=C:\VulkanSDK\$vulkanVersion" >> $env:GITHUB_ENV
echo "C:\VulkanSDK\$vulkanVersion\Bin" >> $env:GITHUB_PATH
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/windows_build.yml around lines 32 - 36, Update the Vulkan
version extraction in the PowerShell block guarded by Test-Path so Get-ChildItem
is coerced to an array before selecting the first item's Name. Preserve the
existing VULKAN_SDK and GITHUB_PATH assignments while ensuring a single
installed SDK directory yields its complete version name rather than the first
character.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify PowerShell string indexing behavior when only one item is present.

pwsh -Command '
  New-Item -ItemType Directory -Path "TestVulkan\1.3.261.0" -Force | Out-Null;
  $vulkanVersion = (Get-ChildItem "TestVulkan").Name[0];
  Write-Host "Extracted version: $vulkanVersion";
  if ($vulkanVersion -eq "1") { Write-Host "BUG DETECTED" } else { Write-Host "OK" }
'

Repository: Redot-Engine/DraconicEngine

Length of output: 199


Avoid indexing the Vulkan SDK name

If Get-ChildItem "C:\VulkanSDK" returns a single folder, .Name[0] takes the first character of that folder name (1 from 1.3.261.0), so VULKAN_SDK points to C:\VulkanSDK\1 instead of the installed SDK version. Use the full name (or explicitly select the first item before reading .Name).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/windows_build.yml around lines 32 - 36, Update the Vulkan
SDK version assignment in the Test-Path block to use the full selected child
item's Name rather than indexing the Name string with [0]. Preserve selecting
the installed SDK directory and use that complete version when setting
VULKAN_SDK and VULKAN_PATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant