Skip to content

Commit b9e5ff6

Browse files
authored
Merge pull request GitTools#3243 from arturcic/feature/7.0
Add support for .net 7.0
2 parents a5ef03e + 5974053 commit b9e5ff6

27 files changed

+92
-79
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ jobs:
5555
path: run
5656
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
5757
-
58-
name: Install .NET SDK 6.0.x
59-
uses: actions/setup-dotnet@v3
58+
name: Setup .NET SDK
59+
uses: actions/setup-dotnet@v3.0.2
6060
with:
61-
dotnet-version: '6.0.x'
61+
dotnet-version: '7.0.x'
62+
dotnet-quality: 'preview'
6263
-
6364
name: '[Prepare]'
6465
if: steps.cache-cake.outputs.cache-hit != 'true'
@@ -94,10 +95,11 @@ jobs:
9495
path: tools
9596
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
9697
-
97-
name: Install .NET SDK 6.0.x
98-
uses: actions/setup-dotnet@v3
98+
name: Setup .NET SDK
99+
uses: actions/setup-dotnet@v3.0.2
99100
with:
100-
dotnet-version: '6.0.x'
101+
dotnet-version: '7.0.x'
102+
dotnet-quality: 'preview'
101103
-
102104
name: '[Build]'
103105
shell: pwsh
@@ -133,7 +135,7 @@ jobs:
133135
strategy:
134136
matrix:
135137
os: [windows-latest, ubuntu-latest, macos-latest]
136-
targetFramework: [net6.0]
138+
targetFramework: [net7.0, net6.0]
137139
fail-fast: false
138140

139141
steps:
@@ -157,10 +159,11 @@ jobs:
157159
path: tools
158160
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
159161
-
160-
name: Install .NET SDK 6.0.x
161-
uses: actions/setup-dotnet@v3
162+
name: Setup .NET SDK
163+
uses: actions/setup-dotnet@v3.0.2
162164
with:
163-
dotnet-version: '6.0.x'
165+
dotnet-version: '7.0.x'
166+
dotnet-quality: 'preview'
164167
-
165168
name: '[Unit Test]'
166169
shell: pwsh
@@ -209,10 +212,11 @@ jobs:
209212
name: nuget
210213
path: ${{ github.workspace }}/artifacts/packages/nuget
211214
-
212-
name: Install .NET SDK 6.0.x
213-
uses: actions/setup-dotnet@v3
215+
name: Setup .NET SDK
216+
uses: actions/setup-dotnet@v3.0.2
214217
with:
215-
dotnet-version: '6.0.x'
218+
dotnet-version: '7.0.x'
219+
dotnet-quality: 'preview'
216220
-
217221
name: '[Test Artifacts]'
218222
shell: pwsh
@@ -224,7 +228,7 @@ jobs:
224228
runs-on: ubuntu-latest
225229
strategy:
226230
matrix:
227-
targetFramework: [ '6.0' ]
231+
targetFramework: [ '7.0', '6.0' ]
228232
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 ]
229233
fail-fast: false
230234

@@ -269,10 +273,11 @@ jobs:
269273
with:
270274
install: true
271275
-
272-
name: Install .NET SDK 6.0.x
273-
uses: actions/setup-dotnet@v3
276+
name: Setup .NET SDK
277+
uses: actions/setup-dotnet@v3.0.2
274278
with:
275-
dotnet-version: '6.0.x'
279+
dotnet-version: '7.0.x'
280+
dotnet-quality: 'preview'
276281
-
277282
name: '[Test Artifacts (amd64)]'
278283
shell: pwsh
@@ -288,7 +293,7 @@ jobs:
288293
runs-on: ubuntu-latest
289294
strategy:
290295
matrix:
291-
targetFramework: [ '6.0' ]
296+
targetFramework: [ '7.0', '6.0' ]
292297
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 ]
293298
fail-fast: false
294299

@@ -327,10 +332,11 @@ jobs:
327332
with:
328333
install: true
329334
-
330-
name: Install .NET SDK 6.0.x
331-
uses: actions/setup-dotnet@v3
335+
name: Setup .NET SDK
336+
uses: actions/setup-dotnet@v3.0.2
332337
with:
333-
dotnet-version: '6.0.x'
338+
dotnet-version: '7.0.x'
339+
dotnet-quality: 'preview'
334340
-
335341
name: Login to DockerHub
336342
if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools'
@@ -417,10 +423,11 @@ jobs:
417423
name: nuget
418424
path: ${{ github.workspace }}/artifacts/packages/nuget
419425
-
420-
name: Install .NET SDK 6.0.x
421-
uses: actions/setup-dotnet@v3
426+
name: Setup .NET SDK
427+
uses: actions/setup-dotnet@v3.0.2
422428
with:
423-
dotnet-version: '6.0.x'
429+
dotnet-version: '7.0.x'
430+
dotnet-quality: 'preview'
424431
-
425432
name: '[Publish]'
426433
shell: pwsh
@@ -471,10 +478,11 @@ jobs:
471478
name: native-macOS
472479
path: ${{ github.workspace }}/artifacts/packages/native
473480
-
474-
name: Install .NET SDK 6.0.x
475-
uses: actions/setup-dotnet@v3
481+
name: Setup .NET SDK
482+
uses: actions/setup-dotnet@v3.0.2
476483
with:
477-
dotnet-version: '6.0.x'
484+
dotnet-version: '7.0.x'
485+
dotnet-quality: 'preview'
478486
-
479487
name: '[Release]'
480488
shell: pwsh

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ jobs:
5858
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
5959

6060
-
61-
name: Install .NET SDKs
62-
uses: actions/setup-dotnet@v3
61+
name: Setup .NET SDK
62+
uses: actions/setup-dotnet@v3.0.2
6363
with:
64-
dotnet-version: |
65-
6.0.x
64+
dotnet-version: '7.0.x'
65+
dotnet-quality: 'preview'
6666

6767
-
6868
name: '[Prepare]'

.github/workflows/docs.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ jobs:
6969
key: node-${{ runner.os }}-${{ hashFiles('./package-lock.json') }}
7070
restore-keys: node-${{ runner.os }}
7171
-
72-
name: Install .NET SDK 6.0.x
73-
uses: actions/setup-dotnet@v3
72+
name: Setup .NET SDK
73+
uses: actions/setup-dotnet@v3.0.2
7474
with:
75-
dotnet-version: '6.0.x'
75+
dotnet-version: '7.0.x'
76+
dotnet-quality: 'preview'
7677
-
7778
name: '[Prepare]'
7879
if: steps.cache-cake.outputs.cache-hit != 'true'
@@ -103,10 +104,11 @@ jobs:
103104
path: tools
104105
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
105106
-
106-
name: Install .NET SDK 6.0.x
107-
uses: actions/setup-dotnet@v3
107+
name: Setup .NET SDK
108+
uses: actions/setup-dotnet@v3.0.2
108109
with:
109-
dotnet-version: '6.0.x'
110+
dotnet-version: '7.0.x'
111+
dotnet-quality: 'preview'
110112
-
111113
name: '[Build Documentation]'
112114
shell: pwsh
@@ -160,10 +162,11 @@ jobs:
160162
path: tools
161163
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
162164
-
163-
name: Install .NET SDK 6.0.x
164-
uses: actions/setup-dotnet@v3
165+
name: Setup .NET SDK
166+
uses: actions/setup-dotnet@v3.0.2
165167
with:
166-
dotnet-version: '6.0.x'
168+
dotnet-version: '7.0.x'
169+
dotnet-quality: 'preview'
167170
-
168171
name: '[Publish Documentation]'
169172
if: ${{ github.event_name == 'push' }}

.github/workflows/format.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ jobs:
3030
- uses: actions/checkout@v3
3131
-
3232
name: Setup .NET SDK
33-
uses: actions/setup-dotnet@v3
33+
uses: actions/setup-dotnet@v3.0.2
3434
with:
35-
dotnet-version: '6.0.x'
35+
dotnet-version: '7.0.x'
36+
dotnet-quality: 'preview'
3637
-
3738
name: Run Format Build solution
3839
run: dotnet format ./build/ --verify-no-changes

build/Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project>
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
66
<OutputPath>..\..\run\</OutputPath>
77
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
88
<Nullable>enable</Nullable>
9-
<LangVersion>10</LangVersion>
9+
<LangVersion>11</LangVersion>
1010
<NoWarn>NU1604</NoWarn>
1111
<ImplicitUsings>enable</ImplicitUsings>
1212
</PropertyGroup>

build/artifacts/Tasks/ArtifactsDotnetToolTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Artifacts.Tasks;
55
[TaskName(nameof(ArtifactsDotnetToolTest))]
66
[TaskDescription("Tests the dotnet global tool in docker container")]
77
[TaskArgument(Arguments.DockerRegistry, Constants.DockerHub, Constants.GitHub)]
8-
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60)]
8+
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60, Constants.Version70)]
99
[TaskArgument(Arguments.DockerDistro, Constants.Alpine313, Constants.Debian10, Constants.Ubuntu2004)]
1010
[IsDependentOn(typeof(ArtifactsPrepare))]
1111
public class ArtifactsDotnetToolTest : FrostingTask<BuildContext>

build/artifacts/Tasks/ArtifactsMsBuildCoreTest.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Artifacts.Tasks;
55
[TaskName(nameof(ArtifactsMsBuildCoreTest))]
66
[TaskDescription("Tests the msbuild package in docker container")]
77
[TaskArgument(Arguments.DockerRegistry, Constants.DockerHub, Constants.GitHub)]
8-
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60)]
8+
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60, Constants.Version70)]
99
[TaskArgument(Arguments.DockerDistro, Constants.Alpine313, Constants.Debian10, Constants.Ubuntu2004)]
1010
[IsDependentOn(typeof(ArtifactsPrepare))]
1111
public class ArtifactsMsBuildCoreTest : FrostingTask<BuildContext>
@@ -29,12 +29,11 @@ public override void Run(BuildContext context)
2929
{
3030
if (context.SkipImage(dockerImage)) continue;
3131

32-
string distro = dockerImage.Distro;
3332
string targetFramework = dockerImage.TargetFramework;
3433

3534
targetFramework = targetFramework switch
3635
{
37-
Constants.Version60 => $"net{targetFramework}",
36+
Constants.Version60 or Constants.Version70 => $"net{targetFramework}",
3837
_ => targetFramework
3938
};
4039

build/artifacts/Tasks/ArtifactsMsBuildFullTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public override void Run(BuildContext context)
2323
var nugetSource = context.MakeAbsolute(Paths.Nuget).FullPath;
2424

2525
context.Information("\nTesting msbuild task with dotnet build (for .net core)\n");
26-
var frameworks = new[] { Constants.NetVersion60 };
26+
var frameworks = new[] { Constants.NetVersion60, Constants.NetVersion70 };
2727
foreach (var framework in frameworks)
2828
{
2929
var dotnetMsBuildSettings = new DotNetMSBuildSettings();

build/artifacts/Tasks/ArtifactsNativeTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Artifacts.Tasks;
55
[TaskName(nameof(ArtifactsNativeTest))]
66
[TaskDescription("Tests the native executables in docker container")]
77
[TaskArgument(Arguments.DockerRegistry, Constants.DockerHub, Constants.GitHub)]
8-
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60)]
8+
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60, Constants.Version70)]
99
[TaskArgument(Arguments.DockerDistro, Constants.Alpine313, Constants.Debian10, Constants.Ubuntu2004)]
1010
[IsDependentOn(typeof(ArtifactsPrepare))]
1111
public class ArtifactsNativeTest : FrostingTask<BuildContext>

build/artifacts/Tasks/ArtifactsPrepare.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Artifacts.Tasks;
55
[TaskName(nameof(ArtifactsPrepare))]
66
[TaskDescription("Pulls the docker images needed for testing the artifacts")]
77
[TaskArgument(Arguments.DockerRegistry, Constants.DockerHub, Constants.GitHub)]
8-
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60)]
8+
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60, Constants.Version70)]
99
[TaskArgument(Arguments.DockerDistro, Constants.Alpine313, Constants.Debian10, Constants.Ubuntu2004)]
1010
public class ArtifactsPrepare : FrostingTask<BuildContext>
1111
{

build/artifacts/Tasks/ArtifactsTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Artifacts.Tasks;
55
[TaskName(nameof(ArtifactsTest))]
66
[TaskDescription("Tests packages in docker container")]
77
[TaskArgument(Arguments.DockerRegistry, Constants.DockerHub, Constants.GitHub)]
8-
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60)]
8+
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60, Constants.Version70)]
99
[TaskArgument(Arguments.DockerDistro, Constants.Alpine313, Constants.Debian10, Constants.Ubuntu2004)]
1010
[IsDependentOn(typeof(ArtifactsNativeTest))]
1111
[IsDependentOn(typeof(ArtifactsDotnetToolTest))]

build/build/Tasks/Test/UnitTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Build.Tasks;
88

99
[TaskName(nameof(UnitTest))]
1010
[TaskDescription("Run the unit tests")]
11-
[TaskArgument(Arguments.DotnetTarget, Constants.NetVersion60)]
11+
[TaskArgument(Arguments.DotnetTarget, Constants.NetVersion60, Constants.NetVersion70)]
1212
[IsDependentOn(typeof(Build))]
1313
public class UnitTest : FrostingTask<BuildContext>
1414
{
@@ -17,7 +17,7 @@ public class UnitTest : FrostingTask<BuildContext>
1717
public override void Run(BuildContext context)
1818
{
1919
var dotnetTarget = context.Argument(Arguments.DotnetTarget, string.Empty);
20-
var frameworks = new[] { Constants.NetVersion60 };
20+
var frameworks = new[] { Constants.NetVersion60, Constants.NetVersion70 };
2121
if (!string.IsNullOrWhiteSpace(dotnetTarget))
2222
{
2323
if (!frameworks.Contains(dotnetTarget, StringComparer.OrdinalIgnoreCase))

build/common/Utilities/Constants.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ public class Constants
66
public const string Repository = "GitVersion";
77

88
public const string Version60 = "6.0";
9+
public const string Version70 = "7.0";
910

10-
public const string NetVersion60 = "net6.0";
11+
public const string NetVersion60 = $"net{Version60}";
12+
public const string NetVersion70 = $"net{Version70}";
1113

12-
public static readonly string[] VersionsToBuild = { Version60 };
14+
public static readonly string[] VersionsToBuild = { Version60, Version70 };
1315
public static readonly Architecture[] ArchToBuild = { Architecture.Amd64, Architecture.Arm64 };
1416
public static readonly string[] DistrosToSkip = { Alpine313, Alpine314, Centos7 };
1517

@@ -26,6 +28,7 @@ public class Constants
2628

2729
public const string Alpine313 = "alpine.3.13";
2830
public const string Alpine314 = "alpine.3.14";
31+
public const string Alpine315 = "alpine.3.15";
2932
public const string Centos7 = "centos.7";
3033
public const string Centos8 = "centos.8";
3134
public const string Debian10 = "debian.10";
@@ -39,6 +42,7 @@ public class Constants
3942
{
4043
Alpine313,
4144
Alpine314,
45+
Alpine315,
4246
Centos7,
4347
Centos8,
4448
Debian10,

build/common/Utilities/DockerContextExtensions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static bool SkipImage(this ICakeContext context, DockerImage dockerImage)
1313
{
1414
var (distro, targetFramework, architecture, _, _) = dockerImage;
1515

16-
if (architecture != Architecture.Arm64) return false;
16+
if (architecture == Architecture.Amd64) return false;
1717
if (!Constants.DistrosToSkip.Contains(distro)) return false;
1818

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

148-
Assert.Contains(context.Version?.GitVersion.FullSemVer, output);
148+
Assert.NotNull(context.Version?.GitVersion);
149+
Assert.Contains(context.Version.GitVersion.FullSemVer!, output);
149150
}
150151
private static IEnumerable<string> GetDockerTags(this BuildContextBase context, DockerImage dockerImage, Architecture? arch = null)
151152
{

build/common/Utilities/Tools.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ public class Tools
66

77
public static readonly Dictionary<string, string> Versions = new()
88
{
9-
{ NugetCmd, "6.1.0" },
9+
{ NugetCmd, "6.3.1" },
1010
};
1111
}

build/docker/Tasks/DockerBuild.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Docker.Tasks;
55
[TaskName(nameof(DockerBuild))]
66
[TaskDescription("Build the docker images containing the GitVersion Tool")]
77
[TaskArgument(Arguments.DockerRegistry, Constants.DockerHub, Constants.GitHub)]
8-
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60)]
8+
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60, Constants.Version70)]
99
[TaskArgument(Arguments.DockerDistro, Constants.Alpine313, Constants.Debian10, Constants.Ubuntu2004)]
1010
[TaskArgument(Arguments.Architecture, Constants.Amd64, Constants.Arm64)]
1111
public class DockerBuild : FrostingTask<BuildContext>

build/docker/Tasks/DockerManifest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Docker.Tasks;
55
[TaskName(nameof(DockerManifest))]
66
[TaskDescription("Publish the docker manifest containing the images for amd64 and arm64")]
77
[TaskArgument(Arguments.DockerRegistry, Constants.DockerHub, Constants.GitHub)]
8-
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60)]
8+
[TaskArgument(Arguments.DockerDotnetVersion, Constants.Version60, Constants.Version70)]
99
[TaskArgument(Arguments.DockerDistro, Constants.Alpine313, Constants.Debian10, Constants.Ubuntu2004)]
1010
[IsDependentOn(typeof(DockerManifestInternal))]
1111
public class DockerManifest : FrostingTask<BuildContext>

0 commit comments

Comments
 (0)