Skip to content

Commit

Permalink
chore: updating nuget packages in feature management (#412)
Browse files Browse the repository at this point in the history
* chore: updating nuget packages in feature management

* updated

* updated

* updated

* updated

* updated

* updated

* updated

* updated

* updated

* updated

* updated

* updated

* updated

* Configure Azure Function version

* Remove usings

* Remove usings

* Align settings

* Refactor build

* Revert

---------

Co-authored-by: Dan Stenrøjl <51327761+dstenroejl@users.noreply.github.com>
Co-authored-by: Dan Stenrøjl <XDAST@energinet.dk>
  • Loading branch information
3 people authored Nov 25, 2024
1 parent 30b007d commit d291efe
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 40 deletions.
29 changes: 24 additions & 5 deletions .github/workflows/featuremanagement-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,32 @@ on:
# Executed if manually triggered
workflow_dispatch: {}

env:
# Set value used by 'AzuriteManager'
AzuriteFolderPath: ${{ github.workspace }}\node_modules\.bin\
# Overrides settings in 'functionhost.settings.json'
FunctionAppHostPath: ${{ github.workspace }}\node_modules\azure-functions-core-tools\bin\func.dll

jobs:
# Build and test solution, and publish coverage report
dotnet_solution_ci:
uses: Energinet-DataHub/.github/.github/workflows/dotnet-solution-ci.yml@v13
with:
solution_file_path: source/FeatureManagement/FeatureManagement.sln
use_azure_functions_tools: true
runs-on: windows-2022
name: Build and test

steps:
- name: Checkout repository
uses: Energinet-DataHub/.github/.github/actions/nuget-checkout-repository@v13

- name: Setup dotnet and tools
uses: Energinet-DataHub/.github/.github/actions/dotnet-setup-and-tools@v13
with:
use_azure_functions_tools: "true"
azure_functions_core_tools_version: 4.0.5455

- name: Build and test solution
uses: Energinet-DataHub/.github/.github/actions/dotnet-solution-build-and-test@v13
with:
solution_file_path: ./source/FeatureManagement/FeatureManagement.sln
publish_test_report: "true"

#
# Branch policy status check
Expand Down
35 changes: 35 additions & 0 deletions source/FeatureManagement/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
<!-- RunAnalyzersDuringXxx: https://learn.microsoft.com/en-us/visualstudio/code-quality/disable-code-analysis?view=vs-2022#net-framework-projects -->
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
<RunAnalyzersDuringLiveAnalysis>true</RunAnalyzersDuringLiveAnalysis>
<!-- EnforceCodeStyleInBuild: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview?tabs=net-8#enable-on-build -->
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<!--
Add stylecop for all projects (so long as they don't override Directory.Build.props) with a common ruleset.
See also: https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2019#search-scope
-->
<ItemGroup>
<!--
IMPORTANT: Do NOT add NuGet package dependencies in this file, except for "StyleCop.Analyzers".
-->
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<!--
Additional settings for specific rules (e.g. SA1200 specify namespaces must be placed correctly, the json file then defines what "correctly" means)
See also [stylecop.json](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/Configuration.md)
-->
<AdditionalFiles Include="$(MSBuildThisFileDirectory)\..\stylecop.json"/>
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions source/FeatureManagement/FeatureManagement.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleApp", "source\SampleA
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleApp.Tests", "source\SampleApp.Tests\SampleApp.Tests.csproj", "{266F6E2C-BF6C-4E95-BE9D-0474798F5FA4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_ConfigurationFiles", "_ConfigurationFiles", "{CBBDEE3C-0EBC-4039-A889-CE59591C29BD}"
ProjectSection(SolutionItems) = preProject
..\..\.editorconfig = ..\..\.editorconfig
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using Energinet.DataHub.Core.FeatureManagement.SampleApp.Common;
using Energinet.DataHub.Core.FunctionApp.TestCommon;
using Energinet.DataHub.Core.FunctionApp.TestCommon.Azurite;
Expand Down Expand Up @@ -52,9 +49,10 @@ protected override void OnConfigureHostSettings(FunctionAppHostSettings hostSett
}

var buildConfiguration = GetBuildConfiguration();
hostSettings.FunctionApplicationPath = $"..\\..\\..\\..\\SampleApp\\bin\\{buildConfiguration}\\net6.0";
hostSettings.FunctionApplicationPath = $"..\\..\\..\\..\\SampleApp\\bin\\{buildConfiguration}\\net8.0";

hostSettings.ProcessEnvironmentVariables.Add(EnvironmentSettingNames.AzureWebJobsStorage, "UseDevelopmentStorage=true");
hostSettings.ProcessEnvironmentVariables.Add(EnvironmentSettingNames.FunctionWorkerRuntime, "dotnet-isolated");

// => Feature flags
hostSettings.ProcessEnvironmentVariables.Add(UseGuidMessageSettingName, "false");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Energinet.DataHub.Core.FeatureManagement.SampleApp.Common;
using Energinet.DataHub.Core.FeatureManagement.SampleApp.Tests.Fixtures;
using Energinet.DataHub.Core.FunctionApp.TestCommon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,24 @@ limitations under the License.
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>9</LangVersion>
<Nullable>enable</Nullable>
<AssemblyName>Energinet.DataHub.Core.FeatureManagement.SampleApp.Tests</AssemblyName>
<RootNamespace>Energinet.DataHub.Core.FeatureManagement.SampleApp.Tests</RootNamespace>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoFixture" Version="4.17.0" />
<PackageReference Include="AutoFixture.AutoMoq" Version="4.17.0" />
<PackageReference Include="Energinet.DataHub.Core.FunctionApp.TestCommon" Version="3.0.1" />
<PackageReference Include="FluentAssertions" Version="6.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="AutoFixture" Version="4.18.1" />
<PackageReference Include="AutoFixture.AutoMoq" Version="4.18.1" />
<PackageReference Include="Energinet.DataHub.Core.FunctionApp.TestCommon" Version="7.0.4" />
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.0.2">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand All @@ -50,7 +45,7 @@ limitations under the License.

<ItemGroup>
<None Update="functionapphost.settings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ public static class EnvironmentSettingNames
{
// Function
public const string AzureWebJobsStorage = "AzureWebJobsStorage";
public const string FunctionWorkerRuntime = "FUNCTIONS_WORKER_RUNTIME";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Net;
using System.Threading.Tasks;
using Energinet.DataHub.Core.FeatureManagement.SampleApp.Common;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
Expand Down
15 changes: 5 additions & 10 deletions source/FeatureManagement/source/SampleApp/SampleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,17 @@ limitations under the License.
-->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
<AssemblyName>Energinet.DataHub.Core.FeatureManagement.SampleApp</AssemblyName>
<RootNamespace>Energinet.DataHub.Core.FeatureManagement.SampleApp</RootNamespace>
<LangVersion>9</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.3.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.6.0" />
<PackageReference Include="Microsoft.FeatureManagement" Version="2.4.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
<PackageReference Include="Microsoft.FeatureManagement" Version="4.0.0" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
Expand Down

0 comments on commit d291efe

Please sign in to comment.