Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to dotnet9 #1957

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions .github/workflows/backend_lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
dotnet-version: "9.0.x"
- name: Build project and dependencies
run: dotnet build

Expand All @@ -35,7 +35,7 @@ jobs:
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
dotnet-version: "9.0.x"

- name: Build project and dependencies
run: dotnet build -warnaserror
Expand All @@ -51,7 +51,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
dotnet-version: "9.0.x"

- name: Run csharpier format
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/runMigrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ jobs:
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
dotnet-version: "9.0.x"

- name: Build project and dependencies
run: dotnet build

- name: Install dotnet ef tool
run: dotnet tool install -g dotnet-ef --version 8.0.0
run: dotnet tool install -g dotnet-ef --version 9.0.0

- name: Update database
run: dotnet ef database update --no-build --verbose
Expand Down
2 changes: 1 addition & 1 deletion backend/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.29.2",
"version": "0.30.6",
"commands": [
"dotnet-csharpier"
]
Expand Down
4 changes: 2 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /source

# copy everything
Expand All @@ -9,7 +9,7 @@ WORKDIR /source/api
RUN dotnet publish -c release -o /app

# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:8.0
FROM mcr.microsoft.com/dotnet/aspnet:9.0
WORKDIR /app
COPY --from=build /app ./
RUN apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev
Expand Down
21 changes: 10 additions & 11 deletions backend/api.test/Mocks/MissionLoaderMock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,16 @@ public class MockMissionLoader() : IMissionLoader
),
];

private readonly MissionDefinition _mockMissionDefinition =
new()
{
InspectionArea = new InspectionArea(),
Comment = "",
Id = "",
InstallationCode = "TTT",
IsDeprecated = false,
Name = "test",
Source = new Source { Id = "", SourceId = "" },
};
private readonly MissionDefinition _mockMissionDefinition = new()
{
InspectionArea = new InspectionArea(),
Comment = "",
Id = "",
InstallationCode = "TTT",
IsDeprecated = false,
Name = "test",
Source = new Source { Id = "", SourceId = "" },
};

public async Task<MissionDefinition?> GetMissionById(string sourceMissionId)
{
Expand Down
4 changes: 2 additions & 2 deletions backend/api.test/api.test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
Expand All @@ -11,7 +11,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.1" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
Expand Down
17 changes: 8 additions & 9 deletions backend/api/Database/Context/InitDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -576,15 +576,14 @@ public static void AddRobotModelsToContext(FlotillaDbContext context)
{
foreach (var type in Enum.GetValues<RobotType>())
{
RobotModel model =
new()
{
Type = type,
BatteryWarningThreshold = null,
BatteryMissionStartThreshold = null,
LowerPressureWarningThreshold = null,
UpperPressureWarningThreshold = null,
};
RobotModel model = new()
{
Type = type,
BatteryWarningThreshold = null,
BatteryMissionStartThreshold = null,
LowerPressureWarningThreshold = null,
UpperPressureWarningThreshold = null,
};
context.Add(model);
}
}
Expand Down
6 changes: 4 additions & 2 deletions backend/api/MQTT/MqttService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ public class MqttService : BackgroundService
private readonly int _serverPort;
private readonly bool _shouldFailOnMaxRetries;

private static readonly JsonSerializerOptions serializerOptions =
new() { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } };
private static readonly JsonSerializerOptions serializerOptions = new()
{
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) },
};

private CancellationToken _cancellationToken;
private int _reconnectAttempts;
Expand Down
25 changes: 12 additions & 13 deletions backend/api/MQTT/MqttTopics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@ public static class MqttTopics
/// <summary>
/// A dictionary linking MQTT topics to their respective message models
/// </summary>
public static readonly Dictionary<string, Type> TopicsToMessages =
new()
{
{ "isar/+/status", typeof(IsarStatusMessage) },
{ "isar/+/robot_info", typeof(IsarRobotInfoMessage) },
{ "isar/+/robot_heartbeat", typeof(IsarRobotHeartbeatMessage) },
{ "isar/+/mission", typeof(IsarMissionMessage) },
{ "isar/+/task", typeof(IsarTaskMessage) },
{ "isar/+/battery", typeof(IsarBatteryMessage) },
{ "isar/+/pressure", typeof(IsarPressureMessage) },
{ "isar/+/pose", typeof(IsarPoseMessage) },
{ "isar/+/cloud_health", typeof(IsarCloudHealthMessage) },
};
public static readonly Dictionary<string, Type> TopicsToMessages = new()
{
{ "isar/+/status", typeof(IsarStatusMessage) },
{ "isar/+/robot_info", typeof(IsarRobotInfoMessage) },
{ "isar/+/robot_heartbeat", typeof(IsarRobotHeartbeatMessage) },
{ "isar/+/mission", typeof(IsarMissionMessage) },
{ "isar/+/task", typeof(IsarTaskMessage) },
{ "isar/+/battery", typeof(IsarBatteryMessage) },
{ "isar/+/pressure", typeof(IsarPressureMessage) },
{ "isar/+/pose", typeof(IsarPoseMessage) },
{ "isar/+/cloud_health", typeof(IsarCloudHealthMessage) },
};

/// <summary>
/// Searches a dictionary for a specific topic name and returns the corresponding value from the wildcarded dictionary
Expand Down
12 changes: 6 additions & 6 deletions backend/api/api.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>f888e68d-d6f9-4dad-adb2-269ae53a9ea1</UserSecretsId>
Expand All @@ -16,15 +16,15 @@
<PackageReference Include="Azure.Storage.Blobs" Version="12.21.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.3.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.11">
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Npgsql" Version="8.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.11" />
<PackageReference Include="Npgsql" Version="9.0.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.1" />
<PackageReference Include="Microsoft.Identity.Web" Version="3.3.0" />
<PackageReference Include="Microsoft.Identity.Web.DownstreamApi" Version="3.3.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
Expand Down
Loading