From 1faac3f54b79a877e87dd89f8268620502a02cd3 Mon Sep 17 00:00:00 2001 From: "Nikolay.IT" Date: Mon, 24 Aug 2026 16:26:56 +0300 Subject: [PATCH 1/3] Replace the Azure pipeline with a GitHub Actions build Builds the .NET Framework games with MSBuild, then builds and tests the .NET Core/5 solutions with the dotnet CLI, and drops azure-pipelines.yml. Claude-Session: https://claude.ai/code/session_01Nyppsn3VF6d1Sno5orPWiV --- .github/workflows/build.yml | 56 +++++++++++++++++++++++++++++++++++++ azure-pipelines.yml | 33 ---------------------- 2 files changed, 56 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 azure-pipelines.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7d7732c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,56 @@ +name: Build + +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + +jobs: + build: + name: Build and test + runs-on: windows-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - name: Setup NuGet + uses: NuGet/setup-nuget@v2 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 5.0.x + + # The six games in the root solution are old-style .NET Framework projects, + # so they need MSBuild rather than the dotnet CLI. + - name: Build the .NET Framework games + run: | + nuget restore CSharpConsoleGames.sln + msbuild CSharpConsoleGames.sln -p:Configuration=Release -p:Platform="Any CPU" -m + + - name: Build and test TicTacToe + run: dotnet test TicTacToe/TicTacToe.sln -c Release --logger "trx;LogFileName=test-results.trx" + + - name: Build Tetris (.NET Core) + run: dotnet build "Tetris (.NET Core)/Tetris.sln" -c Release + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-results + path: '**/TestResults/*.trx' + if-no-files-found: ignore diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 6a9684e..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,33 +0,0 @@ -# .NET Desktop -# Build and run tests for .NET Desktop or Windows classic desktop solutions. -# Add steps that publish symbols, save build artifacts, and more: -# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net - -trigger: -- master - -pool: - vmImage: 'windows-latest' - -variables: - solution: '**/*.sln' - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' - -steps: -- task: NuGetToolInstaller@1 - -- task: NuGetCommand@2 - inputs: - restoreSolution: '$(solution)' - -- task: VSBuild@1 - inputs: - solution: '$(solution)' - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' - -- task: VSTest@2 - inputs: - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' From 01f084c1aa890ed3c88a45b5a1315582d6fc5a28 Mon Sep 17 00:00:00 2001 From: "Nikolay.IT" Date: Mon, 24 Aug 2026 16:31:21 +0300 Subject: [PATCH 2/3] Retarget the .NET Framework games to 4.8 for the build The hosted runners no longer carry the v4.5 targeting pack. Claude-Session: https://claude.ai/code/session_01Nyppsn3VF6d1Sno5orPWiV --- .github/workflows/build.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7d7732c..4e0a7fe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,11 +35,14 @@ jobs: 5.0.x # The six games in the root solution are old-style .NET Framework projects, - # so they need MSBuild rather than the dotnet CLI. + # so they need MSBuild rather than the dotnet CLI. They target v4.5, whose + # targeting pack is no longer installed on the hosted runners, so the build + # retargets them to 4.8 (source-compatible for these console apps) instead + # of changing the projects. - name: Build the .NET Framework games run: | nuget restore CSharpConsoleGames.sln - msbuild CSharpConsoleGames.sln -p:Configuration=Release -p:Platform="Any CPU" -m + msbuild CSharpConsoleGames.sln -p:Configuration=Release -p:Platform="Any CPU" -p:TargetFrameworkVersion=v4.8 -m - name: Build and test TicTacToe run: dotnet test TicTacToe/TicTacToe.sln -c Release --logger "trx;LogFileName=test-results.trx" From aee1460941d86a901d33ca42250c081b3f35b773 Mon Sep 17 00:00:00 2001 From: "Nikolay.IT" Date: Mon, 24 Aug 2026 16:36:17 +0300 Subject: [PATCH 3/3] Assert on the winning symbol, not the result object PlayShouldReturnCorrectWinner compared a GameResult with a Symbol, so it could never pass; it was left behind when Play started returning GameResult. Claude-Session: https://claude.ai/code/session_01Nyppsn3VF6d1Sno5orPWiV --- TicTacToe/TicTacToeTests/TicTacToeGameTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TicTacToe/TicTacToeTests/TicTacToeGameTests.cs b/TicTacToe/TicTacToeTests/TicTacToeGameTests.cs index cdae633..bc0d190 100644 --- a/TicTacToe/TicTacToeTests/TicTacToeGameTests.cs +++ b/TicTacToe/TicTacToeTests/TicTacToeGameTests.cs @@ -40,8 +40,8 @@ public void PlayShouldReturnCorrectWinner() .Returns((Board x, Symbol s) => new Index(1, player2CurrentCol++)); var game = new TicTacToeGame(player1.Object, player2.Object); - var winner = game.Play(); - Assert.AreEqual(Symbol.X, winner); + var result = game.Play(); + Assert.AreEqual(Symbol.X, result.Winner); } // TODO: Add more tests