Skip to content

Commit 7b2db1a

Browse files
authored
update to .net8 & fix pr workflows for forked repos (#197)
* update to .net8 The patch updates the SDK version in the global.json file to 8.0.100, and removes the allowPrerelease flag. This patch might be necessary to ensure compatibility with the latest stable version of the SDK. * Update package references in projects, DRY test project imports * WebAPI - Disable AD0001 until first servicing release of .NET 8 * Workflow - test reporting - make it compatible with public repos
1 parent b76beb4 commit 7b2db1a

File tree

13 files changed

+74
-66
lines changed

13 files changed

+74
-66
lines changed

.github/workflows/dotnet.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ jobs:
3838
- name: Test
3939
run: dotnet test --no-build --no-restore --configuration Release --logger "trx;LogFileName=TestResults.trx"
4040

41+
# as per https://github.com/dorny/test-reporter?tab=readme-ov-file#recommended-setup-for-public-repositories
4142
- name: Test Report
42-
uses: dorny/test-reporter@v1
43+
uses: actions/upload-artifact@v3
4344
if: success() || failure() # run this step even if previous step failed
4445
with:
45-
name: Tests # Name of the check run which will be created
46-
path: "**/*.trx" # Path to test results
47-
reporter: dotnet-trx # Format of test results
46+
name: test-results
47+
path: "**/*.trx"

.github/workflows/test-report.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# as per https://github.com/dorny/test-reporter?tab=readme-ov-file#recommended-setup-for-public-repositories
2+
name: 'Test Report'
3+
4+
on:
5+
workflow_run:
6+
workflows: ['.NET'] # runs after .NET workflow
7+
types:
8+
- completed
9+
10+
permissions:
11+
contents: read
12+
actions: read
13+
checks: write
14+
15+
jobs:
16+
report:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: dorny/test-reporter@v1
20+
with:
21+
artifact: test-results # artifact name
22+
name: Tests # Name of the check run which will be created
23+
path: "**/*.trx" # Path to test results
24+
reporter: dotnet-trx # Format of test results

CleanArchitecture.sln

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
2323
EndProjectSection
2424
EndProject
2525
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{A388D69B-2789-4D2E-A6D9-331D8571DA7E}"
26+
ProjectSection(SolutionItems) = preProject
27+
tests\Directory.Build.Props = tests\Directory.Build.Props
28+
EndProjectSection
2629
EndProject
2730
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Architecture.Tests", "tests\Architecture.Tests\Architecture.Tests.csproj", "{526EDF1F-026F-41EC-9FC5-433243492515}"
2831
EndProject
File renamed without changes.

global.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"sdk": {
3-
"version": "8.0.100-rc.2.23502.2",
4-
"rollForward": "latestFeature",
5-
"allowPrerelease": true
3+
"version": "8.0.100",
4+
"rollForward": "latestFeature"
65
}
76
}

src/Application/Application.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
<PackageReference Include="Ardalis.Specification.EntityFrameworkCore" Version="7.0.0" />
1414
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
1515
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.8.0" />
16-
<PackageReference Include="MediatR" Version="12.1.1" />
17-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0-rc.2.23480.1" />
18-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0-rc.2.23479.6" />
19-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0-rc.2.23479.6" />
16+
<PackageReference Include="MediatR" Version="12.2.0" />
17+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
18+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
19+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
2020
</ItemGroup>
2121
</Project>

src/Infrastructure/Infrastructure.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
</ItemGroup>
1313
<ItemGroup>
1414
<PackageReference Include="Bogus" Version="34.0.2" />
15-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0-rc.2.23480.1" />
15+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
1616
</ItemGroup>
1717
</Project>

src/WebApi/WebApi.csproj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
9+
<!-- as per https://github.com/dotnet/aspnetcore/issues/50836#issuecomment-1819612514 -->
10+
<!-- recommendation from msft is to disable AD0001 until first servicing release of .net8 -->
11+
<NoWarn>$(NoWarn);AD0001</NoWarn>
912
</PropertyGroup>
1013
<ItemGroup>
1114
<InternalsVisibleTo Include="Application.IntegrationTests" />
@@ -20,10 +23,10 @@
2023
<PrivateAssets>all</PrivateAssets>
2124
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2225
</PackageReference>
23-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0-rc.2.23480.2" />
24-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0-rc.2.23480.1" />
25-
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="8.0.0-rc.2.23480.2" />
26-
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.0-rc.2.23480.2" />
26+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0" />
27+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0" />
28+
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="8.0.0" />
29+
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.0" />
2730
</ItemGroup>
2831
<ItemGroup>
2932
<ProjectReference Include="..\Application\Application.csproj" />

tests/Application.IntegrationTests/Application.IntegrationTests.csproj

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,17 @@
77
<Nullable>enable</Nullable>
88
<IsPackable>false</IsPackable>
99
</PropertyGroup>
10+
1011
<ItemGroup>
1112
<PackageReference Include="Bogus" Version="34.0.2" />
12-
<PackageReference Include="FluentAssertions" Version="6.12.0" />
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0-preview-23503-02" />
1413
<PackageReference Include="NSubstitute" Version="5.1.0" />
1514
<PackageReference Include="Respawn" Version="6.1.0" />
16-
<PackageReference Include="Testcontainers" Version="3.5.0" />
17-
<PackageReference Include="Testcontainers.SqlEdge" Version="3.5.0" />
18-
<PackageReference Include="xunit" Version="2.5.3" />
19-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
20-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
21-
<PrivateAssets>all</PrivateAssets>
22-
</PackageReference>
23-
<PackageReference Include="coverlet.collector" Version="6.0.0">
24-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
25-
<PrivateAssets>all</PrivateAssets>
26-
</PackageReference>
27-
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0-rc.2.23480.2" />
28-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0-rc.2.23479.6" />
15+
<PackageReference Include="Testcontainers" Version="3.6.0" />
16+
<PackageReference Include="Testcontainers.SqlEdge" Version="3.6.0" />
17+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0" />
18+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
2919
</ItemGroup>
20+
3021
<ItemGroup>
3122
<ProjectReference Include="..\..\src\WebApi\WebApi.csproj" />
3223
</ItemGroup>

tests/Application.UnitTests/Application.UnitTests.csproj

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,11 @@
77
<Nullable>enable</Nullable>
88
<IsPackable>false</IsPackable>
99
</PropertyGroup>
10+
1011
<ItemGroup>
1112
<PackageReference Include="Bogus" Version="34.0.2" />
12-
<PackageReference Include="FluentAssertions" Version="6.12.0" />
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0-preview-23503-02" />
14-
<PackageReference Include="xunit" Version="2.5.3" />
15-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
16-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
17-
<PrivateAssets>all</PrivateAssets>
18-
</PackageReference>
19-
<PackageReference Include="coverlet.collector" Version="6.0.0">
20-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
21-
<PrivateAssets>all</PrivateAssets>
22-
</PackageReference>
2313
</ItemGroup>
14+
2415
<ItemGroup>
2516
<ProjectReference Include="..\..\src\Application\Application.csproj" />
2617
</ItemGroup>

tests/Architecture.Tests/Architecture.Tests.csproj

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,11 @@
77
<Nullable>enable</Nullable>
88
<IsPackable>false</IsPackable>
99
</PropertyGroup>
10+
1011
<ItemGroup>
11-
<PackageReference Include="FluentAssertions" Version="6.12.0" />
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0-preview-23503-02" />
1312
<PackageReference Include="NetArchTest.Rules" Version="1.3.2" />
14-
<PackageReference Include="xunit" Version="2.5.3" />
15-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
16-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
17-
<PrivateAssets>all</PrivateAssets>
18-
</PackageReference>
19-
<PackageReference Include="coverlet.collector" Version="6.0.0">
20-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
21-
<PrivateAssets>all</PrivateAssets>
22-
</PackageReference>
2313
</ItemGroup>
14+
2415
<ItemGroup>
2516
<ProjectReference Include="..\..\src\Application\Application.csproj" />
2617
<ProjectReference Include="..\..\src\Domain\Domain.csproj" />

tests/Directory.Build.props

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project>
2+
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
3+
4+
<ItemGroup>
5+
<PackageReference Include="FluentAssertions" Version="6.12.0" />
6+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0-preview-23503-02" />
7+
<PackageReference Include="xunit" Version="2.6.2" />
8+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
9+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
10+
<PrivateAssets>all</PrivateAssets>
11+
</PackageReference>
12+
<PackageReference Include="coverlet.collector" Version="6.0.0">
13+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14+
<PrivateAssets>all</PrivateAssets>
15+
</PackageReference>
16+
</ItemGroup>
17+
</Project>

tests/Domain.UnitTests/Domain.UnitTests.csproj

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,13 @@
77
<Nullable>enable</Nullable>
88
<IsPackable>false</IsPackable>
99
</PropertyGroup>
10+
1011
<ItemGroup>
1112
<Compile Remove="TestResults\**" />
1213
<EmbeddedResource Remove="TestResults\**" />
1314
<None Remove="TestResults\**" />
1415
</ItemGroup>
15-
<ItemGroup>
16-
<PackageReference Include="FluentAssertions" Version="6.12.0" />
17-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0-preview-23503-02" />
18-
<PackageReference Include="xunit" Version="2.5.3" />
19-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
20-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
21-
<PrivateAssets>all</PrivateAssets>
22-
</PackageReference>
23-
<PackageReference Include="coverlet.collector" Version="6.0.0">
24-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
25-
<PrivateAssets>all</PrivateAssets>
26-
</PackageReference>
27-
</ItemGroup>
16+
2817
<ItemGroup>
2918
<ProjectReference Include="..\..\src\Domain\Domain.csproj" />
3019
</ItemGroup>

0 commit comments

Comments
 (0)