Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
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. 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" -p:TargetFrameworkVersion=v4.8 -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
4 changes: 2 additions & 2 deletions TicTacToe/TicTacToeTests/TicTacToeGameTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 0 additions & 33 deletions azure-pipelines.yml

This file was deleted.

Loading