Skip to content

Add CI workflow for C++ GSDK unit tests on PRs#192

Merged
dgkanatsios merged 5 commits intomainfrom
copilot/add-ci-workflow-cpp-testing
Mar 3, 2026
Merged

Add CI workflow for C++ GSDK unit tests on PRs#192
dgkanatsios merged 5 commits intomainfrom
copilot/add-ci-workflow-cpp-testing

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

What this PR does / why we need it:

Adds a GitHub Actions workflow to validate C++ changes on PRs, mirroring the C# CI workflow from #191.

  • Triggers on PRs modifying cpp/** or the workflow file itself
  • Runs on windows-latest (required — unit tests use VS CppUnitTest framework)
  • Builds only the unit test project via /t:GSDK_CPP_UnitTests (which also builds its GSDK_CPP_Windows dependency via ProjectReference)
  • Overrides WindowsTargetPlatformVersion=10.0 to use the latest installed Windows SDK (vcxproj files pin 10.0.17134.0 which is not available on windows-latest runners)
  • Adds libcurl and OpenSSL DLL directories to PATH for test runtime (test DLL has import dependencies on libcurl.dll)
  • Runs the existing unit tests via vstest.console.exe
  • Minimal permissions (contents: read)
  • Fixes Assert::AreEqual type mismatch in gsdkTests.cpp (int literal vs uint32_t field) for modern MSVC compiler compatibility
  • Fixes JSON key casing in GameState_MaintV2_CallbackInvoked test data to match the C++ parsing code (camelCase), consistent with the Java SDK wire format

Special notes for your reviewer:

The test DLL output path (cpp\x64\Release\GSDKCPPUnitTests\) is set by OutputSubDir in the vcxproj, not the source directory name (unittests/).

vstest.console.exe is located dynamically via vswhere.exe for robustness across VS versions on GitHub-hosted runners.

The vcxproj files pin WindowsTargetPlatformVersion to 10.0.17134.0, which is not available on current windows-latest runners. The MSBuild command overrides this with 10.0 to use the latest installed SDK without modifying the project files.

The build targets only GSDK_CPP_UnitTests via /t:GSDK_CPP_UnitTests rather than the full solution. Building the full solution fails because cppWindowsTestApp has a pre-existing deprecation warning (C4996 for registerMaintenanceCallback) treated as error with modern MSVC. Scoping the build avoids this unrelated failure while still building the SDK library dependency through ProjectReference.

The gsdkTests.cpp fix changes Assert::AreEqual(3600, ...) to Assert::AreEqual(3600u, ...) to match the uint32_t m_durationInSeconds field type, which newer MSVC compilers enforce strictly.

The GameState_MaintV2_CallbackInvoked test JSON used PascalCase keys (e.g., "DocumentIncarnation", "EventId") but the C++ parsing code in gsdk.cpp uses camelCase (e.g., "documentIncarnation", "eventId"), matching the Java SDK's Gson field naming. Updated the test data to use the correct camelCase keys. "Events" and "Resources" remain PascalCase as both the code and Java SDK (via @SerializedName) use PascalCase for these two fields.

If applicable:

  • this PR contains documentation
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Copilot AI changed the title [WIP] Add CI workflow for C++ changes with unit tests Add CI workflow for C++ GSDK unit tests on PRs Mar 3, 2026
@dgkanatsios
Copy link
Contributor

@copilot can you make sure the GitHub Action succeeds?

…ests

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot can you make sure the GitHub Action succeeds?

Fixed two issues in cee72e6:

  1. Build failure (MSB8036: The Windows SDK version 10.0.17134.0 was not found): The vcxproj files pin WindowsTargetPlatformVersion to 10.0.17134.0, which isn't available on windows-latest. Added /p:WindowsTargetPlatformVersion=10.0 to the MSBuild command to use the latest installed SDK.

  2. Test runtime DLLs: The test DLL links against libcurl.lib (import library), so libcurl.dll and OpenSSL DLLs are needed at runtime. Added those dependency directories to PATH in the test step.

The new workflow run (run #2) shows action_required — it needs your approval to execute since the workflow file itself is being added in this PR.

@dgkanatsios
Copy link
Contributor

@copilot this still fails. Can you make sure you don't stop working on it till the pipeline succeeds?

…in test

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot this still fails. Can you make sure you don't stop working on it till the pipeline succeeds?

Fixed both build errors in 4acaa02:

  1. gsdkTests.cpp:230 type mismatch (error C2665): Assert::AreEqual(3600, ...) where m_durationInSeconds is uint32_t — changed to 3600u.

  2. cppWindowsTestApp deprecation error (error C4996): Scoped the build to only the unit test project via /t:GSDK_CPP_UnitTests instead of building the whole solution. This still builds the GSDK_CPP_Windows dependency through ProjectReference.

The latest run (run #3) shows action_required — it needs your approval to execute since this PR modifies the workflow file.

@dgkanatsios
Copy link
Contributor

@copilot build succeeds now but tests fail. Can you fix them?

Copilot stopped work on behalf of dgkanatsios due to an error March 3, 2026 22:19
@dgkanatsios
Copy link
Contributor

@copilot can you try again?

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot can you try again?

Fixed in 9c973af. The GameState_MaintV2_CallbackInvoked test was failing because the test JSON used PascalCase keys (e.g., "DocumentIncarnation", "EventId") but the C++ parsing code in gsdk.cpp uses camelCase (e.g., "documentIncarnation", "eventId"), consistent with the Java SDK's wire format. Updated all mismatched keys in the test JSON to match the code.

@dgkanatsios dgkanatsios marked this pull request as ready for review March 3, 2026 22:36
@dgkanatsios dgkanatsios merged commit 6d3125f into main Mar 3, 2026
2 checks passed
@dgkanatsios dgkanatsios deleted the copilot/add-ci-workflow-cpp-testing branch March 3, 2026 22:49
Copilot AI added a commit that referenced this pull request Mar 19, 2026
* Initial plan

* Add CI workflow for C++ GSDK unit tests on PRs

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>

* Fix CI: override WindowsTargetPlatformVersion and add DLL paths for tests

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>

* Fix CI: target only unit test project and fix uint32_t type mismatch in test

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>

* Fix test JSON keys to match C++ parsing code casing (camelCase)

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
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.

2 participants