Skip to content

Commit

Permalink
migration to dotnet 7
Browse files Browse the repository at this point in the history
  • Loading branch information
lkurzyniec committed Nov 16, 2022
1 parent 8f226fc commit 49769ef
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: 7.x

- name: Build sln
run: dotnet build -c Release --no-cache /clp:NoSummary ./HappyCode.NetCoreBoilerplate.sln
Expand All @@ -42,7 +42,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: 7.x

- name: Collect code coverage
run: dotnet test -c Release --filter FullyQualifiedName!~LoadTests /maxcpucount:1 /p:WarningLevel=0 /p:CollectCoverage=true /p:CoverletOutput="../" /p:MergeWith="../coverage.json" /p:CoverletOutputFormat=\"json,opencover\" ./HappyCode.NetCoreBoilerplate.sln
Expand Down
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project>
<PropertyGroup>
<LangVersion>10</LangVersion>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>11</LangVersion>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<Authors>Łukasz Kurzyniec</Authors>
<Copyright>Copyright © happy+code Łukasz Kurzyniec 2022</Copyright>
<Version>1.2.1</Version>
<Version>1.3.0</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
18 changes: 9 additions & 9 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<EnablePackageVersionOverride>false</EnablePackageVersionOverride>
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="AspNetCore.HealthChecks.MySql" Version="6.0.2" />
<PackageVersion Include="AspNetCore.HealthChecks.SqlServer" Version="6.0.2" />
Expand All @@ -14,19 +14,19 @@
<PackageVersion Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>

<ItemGroup>
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.10" />
<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.2" />
</ItemGroup>

<ItemGroup>
<PackageVersion Include="dbup-sqlserver" Version="4.6.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.1" />
</ItemGroup>

<ItemGroup>
<PackageVersion Include="AutoFixture" Version="4.17.0" />
<PackageVersion Include="AutoFixture.Xunit2" Version="4.17.0" />
Expand All @@ -36,29 +36,29 @@
</PackageVersion>
<PackageVersion Include="FluentAssertions" Version="6.8.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.10" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="6.0.10" />
<PackageVersion Include="MockQueryable.Moq" Version="6.0.1" />
<PackageVersion Include="Moq" Version="4.18.2" />
<PackageVersion Include="Moq.AutoMock" Version="3.4.0" />
<PackageVersion Include="NBomber.Http" Version="1.1.1" />
<PackageVersion Include="Verify.Http" Version="3.0.0" />
<PackageVersion Include="Verify.Xunit" Version="18.3.0" />
<PackageVersion Include="Verify.Http" Version="4.0.0" />
<PackageVersion Include="Verify.Xunit" Version="19.0.0" />
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
</ItemGroup>

<ItemGroup>
<GlobalPackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</GlobalPackageReference>
</ItemGroup>
<ItemGroup Condition="'$(ProjectName.EndsWith(`Tests`))' == 'False'">
<GlobalPackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.3.48">
<GlobalPackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.4.27">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</GlobalPackageReference>
Expand Down
7 changes: 7 additions & 0 deletions HappyCode.NetCoreBoilerplate.sln
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HappyCode.NetCoreBoilerplat
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HappyCode.NetCoreBoilerplate.Api.LoadTests", "test\HappyCode.NetCoreBoilerplate.Api.LoadTests\HappyCode.NetCoreBoilerplate.Api.LoadTests.csproj", "{E18EED63-7FDE-449B-9FA3-27FD677CD3FD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ci", "ci", "{C20F30D0-1383-4834-805F-6526300F4D2D}"
ProjectSection(SolutionItems) = preProject
.github\workflows\codeql-analysis.yml = .github\workflows\codeql-analysis.yml
.github\workflows\docker.yml = .github\workflows\docker.yml
.github\workflows\dotnetcore.yml = .github\workflows\dotnetcore.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# netcore-boilerplate

Boilerplate of API in ~~`.NET Core 3.1`~~ `.NET 6`
Boilerplate of API in ~~`.NET Core 3.1`~~ `.NET 7`

| GitHub | Codecov |
|:-------------:|:-------------:|
Expand Down
15 changes: 9 additions & 6 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /work

COPY ./Directory.Build.props ./
COPY ./Directory.Packages.props ./
COPY src/*/*.csproj ./
RUN for projectFile in $(ls *.csproj); \
do \
mkdir -p ${projectFile%.*}/ && mv $projectFile ${projectFile%.*}/; \
done
do \
mkdir -p ${projectFile%.*}/ && mv $projectFile ${projectFile%.*}/; \
done

ENV DOTNET_NOLOGO=true
ENV DOTNET_CLI_TELEMETRY_OPTOUT=true
Expand All @@ -15,6 +16,8 @@ RUN dotnet restore /work/HappyCode.NetCoreBoilerplate.Api/HappyCode.NetCoreBoile

COPY src .

# --------------

FROM build AS publish
WORKDIR /work/HappyCode.NetCoreBoilerplate.Api

Expand All @@ -23,9 +26,9 @@ ENV DOTNET_CLI_TELEMETRY_OPTOUT=true

RUN dotnet publish -c Release -o /app --no-restore

LABEL maintainer="Lukasz Kurzyniec ([email protected])"
# --------------

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS final
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS final
WORKDIR /app
COPY --from=publish /app .

Expand Down

0 comments on commit 49769ef

Please sign in to comment.