Skip to content

Commit

Permalink
GitHubSync update - release-4.4 (#861)
Browse files Browse the repository at this point in the history
* GitHubSync update - release-4.4

* Update packages to prevent transitive CVE

* Update testing packages

* Update Microsoft.NET.Sdk.Functions

* Update Particular.Approvals

* Update Particular.Packaging

* Clean up project files

* Clean up workflow files

* Fix permissions on Linux tool

---------

Co-authored-by: internalautomation[bot] <85681268+internalautomation[bot]@users.noreply.github.com>
Co-authored-by: Brandon Ording <[email protected]>
  • Loading branch information
internalautomation[bot] and bording authored Nov 27, 2024
1 parent 04c23d7 commit d7a7e38
Show file tree
Hide file tree
Showing 15 changed files with 152 additions and 59 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,21 @@ jobs:
- name: Setup .NET SDK
uses: actions/[email protected]
with:
dotnet-version: |
6.0.x
- name: Setup Azure Core tools - Windows
dotnet-version: 8.0.x
- name: Setup Azure Functions Core Tools - Windows
if: runner.os == 'Windows'
run: |
choco install azure-functions-core-tools
echo "PathToFuncExe=C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools\func.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Setup Azure Core tools - Linux
- name: Setup Azure Functions Core Tools - Linux
if: runner.os == 'Linux'
run: |
sudo apt-get install azure-functions-core-tools -y
echo "PathToFuncExe=func" >> $GITHUB_ENV
shell: bash
- name: Fix Azure Functions Core Tools permissions - Linux
if: runner.os == 'Linux'
run: sudo chmod +x /usr/lib/azure-functions-core-tools/in-proc6/func
- name: Build
run: dotnet build src --configuration Release
- name: Upload packages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/[email protected]
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Build
run: dotnet build src --configuration Release
- name: Sign NuGet packages
Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisLevel Condition="'$(AnalysisLevel)' == ''">5.0</AnalysisLevel>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<!-- NuGetAuditMode set to 'all' for tool projects in Directory.Build.targets, other project types default to 'direct' -->
<NuGetAuditLevel>low</NuGetAuditLevel>
<NuGetAuditMode Condition="'$(NuGetAuditMode)' == ''">all</NuGetAuditMode>
<!-- To lock the version of Particular.Analyzers, for example, in a release branch, set this property in Custom.Build.props -->
<ParticularAnalyzersVersion Condition="'$(ParticularAnalyzersVersion)' == ''">2.1.2</ParticularAnalyzersVersion>
<ParticularAnalyzersVersion Condition="'$(ParticularAnalyzersVersion)' == ''">2.1.3</ParticularAnalyzersVersion>
<NServiceBusKey>0024000004800000940000000602000000240000525341310004000001000100dde965e6172e019ac82c2639ffe494dd2e7dd16347c34762a05732b492e110f2e4e2e1b5ef2d85c848ccfb671ee20a47c8d1376276708dc30a90ff1121b647ba3b7259a6bc383b2034938ef0e275b58b920375ac605076178123693c6c4f1331661a62eba28c249386855637780e3ff5f23a6d854700eaa6803ef48907513b92</NServiceBusKey>
<NServiceBusTestsKey>00240000048000009400000006020000002400005253413100040000010001007f16e21368ff041183fab592d9e8ed37e7be355e93323147a1d29983d6e591b04282e4da0c9e18bd901e112c0033925eb7d7872c2f1706655891c5c9d57297994f707d16ee9a8f40d978f064ee1ffc73c0db3f4712691b23bf596f75130f4ec978cf78757ec034625a5f27e6bb50c618931ea49f6f628fd74271c32959efb1c5</NServiceBusTestsKey>
</PropertyGroup>
Expand Down
4 changes: 1 addition & 3 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<Project>

<PropertyGroup>
<NuGetAuditMode Condition="'$(PackAsTool)' == 'true'">all</NuGetAuditMode>
</PropertyGroup>
<Import Project="msbuild\AutomaticVersionRanges.targets" Condition="Exists('msbuild\AutomaticVersionRanges.targets')" />

</Project>
14 changes: 6 additions & 8 deletions src/IntegrationTests.HostV4/IntegrationTests.HostV4.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
Expand All @@ -13,16 +13,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.4.0" />
<PackageReference Include="NServiceBus" Version="8.2.1" />
<PackageReference Include="NServiceBus.Transport.AzureServiceBus" Version="3.2.3" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.6.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
Expand All @@ -7,17 +7,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<!-- this package can only be upgraded when we drop support for older versions of Visual Studio -->
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\NServiceBus.AzureFunctions.Analyzer\NServiceBus.AzureFunctions.Analyzer.csproj" />
<ProjectReference Include="..\NServiceBus.AzureFunctions.InProcess.ServiceBus\NServiceBus.AzureFunctions.InProcess.ServiceBus.csproj" />
</ItemGroup>

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

<PropertyGroup>
<TargetFramework>$(AnalyzerTargetFramework)</TargetFramework>
Expand All @@ -10,15 +10,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Particular.Packaging" Version="3.0.0" PrivateAssets="All" />
<!-- this package can only be upgraded when we drop support for older versions of Visual Studio -->
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.11.0" />
<PackageReference Include="Particular.Packaging" Version="4.2.0" PrivateAssets="All" />
</ItemGroup>

<Target Name="UseMajorMinorPatchForAssemblyVersion" AfterTargets="MinVer">
<PropertyGroup>
<AssemblyVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).0</AssemblyVersion>
</PropertyGroup>
</Target>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@
<ProjectReference Include="..\NServiceBus.AzureFunctions.SourceGenerator\NServiceBus.AzureFunctions.SourceGenerator.csproj" ReferenceOutputAssembly="false" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="5.16.4" />
<PackageReference Include="NServiceBus.Newtonsoft.Json" Version="3.0.0" />
<PackageReference Include="NServiceBus" Version="8.2.4" />
<PackageReference Include="NServiceBus.Transport.AzureServiceBus" Version="3.2.5" />
<PackageReference Include="Obsolete.Fody" Version="5.3.0" PrivateAssets="All" />
<PackageReference Include="Particular.Packaging" Version="4.2.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<None Include="..\NServiceBus.AzureFunctions.Analyzer\bin\$(Configuration)\$(AnalyzerTargetFramework)\NServiceBus.AzureFunctions.Analyzer.dll" Pack="true" PackagePath="analyzers/dotnet/cs/NServiceBus.AzureFunctions.Analyzer.dll" Link="NServiceBus.AzureFunctions.Analyzer.dll" Visible="false" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="5.16.0" />
<PackageReference Include="NServiceBus.Newtonsoft.Json" Version="[3.0.0, 4.0.0)" />
<PackageReference Include="NServiceBus" Version="[8.2.1, 9.0.0)" />
<PackageReference Include="NServiceBus.Transport.AzureServiceBus" Version="[3.2.3, 4.0.0)" />
<PackageReference Include="Obsolete.Fody" Version="5.3.0" PrivateAssets="All" />
<PackageReference Include="Particular.Packaging" Version="3.0.0" PrivateAssets="All" />
<None Remove="build*\*" />
<Content Include="build\*" PackagePath="build" />
</ItemGroup>

<Target Name="AddSourceGeneratorToPackage" BeforeTargets="_GetPackageFiles">
<ItemGroup>
<None Include="..\NServiceBus.AzureFunctions.SourceGenerator\bin\$(Configuration)\**\NServiceBus.AzureFunctions.SourceGenerator.dll" Pack="true" PackagePath="analyzers/dotnet/cs/NServiceBus.AzureFunctions.SourceGenerator.dll" />
</ItemGroup>
</Target>

<ItemGroup>
<None Remove="build*\*" />
<Content Include="build\*" PackagePath="build" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="ServiceBus.Tests" Key="$(NServiceBusTestsKey)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.10.0" />
<PackageReference Include="Particular.Approvals" Version="1.0.0" />
<PackageReference Include="Particular.Approvals" Version="1.1.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ItemGroup>
<!-- Avoid updating this packages as this might cause the code generator to fail to load on projects using older .NET SDKs / Visual Studio -->
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.10.0" PrivateAssets="All" />
<PackageReference Include="Particular.Packaging" Version="3.0.0" PrivateAssets="All" />
<PackageReference Include="Particular.Packaging" Version="4.2.0" PrivateAssets="All" />
</ItemGroup>

<Target Name="UseMajorMinorPatchForAssemblyVersion" AfterTargets="MinVer">
Expand Down
11 changes: 5 additions & 6 deletions src/ServiceBus.AcceptanceTests/ServiceBus.AcceptanceTests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
Expand All @@ -12,16 +12,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="8.1.6" />
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="8.2.4" />
<PackageReference Include="NServiceBus.Persistence.NonDurable" Version="1.0.0" />
<PackageReference Include="NServiceBus.Transport.AzureServiceBus" Version="3.2.3" />
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 5 additions & 6 deletions src/ServiceBus.Tests/ServiceBus.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
Expand All @@ -11,15 +11,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus" Version="8.2.1" />
<PackageReference Include="Particular.Approvals" Version="1.0.0" />
<PackageReference Include="Particular.Approvals" Version="1.1.1" />
<PackageReference Include="PublicApiGenerator" Version="11.1.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Testing.Handlers/Testing.Handlers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NServiceBus" Version="8.1.1" />
<PackageReference Include="NServiceBus" Version="8.2.4" />
</ItemGroup>

</Project>
42 changes: 42 additions & 0 deletions src/msbuild/AutomaticVersionRanges.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<Project>

<PropertyGroup>
<AutomaticVersionRangesEnabled Condition="'$(AutomaticVersionRangesEnabled)' == '' And '$(Configuration)' == 'Debug'">false</AutomaticVersionRangesEnabled>
<AutomaticVersionRangesEnabled Condition="'$(AutomaticVersionRangesEnabled)' == '' And '$(IsPackable)' == 'false'">false</AutomaticVersionRangesEnabled>
<AutomaticVersionRangesEnabled Condition="'$(AutomaticVersionRangesEnabled)' == '' And '$(ManagePackageVersionsCentrally)' == 'true'">false</AutomaticVersionRangesEnabled>
<AutomaticVersionRangesEnabled Condition="'$(AutomaticVersionRangesEnabled)' == ''">true</AutomaticVersionRangesEnabled>
</PropertyGroup>

<UsingTask TaskName="ConvertToVersionRange" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<Task>
<Code Source="$(MSBuildThisFileDirectory)ConvertToVersionRange.cs" />
</Task>
</UsingTask>

<Target Name="ConvertProjectReferenceVersionsToVersionRanges" AfterTargets="_GetProjectReferenceVersions" Condition="'$(AutomaticVersionRangesEnabled)' == 'true'">
<PropertyGroup>
<NumberOfProjectReferences>@(_ProjectReferencesWithVersions->Count())</NumberOfProjectReferences>
</PropertyGroup>
<ConvertToVersionRange Condition="$(NumberOfProjectReferences) &gt; 0" References="@(_ProjectReferencesWithVersions)" VersionProperty="ProjectVersion">
<Output TaskParameter="ReferencesWithVersionRanges" ItemName="_ProjectReferencesWithVersionRanges" />
</ConvertToVersionRange>
<ItemGroup Condition="$(NumberOfProjectReferences) &gt; 0">
<_ProjectReferencesWithVersions Remove="@(_ProjectReferencesWithVersions)" />
<_ProjectReferencesWithVersions Include="@(_ProjectReferencesWithVersionRanges)" />
</ItemGroup>
</Target>

<Target Name="ConvertPackageReferenceVersionsToVersionRanges" BeforeTargets="CollectPackageReferences" Condition="'$(AutomaticVersionRangesEnabled)' == 'true'">
<PropertyGroup>
<NumberOfPackageReferences>@(PackageReference->Count())</NumberOfPackageReferences>
</PropertyGroup>
<ConvertToVersionRange Condition="$(NumberOfPackageReferences) &gt; 0" References="@(PackageReference)" VersionProperty="Version">
<Output TaskParameter="ReferencesWithVersionRanges" ItemName="_PackageReferencesWithVersionRanges" />
</ConvertToVersionRange>
<ItemGroup Condition="$(NumberOfPackageReferences) &gt; 0">
<PackageReference Remove="@(PackageReference)" />
<PackageReference Include="@(_PackageReferencesWithVersionRanges)" />
</ItemGroup>
</Target>

</Project>
57 changes: 57 additions & 0 deletions src/msbuild/ConvertToVersionRange.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using System.Text.RegularExpressions;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

public class ConvertToVersionRange : Task
{
[Required]
public ITaskItem[] References { get; set; } = [];

[Required]
public string VersionProperty { get; set; } = string.Empty;

[Output]
public ITaskItem[] ReferencesWithVersionRanges { get; private set; } = [];

public override bool Execute()
{
var success = true;

foreach (var reference in References)
{
var automaticVersionRange = reference.GetMetadata("AutomaticVersionRange");

if (automaticVersionRange.Equals("false", StringComparison.OrdinalIgnoreCase))
{
continue;
}

var privateAssets = reference.GetMetadata("PrivateAssets");

if (privateAssets.Equals("All", StringComparison.OrdinalIgnoreCase))
{
continue;
}

var version = reference.GetMetadata(VersionProperty);
var match = Regex.Match(version, @"^\d+");

if (match.Value.Equals(string.Empty, StringComparison.Ordinal))
{
Log.LogError("Reference '{0}' with version '{1}' is not valid for automatic version range conversion. Fix the version or exclude the reference from conversion by setting 'AutomaticVersionRange=\"false\"' on the reference.", reference.ItemSpec, version);
success = false;
continue;
}

var nextMajor = Convert.ToInt32(match.Value) + 1;

var versionRange = $"[{version}, {nextMajor}.0.0)";
reference.SetMetadata(VersionProperty, versionRange);
}

ReferencesWithVersionRanges = References;

return success;
}
}

0 comments on commit d7a7e38

Please sign in to comment.