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

Add support for .net 7.0 #3243

Merged
merged 2 commits into from
Oct 22, 2022
Merged
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
62 changes: 35 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ jobs:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Install .NET SDK 6.0.x
uses: actions/setup-dotnet@v3
name: Setup .NET SDK
uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
dotnet-quality: 'preview'
-
name: '[Prepare]'
if: steps.cache-cake.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -94,10 +95,11 @@ jobs:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Install .NET SDK 6.0.x
uses: actions/setup-dotnet@v3
name: Setup .NET SDK
uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
dotnet-quality: 'preview'
-
name: '[Build]'
shell: pwsh
Expand Down Expand Up @@ -133,7 +135,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
targetFramework: [net6.0]
targetFramework: [net7.0, net6.0]
fail-fast: false

steps:
Expand All @@ -157,10 +159,11 @@ jobs:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Install .NET SDK 6.0.x
uses: actions/setup-dotnet@v3
name: Setup .NET SDK
uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
dotnet-quality: 'preview'
-
name: '[Unit Test]'
shell: pwsh
Expand Down Expand Up @@ -209,10 +212,11 @@ jobs:
name: nuget
path: ${{ github.workspace }}/artifacts/packages/nuget
-
name: Install .NET SDK 6.0.x
uses: actions/setup-dotnet@v3
name: Setup .NET SDK
uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
dotnet-quality: 'preview'
-
name: '[Test Artifacts]'
shell: pwsh
Expand All @@ -224,7 +228,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
targetFramework: [ '6.0' ]
targetFramework: [ '7.0', '6.0' ]
distro: [ alpine.3.13, alpine.3.14, centos.7, centos.8, debian.10, debian.11, fedora.33, ubuntu.18.04, ubuntu.20.04, ubuntu.22.04 ]
fail-fast: false

Expand Down Expand Up @@ -269,10 +273,11 @@ jobs:
with:
install: true
-
name: Install .NET SDK 6.0.x
uses: actions/setup-dotnet@v3
name: Setup .NET SDK
uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
dotnet-quality: 'preview'
-
name: '[Test Artifacts (amd64)]'
shell: pwsh
Expand All @@ -288,7 +293,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
targetFramework: [ '6.0' ]
targetFramework: [ '7.0', '6.0' ]
distro: [ alpine.3.13, alpine.3.14, centos.7, centos.8, debian.10, debian.11, fedora.33, ubuntu.18.04, ubuntu.20.04, ubuntu.22.04 ]
fail-fast: false

Expand Down Expand Up @@ -327,10 +332,11 @@ jobs:
with:
install: true
-
name: Install .NET SDK 6.0.x
uses: actions/setup-dotnet@v3
name: Setup .NET SDK
uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
dotnet-quality: 'preview'
-
name: Login to DockerHub
if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools'
Expand Down Expand Up @@ -417,10 +423,11 @@ jobs:
name: nuget
path: ${{ github.workspace }}/artifacts/packages/nuget
-
name: Install .NET SDK 6.0.x
uses: actions/setup-dotnet@v3
name: Setup .NET SDK
uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
dotnet-quality: 'preview'
-
name: '[Publish]'
shell: pwsh
Expand Down Expand Up @@ -471,10 +478,11 @@ jobs:
name: native-macOS
path: ${{ github.workspace }}/artifacts/packages/native
-
name: Install .NET SDK 6.0.x
uses: actions/setup-dotnet@v3
name: Setup .NET SDK
uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
dotnet-quality: 'preview'
-
name: '[Release]'
shell: pwsh
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ jobs:
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}

-
name: Install .NET SDKs
uses: actions/setup-dotnet@v3
name: Setup .NET SDK
uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: |
6.0.x
dotnet-version: '7.0.x'
dotnet-quality: 'preview'

-
name: '[Prepare]'
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ jobs:
key: node-${{ runner.os }}-${{ hashFiles('./package-lock.json') }}
restore-keys: node-${{ runner.os }}
-
name: Install .NET SDK 6.0.x
uses: actions/setup-dotnet@v3
name: Setup .NET SDK
uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
dotnet-quality: 'preview'
-
name: '[Prepare]'
if: steps.cache-cake.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -103,10 +104,11 @@ jobs:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Install .NET SDK 6.0.x
uses: actions/setup-dotnet@v3
name: Setup .NET SDK
uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
dotnet-quality: 'preview'
-
name: '[Build Documentation]'
shell: pwsh
Expand Down Expand Up @@ -160,10 +162,11 @@ jobs:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Install .NET SDK 6.0.x
uses: actions/setup-dotnet@v3
name: Setup .NET SDK
uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
dotnet-quality: 'preview'
-
name: '[Publish Documentation]'
if: ${{ github.event_name == 'push' }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ jobs:
- uses: actions/checkout@v3
-
name: Setup .NET SDK
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
dotnet-quality: 'preview'
-
name: Run Format Build solution
run: dotnet format ./build/ --verify-no-changes
Expand Down
4 changes: 2 additions & 2 deletions build/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
<OutputPath>..\..\run\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Nullable>enable</Nullable>
<LangVersion>10</LangVersion>
<LangVersion>11</LangVersion>
<NoWarn>NU1604</NoWarn>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion build/artifacts/Tasks/ArtifactsDotnetToolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Artifacts.Tasks;
[TaskName(nameof(ArtifactsDotnetToolTest))]
[TaskDescription("Tests the dotnet global tool in docker container")]
[TaskArgument(Arguments.DockerRegistry, Constants.DockerHub, Constants.GitHub)]
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60)]
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60, Constants.Version70)]
[TaskArgument(Arguments.DockerDistro, Constants.Alpine313, Constants.Debian10, Constants.Ubuntu2004)]
[IsDependentOn(typeof(ArtifactsPrepare))]
public class ArtifactsDotnetToolTest : FrostingTask<BuildContext>
Expand Down
5 changes: 2 additions & 3 deletions build/artifacts/Tasks/ArtifactsMsBuildCoreTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Artifacts.Tasks;
[TaskName(nameof(ArtifactsMsBuildCoreTest))]
[TaskDescription("Tests the msbuild package in docker container")]
[TaskArgument(Arguments.DockerRegistry, Constants.DockerHub, Constants.GitHub)]
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60)]
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60, Constants.Version70)]
[TaskArgument(Arguments.DockerDistro, Constants.Alpine313, Constants.Debian10, Constants.Ubuntu2004)]
[IsDependentOn(typeof(ArtifactsPrepare))]
public class ArtifactsMsBuildCoreTest : FrostingTask<BuildContext>
Expand All @@ -29,12 +29,11 @@ public override void Run(BuildContext context)
{
if (context.SkipImage(dockerImage)) continue;

string distro = dockerImage.Distro;
string targetFramework = dockerImage.TargetFramework;

targetFramework = targetFramework switch
{
Constants.Version60 => $"net{targetFramework}",
Constants.Version60 or Constants.Version70 => $"net{targetFramework}",
_ => targetFramework
};

Expand Down
2 changes: 1 addition & 1 deletion build/artifacts/Tasks/ArtifactsMsBuildFullTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override void Run(BuildContext context)
var nugetSource = context.MakeAbsolute(Paths.Nuget).FullPath;

context.Information("\nTesting msbuild task with dotnet build (for .net core)\n");
var frameworks = new[] { Constants.NetVersion60 };
var frameworks = new[] { Constants.NetVersion60, Constants.NetVersion70 };
foreach (var framework in frameworks)
{
var dotnetMsBuildSettings = new DotNetMSBuildSettings();
Expand Down
2 changes: 1 addition & 1 deletion build/artifacts/Tasks/ArtifactsNativeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Artifacts.Tasks;
[TaskName(nameof(ArtifactsNativeTest))]
[TaskDescription("Tests the native executables in docker container")]
[TaskArgument(Arguments.DockerRegistry, Constants.DockerHub, Constants.GitHub)]
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60)]
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60, Constants.Version70)]
[TaskArgument(Arguments.DockerDistro, Constants.Alpine313, Constants.Debian10, Constants.Ubuntu2004)]
[IsDependentOn(typeof(ArtifactsPrepare))]
public class ArtifactsNativeTest : FrostingTask<BuildContext>
Expand Down
2 changes: 1 addition & 1 deletion build/artifacts/Tasks/ArtifactsPrepare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Artifacts.Tasks;
[TaskName(nameof(ArtifactsPrepare))]
[TaskDescription("Pulls the docker images needed for testing the artifacts")]
[TaskArgument(Arguments.DockerRegistry, Constants.DockerHub, Constants.GitHub)]
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60)]
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60, Constants.Version70)]
[TaskArgument(Arguments.DockerDistro, Constants.Alpine313, Constants.Debian10, Constants.Ubuntu2004)]
public class ArtifactsPrepare : FrostingTask<BuildContext>
{
Expand Down
2 changes: 1 addition & 1 deletion build/artifacts/Tasks/ArtifactsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Artifacts.Tasks;
[TaskName(nameof(ArtifactsTest))]
[TaskDescription("Tests packages in docker container")]
[TaskArgument(Arguments.DockerRegistry, Constants.DockerHub, Constants.GitHub)]
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60)]
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60, Constants.Version70)]
[TaskArgument(Arguments.DockerDistro, Constants.Alpine313, Constants.Debian10, Constants.Ubuntu2004)]
[IsDependentOn(typeof(ArtifactsNativeTest))]
[IsDependentOn(typeof(ArtifactsDotnetToolTest))]
Expand Down
4 changes: 2 additions & 2 deletions build/build/Tasks/Test/UnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Build.Tasks;

[TaskName(nameof(UnitTest))]
[TaskDescription("Run the unit tests")]
[TaskArgument(Arguments.DotnetTarget, Constants.NetVersion60)]
[TaskArgument(Arguments.DotnetTarget, Constants.NetVersion60, Constants.NetVersion70)]
[IsDependentOn(typeof(Build))]
public class UnitTest : FrostingTask<BuildContext>
{
Expand All @@ -17,7 +17,7 @@ public class UnitTest : FrostingTask<BuildContext>
public override void Run(BuildContext context)
{
var dotnetTarget = context.Argument(Arguments.DotnetTarget, string.Empty);
var frameworks = new[] { Constants.NetVersion60 };
var frameworks = new[] { Constants.NetVersion60, Constants.NetVersion70 };
if (!string.IsNullOrWhiteSpace(dotnetTarget))
{
if (!frameworks.Contains(dotnetTarget, StringComparer.OrdinalIgnoreCase))
Expand Down
8 changes: 6 additions & 2 deletions build/common/Utilities/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ public class Constants
public const string Repository = "GitVersion";

public const string Version60 = "6.0";
public const string Version70 = "7.0";

public const string NetVersion60 = "net6.0";
public const string NetVersion60 = $"net{Version60}";
public const string NetVersion70 = $"net{Version70}";

public static readonly string[] VersionsToBuild = { Version60 };
public static readonly string[] VersionsToBuild = { Version60, Version70 };
public static readonly Architecture[] ArchToBuild = { Architecture.Amd64, Architecture.Arm64 };
public static readonly string[] DistrosToSkip = { Alpine313, Alpine314, Centos7 };

Expand All @@ -26,6 +28,7 @@ public class Constants

public const string Alpine313 = "alpine.3.13";
public const string Alpine314 = "alpine.3.14";
public const string Alpine315 = "alpine.3.15";
public const string Centos7 = "centos.7";
public const string Centos8 = "centos.8";
public const string Debian10 = "debian.10";
Expand All @@ -39,6 +42,7 @@ public class Constants
{
Alpine313,
Alpine314,
Alpine315,
Centos7,
Centos8,
Debian10,
Expand Down
5 changes: 3 additions & 2 deletions build/common/Utilities/DockerContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static bool SkipImage(this ICakeContext context, DockerImage dockerImage)
{
var (distro, targetFramework, architecture, _, _) = dockerImage;

if (architecture != Architecture.Arm64) return false;
if (architecture == Architecture.Amd64) return false;
if (!Constants.DistrosToSkip.Contains(distro)) return false;

context.Information($"Skipping Target: {targetFramework}, Distro: {distro}, Arch: {architecture}");
Expand Down Expand Up @@ -145,7 +145,8 @@ private static void DockerTestRun(this BuildContextBase context, string image, A
var output = context.DockerRunImage(settings, image, command, args);
context.Information("Output : " + output);

Assert.Contains(context.Version?.GitVersion.FullSemVer, output);
Assert.NotNull(context.Version?.GitVersion);
Assert.Contains(context.Version.GitVersion.FullSemVer!, output);
}
private static IEnumerable<string> GetDockerTags(this BuildContextBase context, DockerImage dockerImage, Architecture? arch = null)
{
Expand Down
2 changes: 1 addition & 1 deletion build/common/Utilities/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public class Tools

public static readonly Dictionary<string, string> Versions = new()
{
{ NugetCmd, "6.1.0" },
{ NugetCmd, "6.3.1" },
};
}
2 changes: 1 addition & 1 deletion build/docker/Tasks/DockerBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Docker.Tasks;
[TaskName(nameof(DockerBuild))]
[TaskDescription("Build the docker images containing the GitVersion Tool")]
[TaskArgument(Arguments.DockerRegistry, Constants.DockerHub, Constants.GitHub)]
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60)]
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60, Constants.Version70)]
[TaskArgument(Arguments.DockerDistro, Constants.Alpine313, Constants.Debian10, Constants.Ubuntu2004)]
[TaskArgument(Arguments.Architecture, Constants.Amd64, Constants.Arm64)]
public class DockerBuild : FrostingTask<BuildContext>
Expand Down
2 changes: 1 addition & 1 deletion build/docker/Tasks/DockerManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Docker.Tasks;
[TaskName(nameof(DockerManifest))]
[TaskDescription("Publish the docker manifest containing the images for amd64 and arm64")]
[TaskArgument(Arguments.DockerRegistry, Constants.DockerHub, Constants.GitHub)]
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60)]
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60, Constants.Version70)]
[TaskArgument(Arguments.DockerDistro, Constants.Alpine313, Constants.Debian10, Constants.Ubuntu2004)]
[IsDependentOn(typeof(DockerManifestInternal))]
public class DockerManifest : FrostingTask<BuildContext>
Expand Down
Loading