From 3fadc337676e11cd2e867f461903876ec79b2dee Mon Sep 17 00:00:00 2001 From: Bobbah <10467687+bobbah@users.noreply.github.com> Date: Thu, 26 Feb 2026 21:51:37 -0400 Subject: [PATCH 1/2] Update to .NET 10; replace xunit with tunit for tests --- .github/workflows/ci.yml | 6 +- .github/workflows/release.yml | 6 +- CentCom.API/CentCom.API.csproj | 16 ++--- CentCom.API/Startup.cs | 4 +- CentCom.Common/CentCom.Common.csproj | 17 ++--- CentCom.Exporter/CentCom.Exporter.csproj | 8 +-- CentCom.Server/CentCom.Server.csproj | 44 ++++++------ CentCom.Server/External/Raw/TgRawBan.cs | 2 +- CentCom.Server/Services/HttpBanService.cs | 6 +- .../BanServices/BeeBanServiceTests.cs | 13 ++-- CentCom.Test/Ban_EqualsShould.cs | 68 +++++++++---------- CentCom.Test/Ban_GetCanonicalKeyShould.cs | 14 ++-- CentCom.Test/CKeyTests.cs | 27 ++++---- CentCom.Test/CentCom.Test.csproj | 17 ++--- CentCom.Test/JobBan_EqualsShould.cs | 25 ++++--- CentCom.Test/RestBanTests.cs | 16 ++--- Directory.Build.props | 2 +- 17 files changed, 141 insertions(+), 150 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 386ac06..0ff82d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,10 @@ jobs: run: | echo "PRNumber=${{ github.event.pull_request.number }}" >> "$GITHUB_ENV" if: github.event_name == 'pull_request' - - uses: actions/setup-dotnet@v3 + - uses: actions/setup-dotnet@v5 with: - dotnet-version: 9.0.102 - - uses: actions/checkout@v3 + dotnet-version: 10.0.x + - uses: actions/checkout@v6 with: fetch-depth: 0 - name: Restore dependencies diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d43ff9c..58333e4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,11 +10,11 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v5 with: - dotnet-version: 9.0.102 + dotnet-version: 10.0.x - name: Checkout source - uses: actions/checkout@v3 + uses: actions/checkout@v6 - name: Prepare publish artifacts run: | dotnet publish CentCom.API -o publish/linux-x64/CentCom.API/ -r "linux-x64" --self-contained false -c Release --nologo diff --git a/CentCom.API/CentCom.API.csproj b/CentCom.API/CentCom.API.csproj index 093182b..af7ffe6 100644 --- a/CentCom.API/CentCom.API.csproj +++ b/CentCom.API/CentCom.API.csproj @@ -7,17 +7,17 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + + + diff --git a/CentCom.API/Startup.cs b/CentCom.API/Startup.cs index 092c681..910d994 100644 --- a/CentCom.API/Startup.cs +++ b/CentCom.API/Startup.cs @@ -11,7 +11,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; namespace CentCom.API; @@ -60,7 +60,7 @@ public void ConfigureServices(IServiceCollection services) { Title = "CentCom", Version = statusService.GetVersion().ToString(), - Description = "An API for accesing CentCom, a central ban intelligence service for Space Station 13 servers" + Description = "An API for accessing CentCom, a central ban intelligence service for Space Station 13 servers" }); // Set the comments path for the Swagger JSON and UI. diff --git a/CentCom.Common/CentCom.Common.csproj b/CentCom.Common/CentCom.Common.csproj index 606643d..7ea7094 100644 --- a/CentCom.Common/CentCom.Common.csproj +++ b/CentCom.Common/CentCom.Common.csproj @@ -1,18 +1,19 @@  - + - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + + diff --git a/CentCom.Exporter/CentCom.Exporter.csproj b/CentCom.Exporter/CentCom.Exporter.csproj index ad2358a..c5ebd56 100644 --- a/CentCom.Exporter/CentCom.Exporter.csproj +++ b/CentCom.Exporter/CentCom.Exporter.csproj @@ -5,10 +5,10 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/CentCom.Server/CentCom.Server.csproj b/CentCom.Server/CentCom.Server.csproj index c12ae17..937ed6e 100644 --- a/CentCom.Server/CentCom.Server.csproj +++ b/CentCom.Server/CentCom.Server.csproj @@ -10,34 +10,34 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - + + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - + + + + + + + + + + diff --git a/CentCom.Server/External/Raw/TgRawBan.cs b/CentCom.Server/External/Raw/TgRawBan.cs index 464b32b..1f16370 100644 --- a/CentCom.Server/External/Raw/TgRawBan.cs +++ b/CentCom.Server/External/Raw/TgRawBan.cs @@ -54,7 +54,7 @@ public class TgRawBan : IRawBan public TgUser Target { get; set; } [JsonPropertyName("unbanner")] - public TgUser? Unbanner { get; set; } + public TgUser Unbanner { get; set; } [JsonPropertyName("roles")] public List Roles { get; set; } diff --git a/CentCom.Server/Services/HttpBanService.cs b/CentCom.Server/Services/HttpBanService.cs index f152ac4..e883f54 100644 --- a/CentCom.Server/Services/HttpBanService.cs +++ b/CentCom.Server/Services/HttpBanService.cs @@ -42,11 +42,11 @@ protected void ConfigureClient() protected void SetBaseAddress(string address) => _httpClient.BaseAddress = new Uri(address); - protected async Task GetAsync(string endpoint, Dictionary? queryParams = null, - JsonSerializerOptions? options = null) => + protected async Task GetAsync(string endpoint, Dictionary queryParams = null, + JsonSerializerOptions options = null) => JsonSerializer.Deserialize(await GetAsStringAsync(endpoint, queryParams), options ?? JsonOptions); - protected async Task GetAsStringAsync(string endpoint, Dictionary? queryParams = null) + protected async Task GetAsStringAsync(string endpoint, Dictionary queryParams = null) { var url = queryParams is not null ? QueryHelpers.AddQueryString(endpoint, queryParams) : endpoint; var response = await _httpClient.GetAsync(url); diff --git a/CentCom.Test/BanServices/BeeBanServiceTests.cs b/CentCom.Test/BanServices/BeeBanServiceTests.cs index fb71b0c..3e9833e 100644 --- a/CentCom.Test/BanServices/BeeBanServiceTests.cs +++ b/CentCom.Test/BanServices/BeeBanServiceTests.cs @@ -1,26 +1,23 @@ -using System.Net.Http; -using System.Threading.Tasks; using CentCom.Server.Services; -using Xunit; namespace CentCom.Test.BanServices; public class BeeBanServiceTests { - [Fact] + [Test] public async Task BeeBans_ShouldGetPages() { var toTest = new BeeBanService(new HttpClient(), null); var result = await toTest.GetNumberOfPagesAsync(); - Assert.NotEqual(0, result); + await Assert.That(result).IsNotEqualTo(0); } - [Fact] + [Test] public async Task BeeBans_ShouldGetBans() { var toTest = new BeeBanService(new HttpClient(), null); var result = await toTest.GetBansAsync(); - Assert.NotNull(result); - Assert.NotEmpty(result); + await Assert.That(result).IsNotNull(); + await Assert.That(result).IsNotEmpty(); } } \ No newline at end of file diff --git a/CentCom.Test/Ban_EqualsShould.cs b/CentCom.Test/Ban_EqualsShould.cs index 133998c..3a20788 100644 --- a/CentCom.Test/Ban_EqualsShould.cs +++ b/CentCom.Test/Ban_EqualsShould.cs @@ -1,15 +1,13 @@ -using System; -using CentCom.Common.Extensions; +using CentCom.Common.Extensions; using CentCom.Common.Models; using CentCom.Common.Models.Equality; -using Xunit; namespace CentCom.Test; public class Ban_EqualsShould { - [Fact] - public void Equals_SameBanDifferentID_ReturnTrue() + [Test] + public async Task Equals_SameBanDifferentID_ReturnTrue() { var source = new BanSource { @@ -44,12 +42,12 @@ public void Equals_SameBanDifferentID_ReturnTrue() }; var comparer = BanEqualityComparer.Instance; - Assert.True(comparer.Equals(banA, banB), "Two bans equal by internal values should be equal"); - Assert.True(comparer.GetHashCode(banA) == comparer.GetHashCode(banB), "Two bans equal by internal values should have equal hashcodes"); + await Assert.That(comparer.Equals(banA, banB)).IsTrue().Because("Two bans equal by internal values should be equal"); + await Assert.That(comparer.GetHashCode(banA)).IsEqualTo(comparer.GetHashCode(banB)).Because("Two bans equal by internal values should have equal hashcodes"); } - [Fact] - public void Equals_SameBanDifferentIDDifferentSource_ReturnFalse() + [Test] + public async Task Equals_SameBanDifferentIDDifferentSource_ReturnFalse() { var sourceA = new BanSource { @@ -92,12 +90,12 @@ public void Equals_SameBanDifferentIDDifferentSource_ReturnFalse() }; var comparer = BanEqualityComparer.Instance; - Assert.False(comparer.Equals(banA, banB), "Two bans from different sources should not be equal by internal values"); - Assert.False(comparer.GetHashCode(banA) == comparer.GetHashCode(banB), "Two bans from different sources should not have equal hashcodes"); + await Assert.That(comparer.Equals(banA, banB)).IsFalse().Because("Two bans from different sources should not be equal by internal values"); + await Assert.That(comparer.GetHashCode(banA)).IsNotEqualTo(comparer.GetHashCode(banB)).Because("Two bans from different sources should not have equal hashcodes"); } - [Fact] - public void Equals_SameBanByBanID_ReturnTrue() + [Test] + public async Task Equals_SameBanByBanID_ReturnTrue() { var banA = new Ban { @@ -112,12 +110,12 @@ public void Equals_SameBanByBanID_ReturnTrue() }; var comparer = BanEqualityComparer.Instance; - Assert.True(comparer.Equals(banA, banB), "Two bans with BanIDs should be checked for equality by ID"); - Assert.True(comparer.GetHashCode(banA) == comparer.GetHashCode(banB), "Two bans with BanIDs that are equal should have equal hashcodes"); + await Assert.That(comparer.Equals(banA, banB)).IsTrue().Because("Two bans with BanIDs should be checked for equality by ID"); + await Assert.That(comparer.GetHashCode(banA)).IsEqualTo(comparer.GetHashCode(banB)).Because("Two bans with BanIDs that are equal should have equal hashcodes"); } - [Fact] - public void Equals_SameBanIDDifferentSource_ReturnFalse() + [Test] + public async Task Equals_SameBanIDDifferentSource_ReturnFalse() { var sourceA = new BanSource { @@ -152,12 +150,12 @@ public void Equals_SameBanIDDifferentSource_ReturnFalse() }; var comparer = BanEqualityComparer.Instance; - Assert.False(comparer.Equals(banA, banB), "Two bans from different sources should not be equal by BanID"); - Assert.False(comparer.GetHashCode(banA) == comparer.GetHashCode(banB), "Two bans from different sources should not have equal hashcodes"); + await Assert.That(comparer.Equals(banA, banB)).IsFalse().Because("Two bans from different sources should not be equal by BanID"); + await Assert.That(comparer.GetHashCode(banA)).IsNotEqualTo(comparer.GetHashCode(banB)).Because("Two bans from different sources should not have equal hashcodes"); } - [Fact] - public void Equals_SameBanDifferentJobOrder_ReturnTrue() + [Test] + public async Task Equals_SameBanDifferentJobOrder_ReturnTrue() { var banA = new Ban { @@ -174,12 +172,12 @@ public void Equals_SameBanDifferentJobOrder_ReturnTrue() banB.AddJobRange(new[] { "head of security", "warden", "detective", "security officer" }); var comparer = BanEqualityComparer.Instance; - Assert.True(comparer.Equals(banA, banB), "Two bans with the same jobbans in different orders should be equal"); - Assert.True(comparer.GetHashCode(banA) == comparer.GetHashCode(banB), "Two bans with the same jobbans in different orders should be equal"); + await Assert.That(comparer.Equals(banA, banB)).IsTrue().Because("Two bans with the same jobbans in different orders should be equal"); + await Assert.That(comparer.GetHashCode(banA)).IsEqualTo(comparer.GetHashCode(banB)).Because("Two bans with the same jobbans in different orders should be equal"); } - [Fact] - public void Equals_SameBanNullVsEmptyJobBans_ReturnTrue() + [Test] + public async Task Equals_SameBanNullVsEmptyJobBans_ReturnTrue() { var banA = new Ban { @@ -197,12 +195,12 @@ public void Equals_SameBanNullVsEmptyJobBans_ReturnTrue() }; var comparer = BanEqualityComparer.Instance; - Assert.True(comparer.Equals(banA, banB), "Bans should be equal if the jobbans only differ by null and an empty set"); - Assert.True(comparer.GetHashCode(banA) == comparer.GetHashCode(banB), "Bans should have the same hashcode if the jobbans only differ by null and an empty set"); + await Assert.That(comparer.Equals(banA, banB)).IsTrue().Because("Bans should be equal if the jobbans only differ by null and an empty set"); + await Assert.That(comparer.GetHashCode(banA)).IsEqualTo(comparer.GetHashCode(banB)).Because("Bans should have the same hashcode if the jobbans only differ by null and an empty set"); } - [Fact] - public void Equals_SameBanDifferingAttributes_ReturnFalse() + [Test] + public async Task Equals_SameBanDifferingAttributes_ReturnFalse() { var banA = new Ban { @@ -218,12 +216,12 @@ public void Equals_SameBanDifferingAttributes_ReturnFalse() banB.AddAttribute(BanAttribute.BeeStationGlobal); var comparer = BanEqualityComparer.Instance; - Assert.False(comparer.Equals(banA, banB), "Bans should not be equal if they differ in attributes"); - Assert.False(comparer.GetHashCode(banA) == comparer.GetHashCode(banB), "Bans should not have the same hashcode if they differ in attributes"); + await Assert.That(comparer.Equals(banA, banB)).IsFalse().Because("Bans should not be equal if they differ in attributes"); + await Assert.That(comparer.GetHashCode(banA)).IsNotEqualTo(comparer.GetHashCode(banB)).Because("Bans should not have the same hashcode if they differ in attributes"); } - [Fact] - public void Equals_SameBanSameAttributes_ReturnTrue() + [Test] + public async Task Equals_SameBanSameAttributes_ReturnTrue() { var banA = new Ban { @@ -240,7 +238,7 @@ public void Equals_SameBanSameAttributes_ReturnTrue() banB.AddAttribute(BanAttribute.BeeStationGlobal); var comparer = BanEqualityComparer.Instance; - Assert.True(comparer.Equals(banA, banB), "Bans should be equal when they are equal including attributes"); - Assert.True(comparer.GetHashCode(banA) == comparer.GetHashCode(banB), "Bans should have the same hashcode if they are equal including attributes"); + await Assert.That(comparer.Equals(banA, banB)).IsTrue().Because("Bans should be equal when they are equal including attributes"); + await Assert.That(comparer.GetHashCode(banA)).IsEqualTo(comparer.GetHashCode(banB)).Because("Bans should have the same hashcode if they are equal including attributes"); } } \ No newline at end of file diff --git a/CentCom.Test/Ban_GetCanonicalKeyShould.cs b/CentCom.Test/Ban_GetCanonicalKeyShould.cs index 7afc4c5..47a70ce 100644 --- a/CentCom.Test/Ban_GetCanonicalKeyShould.cs +++ b/CentCom.Test/Ban_GetCanonicalKeyShould.cs @@ -1,19 +1,17 @@ -using System; -using CentCom.Common; -using Xunit; +using CentCom.Common; namespace CentCom.Test; public class Ban_GetCanonicalKeyShould { - [Fact] - public void GetCanonicalKey_FromRaw_ReturnTrue() + [Test] + public async Task GetCanonicalKey_FromRaw_ReturnTrue() { - var rawKey = "B o bbahbrown"; - Assert.True("bobbahbrown" == KeyUtilities.GetCanonicalKey(rawKey)); + const string rawKey = "B o bbahbrown"; + await Assert.That(KeyUtilities.GetCanonicalKey(rawKey)).IsEqualTo("bobbahbrown"); } - [Fact] + [Test] public void GetCanonicalKey_NullArgument_ThrowsException() { Assert.Throws(() => KeyUtilities.GetCanonicalKey(null)); diff --git a/CentCom.Test/CKeyTests.cs b/CentCom.Test/CKeyTests.cs index 466f1bb..524b045 100644 --- a/CentCom.Test/CKeyTests.cs +++ b/CentCom.Test/CKeyTests.cs @@ -4,39 +4,36 @@ using CentCom.Common.Models.Byond; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; -using Xunit; namespace CentCom.Test; public class CKeyTests { - [Fact] - public void CKeyShouldCreate() + [Test] + public async Task CKeyShouldCreate() { ICKey ckey = new CKey("Bobbahbrown"); - Assert.Equal("bobbahbrown", ckey.CanonicalKey); + await Assert.That(ckey.CanonicalKey).IsEqualTo("bobbahbrown"); } - [Fact] - public void CKeyShouldCreateFromStringImplicitly() + [Test] + public async Task CKeyShouldCreateFromStringImplicitly() { CKey ckey = "Bobbahbrown"; - Assert.Equal("bobbahbrown", ckey.CanonicalKey); + await Assert.That(ckey.CanonicalKey).IsEqualTo("bobbahbrown"); } - [Fact] - public void CKeyShouldSerialize() + [Test] + public async Task CKeyShouldSerialize() { var options = GetOptions(); ICKey ckey = new CKey("Bobbahbrown"); var serialized = JsonSerializer.Serialize(ckey, options); var deserialized = JsonSerializer.Deserialize(serialized, options); - Assert.Equal("bobbahbrown", deserialized?.CanonicalKey); + await Assert.That(deserialized?.CanonicalKey).IsEqualTo("bobbahbrown"); } - private static JsonSerializerOptions GetOptions() - { - return (new ServiceCollection()).AddCentComSerialization().BuildServiceProvider() - .GetRequiredService>().Value; - } + private static JsonSerializerOptions GetOptions() => + (new ServiceCollection()).AddCentComSerialization().BuildServiceProvider() + .GetRequiredService>().Value; } \ No newline at end of file diff --git a/CentCom.Test/CentCom.Test.csproj b/CentCom.Test/CentCom.Test.csproj index 4ecf0ff..edae076 100644 --- a/CentCom.Test/CentCom.Test.csproj +++ b/CentCom.Test/CentCom.Test.csproj @@ -1,24 +1,19 @@ + Exe false + enable + enable - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/CentCom.Test/JobBan_EqualsShould.cs b/CentCom.Test/JobBan_EqualsShould.cs index f93c62d..3749caf 100644 --- a/CentCom.Test/JobBan_EqualsShould.cs +++ b/CentCom.Test/JobBan_EqualsShould.cs @@ -1,13 +1,12 @@ using CentCom.Common.Models; using CentCom.Common.Models.Equality; -using Xunit; namespace CentCom.Test; public class JobBan_EqualsShould { - [Fact] - public void Equals_SameJobBan_ReturnTrue() + [Test] + public async Task Equals_SameJobBan_ReturnTrue() { var jobA = new JobBan { @@ -22,8 +21,12 @@ public void Equals_SameJobBan_ReturnTrue() }; var comparer = JobBanEqualityComparer.Instance; - Assert.True(comparer.Equals(jobA, jobB), "Two jobs equal by internal values should be equal"); - Assert.True(comparer.GetHashCode(jobA) == comparer.GetHashCode(jobB), "Two jobs equal by internal values should have the same hashcode"); + await Assert.That(comparer.Equals(jobA, jobB)) + .IsTrue() + .Because("Two jobs equal by internal values should be equal"); + await Assert.That(comparer.GetHashCode(jobA)) + .IsEqualTo(comparer.GetHashCode(jobB)) + .Because("Two jobs equal by internal values should have the same hashcode"); } /// @@ -31,8 +34,8 @@ public void Equals_SameJobBan_ReturnTrue() /// bans that have been parsed, we shouldn't consider ban id for /// job ban equality as semantically it would never be practiced. /// - [Fact] - public void Equals_SameJobBan_DifferentID_ReturnTrue() + [Test] + public async Task Equals_SameJobBan_DifferentID_ReturnTrue() { var jobA = new JobBan { @@ -47,7 +50,11 @@ public void Equals_SameJobBan_DifferentID_ReturnTrue() }; var comparer = JobBanEqualityComparer.Instance; - Assert.True(comparer.Equals(jobA, jobB), "Two jobs equal by job, even with differing IDs, should be equal"); - Assert.True(comparer.GetHashCode(jobA) == comparer.GetHashCode(jobB), "Two jobs equal by job, even with differing ids, should have the same hashcode"); + await Assert.That(comparer.Equals(jobA, jobB)) + .IsTrue() + .Because("Two jobs equal by job, even with differing IDs, should be equal"); + await Assert.That(comparer.GetHashCode(jobA)) + .IsEqualTo(comparer.GetHashCode(jobB)) + .Because("Two jobs equal by job, even with differing ids, should have the same hashcode"); } } \ No newline at end of file diff --git a/CentCom.Test/RestBanTests.cs b/CentCom.Test/RestBanTests.cs index 557cd53..da20fc6 100644 --- a/CentCom.Test/RestBanTests.cs +++ b/CentCom.Test/RestBanTests.cs @@ -1,4 +1,3 @@ -using System; using System.Text.Json; using CentCom.Common.Abstract; using CentCom.Common.Extensions; @@ -7,14 +6,13 @@ using CentCom.Common.Models.Rest; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; -using Xunit; namespace CentCom.Test; public class RestBanTests { - [Fact] - public void CanCreateBan() + [Test] + public async Task CanCreateBan() { IRestBan ban = new RestBan( 1, @@ -27,11 +25,11 @@ public void CanCreateBan() null, new[] { new RestJobBan("Janitor") }, null); - Assert.NotNull(ban); + await Assert.That(ban).IsNotNull(); } - [Fact] - public void CanSerializeBan() + [Test] + public async Task CanSerializeBan() { IRestBan ban = new RestBan( 1, @@ -42,13 +40,13 @@ public void CanSerializeBan() "Test ban please ignore", null, null, - new[] { new RestJobBan("Janitor") }, + [new RestJobBan("Janitor")], null); var options = GetOptions(); var serialized = JsonSerializer.Serialize(ban, options); var deserialized = JsonSerializer.Deserialize(serialized, options); - Assert.NotNull(deserialized); + await Assert.That(deserialized).IsNotNull(); } private static JsonSerializerOptions GetOptions() => diff --git a/Directory.Build.props b/Directory.Build.props index ce757ee..2f96dbf 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - net9.0 + net10.0 MelonMesa and CentCom Contributors Copyright © $([System.DateTime]::Now.Year) MelonMesa and CentCom Contributors From 8c566a57a802f2cb47ddc446c3fd4925e4a76379 Mon Sep 17 00:00:00 2001 From: Bobbah <10467687+bobbah@users.noreply.github.com> Date: Thu, 26 Feb 2026 22:22:40 -0400 Subject: [PATCH 2/2] Add global JSON file to configure testing platform as well as improving how test results are reflected on PRs --- .github/workflows/ci.yml | 15 ++++++++++++--- global.json | 5 +++++ 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 global.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ff82d2..6aacace 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,10 @@ env: jobs: ci: name: ubuntu - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest + permissions: + checks: write + pull-requests: write # Required to comment on PRs steps: - name: Set PR number (Linux) run: | @@ -25,5 +28,11 @@ jobs: run: dotnet restore - name: Build run: dotnet build --no-restore - - name: Test - run: dotnet test --no-build --verbosity normal CentCom.Test/CentCom.Test.csproj --logger GitHubActions \ No newline at end of file + - name: Run tests + run: dotnet test --configuration Release -- --report-trx --results-directory ./TestResults + - name: Comment PR with results + if: always() + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + files: ./TestResults/*.trx + comment_mode: always \ No newline at end of file diff --git a/global.json b/global.json new file mode 100644 index 0000000..3140116 --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "test": { + "runner": "Microsoft.Testing.Platform" + } +}