Skip to content

Commit

Permalink
TEST-0010 Add NET 9 target, update packages and switch to project fol…
Browse files Browse the repository at this point in the history
…der (#368)

<!--- Provide a general summary of your changes in the Title above -->

## Description 💬
<!--- Describe your changes in detail -->

## Motivation and Context 🥅
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## How has this been tested? 🧪
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, tests ran to see how
-->
<!--- your change affects other areas of the code, etc. -->
- [ ] Local build ⚒️
- [ ] Local tests 🧪
- [ ] (optional) Local run and endpoint tested in swagger 🚀

## Screenshots (if appropriate) 💻

## Types of changes 🌊
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)

## Checklist ☑️

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] The pull request title starts with the jira case number (when
applicable), e.g. "TEST-1234 Add some feature"
- [ ] The person responsible for following up on requested review
changes has been assigned to the pull request
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.

## Highly optional checks, only use these if you have a reason to do so
✔️

- [ ] This PR changes the database so I have added the *create-diagram*
label to assist reviewers with a db diagram
- [ ] This PR changes platform or backend and I need others to be able
to test against these changes before merging to dev, so I have added the
*deploy-azure* label to deploy before merging the PR

## Checklist for the approver ✅

- [ ] I've checked the files view for spelling issues, code quality
warnings and similar
- [ ] I've waited until all checks have passed (green check/without
error)
- [ ] I've checked that only the intended files are changed
  • Loading branch information
hwinther authored Nov 13, 2024
1 parent bebc43b commit 4552901
Show file tree
Hide file tree
Showing 14 changed files with 646 additions and 638 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ concurrency:
cancel-in-progress: true

env:
DOTNET_VERSION: "8.0.x"
DOTNET_VERSION: "9.0.x"
BACKEND_SOLUTION_PATH: "src/backend"
BACKEND_SOLUTION_FILE: "Backend.sln"
WORKFLOW_SHORT_NAME: "backend-ci"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TRAILING_AGENT_WORK_PATH: "/home/runner/work/test/test/"
DOTNET_VERSION: "8.0.x"
DOTNET_VERSION: "9.0.x"
BACKEND_SOLUTION_PATH: "src/backend"
BACKEND_SOLUTION_FILENAME: "Backend.sln"
FRONTEND_PATH: "src/frontend"
Expand Down
4 changes: 2 additions & 2 deletions shared/NugetDistSample/NugetDistSample.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>nuget_distribution_example</PackageId>
<Version>0.0.26</Version>
<Version>0.0.33</Version>
<Authors>Hans Christian Winther-Sørensen</Authors>
<Company>WSH</Company>
<PackageDescription>Distributing shared project files example</PackageDescription>
Expand Down
14 changes: 7 additions & 7 deletions shared/NugetDistSample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
if (args.Length == 2)
{
var msbuildDir = args[0];
var solutionDir = args[1];
var projectDir = args[1];
Console.WriteLine($"MsbuildDir: {msbuildDir}");
Console.WriteLine($"SolutionDir: {solutionDir}");
Console.WriteLine($"ProjectDir: {projectDir}");

var solutionSignature = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(solutionDir));
var cachePath = Path.Combine(msbuildDir, "..", $"cached-run-{solutionSignature}");
var projectSignature = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(projectDir));
var cachePath = Path.Combine(msbuildDir, "..", $"cached-run-{projectSignature}");
if (Path.Exists(cachePath))
{
Console.WriteLine("Already executed for this solution.");
Console.WriteLine("Already executed for this project.");
return;
}

var gitFolderPath = FindGitFolder(solutionDir);
var gitFolderPath = FindGitFolder(projectDir);
if (gitFolderPath == null)
{
Console.WriteLine(".git folder not found.");
Expand All @@ -39,7 +39,7 @@
}
else
{
Console.WriteLine("Usage: NugetDistSample <MsbuildDir> <SolutionDir>");
Console.WriteLine("Usage: NugetDistSample <MsbuildDir> <ProjectDir>");
}

return;
Expand Down
10 changes: 3 additions & 7 deletions shared/NugetDistSample/build/nuget_distribution_example.props
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<Project>
<Target Name="DistSampleInit" BeforeTargets="CollectPackageReferences">
<!--Message Text="Dist sample init SolutionDir=$(SolutionDir)" Importance="High" />
<Message Text="Dist sample init MSBuildThisFileDirectory=$(MSBuildThisFileDirectory)" Importance="High" />
<ItemGroup>
<File Include="$(MSBuildThisFileDirectory)..\content\**\*.*"></File>
</ItemGroup>
<Copy SourceFiles="@(File)" DestinationFolder="$(SolutionDir)\"></Copy-->
<Exec Command="dotnet $(MSBuildThisFileDirectory)..\lib\$(TargetFramework)\NugetDistSample.dll $(MSBuildThisFileDirectory) $(SolutionDir)" />
<Warning Code="DSAMPLE001" Text="DistSample executing" />
<Exec
Command="dotnet $(MSBuildThisFileDirectory)..\lib\$(TargetFramework)\NugetDistSample.dll $(MSBuildThisFileDirectory) $(ProjectDir)" />
</Target>
</Project>
3 changes: 2 additions & 1 deletion shared/NugetDistSample/packages.lock.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"version": 1,
"dependencies": {
"net8.0": {}
"net8.0": {},
"net9.0": {}
}
}
Binary file modified shared/NugetDistSample/readme.md
Binary file not shown.
7 changes: 7 additions & 0 deletions src/backend/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
"dotnet-stryker"
],
"rollForward": false
},
"dotnet-outdated-tool": {
"version": "4.6.4",
"commands": [
"dotnet-outdated"
],
"rollForward": false
}
}
}
37 changes: 20 additions & 17 deletions src/backend/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<RuntimeIdentifiers>win-x64;linux-musl-x64</RuntimeIdentifiers>
<DefineConstants></DefineConstants>
<InheritDocEnabled>true</InheritDocEnabled>
<AssemblyVersion>0.0.0.1</AssemblyVersion>
<FileVersion>0.0.0.1</FileVersion>
<InformationalVersion>0.0.0.1-local-dev</InformationalVersion>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<RuntimeIdentifiers>win-x64;linux-musl-x64</RuntimeIdentifiers>
<DefineConstants></DefineConstants>
<InheritDocEnabled>true</InheritDocEnabled>
<AssemblyVersion>0.0.0.1</AssemblyVersion>
<FileVersion>0.0.0.1</FileVersion>
<InformationalVersion>0.0.0.1-local-dev</InformationalVersion>
</PropertyGroup>

<ItemGroup>
<AssemblyAttribute Include="WebApi.Attributes.DefineConstantsAttribute">
<_Parameter1>"$(DefineConstants)"</_Parameter1>
</AssemblyAttribute>


<NuGetAuditSuppress
Include="https://github.com/advisories/GHSA-5f2m-466j-3848;https://github.com/advisories/GHSA-x5qj-9vmx-7g6g;https://github.com/advisories/GHSA-xhfc-gr8f-ffwc" />

<!-- TODO: GitVersion does not match the git tag well enough, in order to fully use it I think we would have to embrace their commit message format -->
<!--PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PrivateAssets>all</PrivateAssets>
Expand Down
22 changes: 12 additions & 10 deletions src/backend/WebApi/WebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Exporter.Zipkin" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Exporter.Zipkin" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.9.0" />
Expand All @@ -29,8 +29,8 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />
<PackageReference Include="Swashbuckle.AspNetCore.ReDoc" Version="6.9.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore.ReDoc" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
Expand All @@ -44,7 +44,9 @@

<Target Name="CreateSwaggerJson" AfterTargets="Build" Condition="$(Configuration)=='Debug'">
<Message Text="Updating swagger schema file" Importance="High" />
<Exec EnvironmentVariables="DOTNET_ENVIRONMENT=Swagger;ASPNETCORE_ENVIRONMENT=Swagger" Command="dotnet swagger tofile --output swagger.json $(OutputPath)$(AssemblyName).dll v1" WorkingDirectory="$(ProjectDir)" />
<Exec EnvironmentVariables="DOTNET_ENVIRONMENT=Swagger;ASPNETCORE_ENVIRONMENT=Swagger"
Command="dotnet swagger tofile --output swagger.json $(OutputPath)$(AssemblyName).dll v1"
WorkingDirectory="$(ProjectDir)" />
</Target>

</Project>
Loading

0 comments on commit 4552901

Please sign in to comment.