Add CI workflow for C++ GSDK unit tests on PRs#192
Conversation
Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
|
@copilot can you make sure the GitHub Action succeeds? |
…ests Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Fixed two issues in cee72e6:
The new workflow run (run #2) shows |
|
@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>
Fixed both build errors in 4acaa02:
The latest run (run #3) shows |
|
@copilot build succeeds now but tests fail. Can you fix them? |
|
@copilot can you try again? |
Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Fixed in 9c973af. The |
* 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>
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.
cpp/**or the workflow file itselfwindows-latest(required — unit tests use VS CppUnitTest framework)/t:GSDK_CPP_UnitTests(which also builds itsGSDK_CPP_Windowsdependency via ProjectReference)WindowsTargetPlatformVersion=10.0to use the latest installed Windows SDK (vcxproj files pin10.0.17134.0which is not available onwindows-latestrunners)libcurl.dll)vstest.console.execontents: read)Assert::AreEqualtype mismatch ingsdkTests.cpp(intliteral vsuint32_tfield) for modern MSVC compiler compatibilityGameState_MaintV2_CallbackInvokedtest data to match the C++ parsing code (camelCase), consistent with the Java SDK wire formatSpecial notes for your reviewer:
The test DLL output path (
cpp\x64\Release\GSDKCPPUnitTests\) is set byOutputSubDirin the vcxproj, not the source directory name (unittests/).vstest.console.exeis located dynamically viavswhere.exefor robustness across VS versions on GitHub-hosted runners.The vcxproj files pin
WindowsTargetPlatformVersionto10.0.17134.0, which is not available on currentwindows-latestrunners. The MSBuild command overrides this with10.0to use the latest installed SDK without modifying the project files.The build targets only
GSDK_CPP_UnitTestsvia/t:GSDK_CPP_UnitTestsrather than the full solution. Building the full solution fails becausecppWindowsTestApphas a pre-existing deprecation warning (C4996forregisterMaintenanceCallback) treated as error with modern MSVC. Scoping the build avoids this unrelated failure while still building the SDK library dependency through ProjectReference.The
gsdkTests.cppfix changesAssert::AreEqual(3600, ...)toAssert::AreEqual(3600u, ...)to match theuint32_t m_durationInSecondsfield type, which newer MSVC compilers enforce strictly.The
GameState_MaintV2_CallbackInvokedtest JSON used PascalCase keys (e.g.,"DocumentIncarnation","EventId") but the C++ parsing code ingsdk.cppuses 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:
💡 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.