Skip to content
Merged

net7 #786

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
12 changes: 6 additions & 6 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
- name: 📤 Checkout the repository
uses: actions/checkout@main

- name: 🥅 Install .Net 6
- name: 🥅 Install .Net 7
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x" # SDK Version
dotnet-version: "7.0.x" # SDK Version

- name: 🔍 Enable problem matchers
run: echo "::add-matcher::.github/matchers/dotnet.json"
Expand All @@ -30,10 +30,10 @@ jobs:

- name: 👀 Test
run: |
dotnet test src/HassModel/NetDaemon.HassModel.Tests -v minimal /p:CollectCoverage=true /p:CoverletOutputFormat=json /p:MergeWith=${{github.workspace}}/codecover.json /p:CoverletOutput=${{github.workspace}}/codecover
dotnet test src/Extensions/NetDaemon.Extensions.Scheduling.Tests -v minimal /p:CollectCoverage=true /p:CoverletOutputFormat=json /p:MergeWith=${{github.workspace}}/codecover.json /p:CoverletOutput=${{github.workspace}}/codecover
dotnet test src/Client/NetDaemon.HassClient.Tests -v minimal /p:CollectCoverage=true /p:CoverletOutputFormat=json /p:MergeWith=${{github.workspace}}/codecover.json /p:CoverletOutput=${{github.workspace}}/codecover
dotnet test src/AppModel/NetDaemon.AppModel.Tests -v minimal /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:MergeWith=${{github.workspace}}/codecover.json /p:CoverletOutput=${{github.workspace}}/codecover
dotnet test -v minimal '/p:CollectCoverage=true;CoverletOutputFormat=json;MergeWith=${{github.workspace}}/codecover.json;CoverletOutput=${{github.workspace}}/codecover' src/HassModel/NetDaemon.HassModel.Tests
dotnet test -v minimal '/p:CollectCoverage=true;CoverletOutputFormat=json;MergeWith=${{github.workspace}}/codecover.json;CoverletOutput=${{github.workspace}}/codecover' src/Extensions/NetDaemon.Extensions.Scheduling.Tests
dotnet test -v minimal '/p:CollectCoverage=true;CoverletOutputFormat=json;MergeWith=${{github.workspace}}/codecover.json;CoverletOutput=${{github.workspace}}/codecover' src/Client/NetDaemon.HassClient.Tests
dotnet test -v minimal '/p:CollectCoverage=true;CoverletOutputFormat=lcov;MergeWith=${{github.workspace}}/codecover.json;CoverletOutput=${{github.workspace}}/codecover' src/AppModel/NetDaemon.AppModel.Tests

- name: 📨 Publish coverage report to coveralls.io
uses: coverallsapp/github-action@master
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_integration_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ jobs:
- name: 📥 Checkout the repository
uses: actions/checkout@main

- name: 🥅 Install .Net 6
- name: 🥅 Install .Net 7
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x" # SDK Version
dotnet-version: "7.0.x" # SDK Version

- name: 🛠️ Build code
run: dotnet build
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:

- name: Get Home Assistant log in failure
if: ${{ failure() }}
run: docker logs ${{ steps.homeassistant.outputs.container_name }}
run: docker logs ${{ steps.homeassistant.outputs.containername }}

- name: Discord failure notification
if: ${{ github.event_name == 'schedule' && failure() }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push_nuget_manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
echo Current version: $latest
echo "::set-output name=version::$latest"

- name: 🥅 Install .Net 6
- name: 🥅 Install .Net 7
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x" # SDK Version
dotnet-version: "7.0.x" # SDK Version

- name: 🔖 Set version number
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tags_nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
echo Current version: $latest
echo "::set-output name=version::$latest"

- name: 🥅 Install .Net 6
- name: 🥅 Install .Net 7
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x" # SDK Version
dotnet-version: "7.0.x" # SDK Version

- name: 🔖 Set version number
run: |
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN \
&& rm -rf /var/cache/apk/*

# Pre-build .NET NetDaemon core project
FROM mcr.microsoft.com/dotnet/sdk:6.0.100-bullseye-slim-amd64 as netbuilder
FROM mcr.microsoft.com/dotnet/sdk:7.0.100-bullseye-slim-amd64 as netbuilder
ARG TARGETPLATFORM
ARG BUILDPLATFORM

Expand All @@ -28,7 +28,7 @@ COPY ./src /usr/src
RUN dotnet publish /usr/src/Host/NetDaemon.Host.Default/NetDaemon.Host.Default.csproj -o "/daemon"

# Final stage, create the runtime container
FROM ghcr.io/net-daemon/netdaemon_base
FROM ghcr.io/net-daemon/netdaemon_base7

# # Install S6 and the Admin site
# COPY ./Docker/rootfs/etc/services.d/NetDaemonAdmin /etc/services.d/NetDaemonAdmin
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.AddOn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# No admin support yet, we need to build the websocket API
# Pre-build .NET NetDaemon core project
FROM mcr.microsoft.com/dotnet/sdk:6.0.100-bullseye-slim-amd64 as netbuilder
FROM mcr.microsoft.com/dotnet/sdk:7.0.100-bullseye-slim-amd64 as netbuilder
ARG TARGETPLATFORM
ARG BUILDPLATFORM

Expand All @@ -14,7 +14,7 @@ COPY ./src /usr/src
RUN dotnet publish /usr/src/Host/NetDaemon.Host.Default/NetDaemon.Host.Default.csproj -o "/daemon"

# Final stage, create the runtime container
FROM ghcr.io/net-daemon/netdaemon_addonbase
FROM ghcr.io/net-daemon/netdaemon_addonbase7

# # Install S6 and the Admin site
COPY ./Docker/rootfs/etc/services.d/NetDaemonAddOnApp /etc/services.d/NetDaemonAddOnApp
Expand Down
7 changes: 7 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"version": "7.0.0",
"rollForward": "latestMajor",
"allowPrerelease": false
}
}
7 changes: 4 additions & 3 deletions src/AppModel/NetDaemon.AppModel.Tests/Config/ConfigTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using LocalApps;
using Microsoft.Extensions.Configuration;
Expand All @@ -19,7 +20,7 @@ public void TestAddJsonConfigGetsSettingsCorrectly()
var settings = configRoot.GetSection("TestConfig").Get<TestSettings>();

// CHECK
settings.AString
settings!.AString
.Should()
.Be("Hello test!");
}
Expand All @@ -34,7 +35,7 @@ public void TestAddYamlConfigGetsSettingsCorrectly()
var settings = configRoot.GetSection("TestConfig").Get<TestSettings>();

// CHECK
settings.AString
settings!.AString
.Should()
.Be("Hello test!");
}
Expand Down Expand Up @@ -185,4 +186,4 @@ internal class TestSettings
public string AString { get; set; } = string.Empty;
}

#endregion
#endregion
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand All @@ -13,11 +13,11 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.8.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" />
<PackageReference Include="Moq" Version="4.18.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal static IConfigurationBuilder AddYamlFile(this IConfigurationBuilder bui
{
if (provider == null && Path.IsPathRooted(filePath))
{
provider = new PhysicalFileProvider(Path.GetDirectoryName(filePath));
provider = new PhysicalFileProvider(Path.GetDirectoryName(filePath)??"");
filePath = Path.GetFileName(filePath);
}

Expand All @@ -60,4 +60,4 @@ internal static IConfigurationBuilder AddYamlFile(this IConfigurationBuilder bui
builder.Add(source);
return builder;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace NetDaemon.AppModel.Internal.Config;
public AppConfig(IConfiguration config, IConfigurationBinding configBinder, ILogger<AppConfig<T>> logger)
{
var type = typeof(T);
var section = config.GetSection(type.FullName);
var section = config.GetSection(type.FullName!);

if (!section.Exists())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal interface IConfigurationBinding
/// Class that allows binding strongly typed objects to configuration values.
/// </summary>
/// <remarks>
/// This is a scaled down and modified version of .NET 6 implementation.
/// This is a scaled down and modified version of .NET 7 implementation.
/// </remarks>
internal class ConfigurationBinding : IConfigurationBinding
{
Expand Down
20 changes: 10 additions & 10 deletions src/AppModel/NetDaemon.AppModel/NetDaemon.AppModel.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>JoySoftware.NetDaemon.AppModel</PackageId>
Expand All @@ -20,16 +20,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="System.IO.Pipelines" Version="6.0.3" />
<PackageReference Include="System.IO.Pipelines" Version="7.0.0" />
<PackageReference Include="Roslynator.Analyzers" Version="4.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
Expand All @@ -10,7 +10,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand All @@ -27,13 +27,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="System.IO.Pipelines" Version="6.0.3" />
<PackageReference Include="System.IO.Pipelines" Version="7.0.0" />
<PackageReference Include="Roslynator.Analyzers" Version="4.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public void CanAddComplexToSimple()

j1.AddRange(J(o2));
var combined = JsonConvert.DeserializeObject<dynamic>(j1.ToJsonString());
Assert.Equal("1", combined.a.ToString());
Assert.Equal("2", combined.b.ToString());
Assert.Equal("3", combined.c.ToString());
Assert.Equal("8", combined.d.x.ToString());
Assert.Equal("9", combined.d.y.ToString());
Assert.Equal("1", combined?.a.ToString());
Assert.Equal("2", combined?.b.ToString());
Assert.Equal("3", combined?.c.ToString());
Assert.Equal("8", combined?.d.x.ToString());
Assert.Equal("9", combined?.d.y.ToString());
}

[Fact]
Expand All @@ -73,10 +73,10 @@ public void CanMergeSimpleIntoComplex()

j1.AddRange(J(o2));
var combined = JsonConvert.DeserializeObject<dynamic>(j1.ToJsonString());
Assert.Equal("3", combined.a.ToString());
Assert.Equal("2", combined.b.ToString());
Assert.Equal("8", combined.c.x.ToString());
Assert.Equal("9", combined.c.y.ToString());
Assert.Equal("3", combined?.a.ToString());
Assert.Equal("2", combined?.b.ToString());
Assert.Equal("8", combined?.c.x.ToString());
Assert.Equal("9", combined?.c.y.ToString());
}

[Fact]
Expand All @@ -89,10 +89,10 @@ public void CanMergeComplexIntoSimple()

j1.AddRange(J(o2));
var combined = JsonConvert.DeserializeObject<dynamic>(j1.ToJsonString());
Assert.Equal("1", combined.a.ToString());
Assert.Equal("2", combined.b.ToString());
Assert.Equal("8", combined.c.x.ToString());
Assert.Equal("9", combined.c.y.ToString());
Assert.Equal("1", combined?.a.ToString());
Assert.Equal("2", combined?.b.ToString());
Assert.Equal("8", combined?.c.x.ToString());
Assert.Equal("9", combined?.c.y.ToString());
}

[Fact]
Expand All @@ -105,11 +105,11 @@ public void CanMergeComplexIntoComplex()

j1.AddRange(J(o2));
var combined = JsonConvert.DeserializeObject<dynamic>(j1.ToJsonString());
Assert.Equal("1", combined.a.ToString());
Assert.Equal("10", combined.b.q.ToString());
Assert.Equal("11", combined.b.r.ToString());
Assert.Equal("8", combined.c.x.ToString());
Assert.Equal("9", combined.c.y.ToString());
Assert.Equal("1", combined?.a.ToString());
Assert.Equal("10", combined?.b.q.ToString());
Assert.Equal("11", combined?.b.r.ToString());
Assert.Equal("8", combined?.c.x.ToString());
Assert.Equal("9", combined?.c.y.ToString());
}

[Fact]
Expand Down Expand Up @@ -141,20 +141,20 @@ public void CanMergeMultiLayerComplex()
j1.AddRange(J(o2));
var combined = JsonConvert.DeserializeObject<dynamic>(j1.ToJsonString());

Assert.Equal("1", combined.a.ToString());
Assert.Equal("2", combined.b.ToString());
Assert.Equal("3", combined.c.ToString());
Assert.Equal("smith", combined.person.name.surname.ToString());
Assert.Equal("john", combined.person.name.forename.ToString());
Assert.Equal("11000", combined.person.age.quantity.ToString());
Assert.Equal("days", combined.person.age.unit.ToString());
Assert.Equal("numeric", combined.id.style.ToString());
Assert.Equal("1234", combined.id.value.ToString());
Assert.Equal("1", combined?.a.ToString());
Assert.Equal("2", combined?.b.ToString());
Assert.Equal("3", combined?.c.ToString());
Assert.Equal("smith", combined?.person.name.surname.ToString());
Assert.Equal("john", combined?.person.name.forename.ToString());
Assert.Equal("11000", combined?.person.age.quantity.ToString());
Assert.Equal("days", combined?.person.age.unit.ToString());
Assert.Equal("numeric", combined?.id.style.ToString());
Assert.Equal("1234", combined?.id.value.ToString());
}


private static JsonObject J(dynamic o)
{
return JsonSerializer.SerializeToNode(o);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.8.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="Moq" Version="4.18.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
Expand Down
Loading