Skip to content

Commit

Permalink
Change supported target frameworks
Browse files Browse the repository at this point in the history
* upgrade from net461 to net462
* drop support for net40, net45
* drop support for < netstandard2.0
* drop netcoreapp2.1, netcoreapp3.1 and net5.0
* upgrade NUKE
* switch back to using windows-latest GH Actions image which now has NET 6 support
  • Loading branch information
lahma committed Nov 26, 2022
1 parent a428037 commit c6ffb68
Show file tree
Hide file tree
Showing 166 changed files with 866 additions and 9,119 deletions.
23 changes: 4 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,13 @@ on:
- '!**/*.md'

jobs:
windows-2022:
name: windows-2022
runs-on: windows-2022
windows-latest:
name: windows-latest
runs-on: windows-latest
steps:
- name: 'Allow long file path'
run: git config --system core.longpaths true
- uses: actions/checkout@v1
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 2.1.*
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.*
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 5.0.*
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.*
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.*
- uses: actions/checkout@v2
- name: Cache .nuke/temp, ~/.nuget/packages
uses: actions/cache@v2
with:
Expand Down
23 changes: 4 additions & 19 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,13 @@ on:
- '!**/*.md'

jobs:
windows-2022:
name: windows-2022
runs-on: windows-2022
windows-latest:
name: windows-latest
runs-on: windows-latest
steps:
- name: 'Allow long file path'
run: git config --system core.longpaths true
- uses: actions/checkout@v1
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 2.1.*
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.*
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 5.0.*
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.*
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.*
- uses: actions/checkout@v2
- name: Cache .nuke/temp, ~/.nuget/packages
uses: actions/cache@v2
with:
Expand Down
9 changes: 5 additions & 4 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"properties": {
"ChocoApiKey": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secret [profile]'"
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"Configuration": {
"type": "string",
Expand All @@ -33,6 +33,7 @@
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
Expand All @@ -48,19 +49,19 @@
},
"MyGetApiKey": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secret [profile]'"
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"NpmAuthToken": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secret [profile]'"
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"NuGetApiKey": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secret [profile]'"
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"Partition": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ else {
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
}

Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"
Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"

ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ else
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
fi

echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"

"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"
13 changes: 3 additions & 10 deletions build/Build.CI.GitHubActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

[CustomGitHubActionsAttribute(
"pr",
GitHubActionsImage.WindowsServer2022,
GitHubActionsImage.WindowsLatest,
// GitHubActionsImage.UbuntuLatest,
// GitHubActionsImage.MacOsLatest,
OnPullRequestBranches = new[] { "master", "main" },
Expand All @@ -18,7 +18,7 @@
]
[CustomGitHubActionsAttribute(
"build",
GitHubActionsImage.WindowsServer2022,
GitHubActionsImage.WindowsLatest,
// GitHubActionsImage.UbuntuLatest,
// GitHubActionsImage.MacOsLatest,
OnPushBranches = new[] { "master", "main" },
Expand All @@ -45,14 +45,7 @@ protected override GitHubActionsJob GetJobs(GitHubActionsImage image, IReadOnlyC
var job = base.GetJobs(image, relevantTargets);

var newSteps = new List<GitHubActionsStep>(job.Steps);
foreach (var version in new[] { "7.0.*", "6.0.*", "5.0.*", "3.1.*", "2.1.*" })
{
newSteps.Insert(1, new GitHubActionsSetupDotNetStep
{
Version = version
});
}


newSteps.Insert(0, new GitHubActionsConfigureLongPathsStep());

job.Steps = newSteps.ToArray();
Expand Down
39 changes: 16 additions & 23 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Microsoft.Build.Evaluation;
using Microsoft.Build.Locator;
using Nuke.Common;
using Nuke.Common.Execution;
using Nuke.Common.Git;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
Expand All @@ -18,7 +17,6 @@
using Nuke.Common.Utilities.Collections;

using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Logger;
using static Nuke.Common.Tooling.ProcessTasks;
using static Nuke.Common.Tools.Chocolatey.ChocolateyTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
Expand All @@ -27,7 +25,6 @@
using static Nuke.Common.Tools.VSTest.VSTestTasks;
using Project = Nuke.Common.ProjectModel.Project;

[CheckBuildProjectConfigurations]
partial class Build : NukeBuild
{
public Build()
Expand Down Expand Up @@ -61,6 +58,7 @@ public Build()
[GitRepository] readonly GitRepository GitRepository;

AbsolutePath SourceDirectory => RootDirectory / "src";
AbsolutePath SamplesDirectory => RootDirectory / "samples";
AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";

AbsolutePath NSwagStudioBinaries => SourceDirectory / "NSwagStudio" / "bin" / Configuration;
Expand Down Expand Up @@ -114,6 +112,7 @@ protected override void OnBuildInitialized()
.Before(Restore)
.Executes(() =>
{
SamplesDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
EnsureCleanDirectory(ArtifactsDirectory);
});
Expand All @@ -124,7 +123,6 @@ protected override void OnBuildInitialized()
.Executes(() =>
{
Chocolatey("install wixtoolset -y");
Chocolatey("install netfx-4.6.1-devpack -y");
NpmInstall(x => x
.EnableGlobal()
.AddPackages("dotnettools")
Expand Down Expand Up @@ -174,7 +172,7 @@ protected override void OnBuildInitialized()
.SetFileVersion(VersionPrefix)
.SetInformationalVersion(VersionPrefix)
.SetConfiguration(Configuration)
.SetMaxCpuCount(Environment.ProcessorCount)
.SetMaxCpuCount(1) // wix's heat has problems
.SetNodeReuse(IsLocalBuild)
.SetVerbosity(MSBuildVerbosity.Minimal)
.SetProperty("Deterministic", IsServerBuild)
Expand Down Expand Up @@ -235,9 +233,6 @@ protected override void OnBuildInitialized()
// project name + runtime pairs
var dotnetTargets = new[]
{
("NSwag.Sample.NETCore21", "NetCore21"),
("NSwag.Sample.NETCore31", "NetCore31"),
("NSwag.Sample.NET50", "Net50"),
("NSwag.Sample.NET60", "Net60"),
("NSwag.Sample.NET60Minimal", "Net60"),
("NSwag.Sample.NET70", "Net70"),
Expand Down Expand Up @@ -321,13 +316,14 @@ void NSwagRun(

var samplesPath = RootDirectory / "samples";
var sampleSolution = ProjectModelTasks.ParseSolution(samplesPath / "Samples.sln");
NSwagRun(sampleSolution.GetProject("Sample.AspNetCore21"), "nswag_assembly", "NetCore21", Configuration.Release, true);
NSwagRun(sampleSolution.GetProject("Sample.AspNetCore21"), "nswag_project", "NetCore21", Configuration.Release, false);
NSwagRun(sampleSolution.GetProject("Sample.AspNetCore21"), "nswag_reflection", "NetCore21", Configuration.Release, true);

NSwagRun(sampleSolution.GetProject("Sample.AspNetCore21"), "nswag_assembly", "NetCore21", Configuration.Debug, true);
NSwagRun(sampleSolution.GetProject("Sample.AspNetCore21"), "nswag_project", "NetCore21", Configuration.Debug, false);
NSwagRun(sampleSolution.GetProject("Sample.AspNetCore21"), "nswag_reflection", "NetCore21", Configuration.Debug, true);
var sampleProject = sampleSolution.GetProject(new Guid("55E2BF82-3ECE-45E2-96BD-65C09C42843D"));
NSwagRun(sampleProject, "nswag_assembly", "Net60", Configuration.Release, true);
NSwagRun(sampleProject, "nswag_project", "Net60", Configuration.Release, false);
NSwagRun(sampleProject, "nswag_reflection", "Net60", Configuration.Release, true);

NSwagRun(sampleProject, "nswag_assembly", "Net60", Configuration.Debug, true);
NSwagRun(sampleProject, "nswag_project", "Net60", Configuration.Debug, false);
NSwagRun(sampleProject, "nswag_reflection", "Net60", Configuration.Debug, true);
});

void PublishAndCopyConsoleProjects()
Expand Down Expand Up @@ -355,23 +351,20 @@ void PublishConsoleProject(Nuke.Common.ProjectModel.Project project, string[] ta
}
}

PublishConsoleProject(consoleX86Project, new[] { "net461" });
PublishConsoleProject(consoleProject, new[] { "net461" });
PublishConsoleProject(consoleCoreProject, new[] { "netcoreapp2.1", "netcoreapp3.1", "net5.0", "net6.0", "net7.0" });
PublishConsoleProject(consoleX86Project, new[] { "net462" });
PublishConsoleProject(consoleProject, new[] { "net462" });
PublishConsoleProject(consoleCoreProject, new[] { "net6.0", "net7.0" });

void CopyConsoleBinaries(AbsolutePath target)
{
// take just exe from X86 as other files are shared with console project
var consoleX86Directory = consoleX86Project.Directory / "bin" / Configuration / "net461" / "publish";
var consoleX86Directory = consoleX86Project.Directory / "bin" / Configuration / "net462" / "publish";
CopyFileToDirectory(consoleX86Directory / "NSwag.x86.exe", target / "Win");
CopyFileToDirectory(consoleX86Directory / "NSwag.x86.exe.config", target / "Win");

CopyDirectoryRecursively(consoleProject.Directory / "bin" / Configuration / "net461" / "publish", target / "Win", DirectoryExistsPolicy.Merge);
CopyDirectoryRecursively(consoleProject.Directory / "bin" / Configuration / "net462" / "publish", target / "Win", DirectoryExistsPolicy.Merge);

var consoleCoreDirectory = consoleCoreProject.Directory / "bin" / Configuration;
CopyDirectoryRecursively(consoleCoreDirectory / "netcoreapp2.1" / "publish", target / "NetCore21");
CopyDirectoryRecursively(consoleCoreDirectory / "netcoreapp3.1" / "publish", target / "NetCore31");
CopyDirectoryRecursively(consoleCoreDirectory / "net5.0" / "publish", target / "Net50");
CopyDirectoryRecursively(consoleCoreDirectory / "net6.0" / "publish", target / "Net60");
CopyDirectoryRecursively(consoleCoreDirectory / "net7.0" / "publish", target / "Net70");
}
Expand Down
15 changes: 14 additions & 1 deletion build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,25 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nuke.Common" Version="6.0.1" />
<PackageReference Include="Nuke.Common" Version="6.2.1" />
</ItemGroup>

<ItemGroup>
<PackageDownload Include="Microsoft.TestPlatform" Version="[17.0.0]" />
<PackageDownload Include="NuGet.CommandLine" Version="[6.0.0]" />
</ItemGroup>

<ItemGroup>
<None Remove="..\.nuke\temp\build.log" />
<None Remove="..\.nuke\temp\build.2022-11-26_12-02-37.log" />
<None Remove="..\.nuke\temp\build.2022-11-26_12-03-07.log" />
<None Remove="..\.nuke\temp\build.2022-11-26_12-04-20.log" />
<None Remove="..\.nuke\temp\build.2022-11-26_12-17-58.log" />
<None Remove="..\.nuke\temp\build.2022-11-26_12-35-51.log" />
</ItemGroup>

<ItemGroup>
<Folder Include="logs" />
</ItemGroup>

</Project>
13 changes: 3 additions & 10 deletions samples/Samples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.AspNetCore20", "WithoutMiddleware\Sample.AspNetCore20\Sample.AspNetCore20.csproj", "{5A204483-5A44-4B80-8B0B-A58284CC4CCB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.AspNetCore21", "WithoutMiddleware\Sample.AspNetCore21\Sample.AspNetCore21.csproj", "{55E2BF82-3ECE-45E2-96BD-65C09C42843D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.AspNetCore60", "WithoutMiddleware\Sample.AspNetCore60\Sample.AspNetCore60.csproj", "{55E2BF82-3ECE-45E2-96BD-65C09C42843D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.NetOwinMiddleware", "WithMiddleware\Sample.NetOwinMiddleware\Sample.NetOwinMiddleware.csproj", "{F8839807-B6F6-41E3-BC98-DFAD3C03085E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WithMiddleware", "WithMiddleware", "{29EDA9F6-189B-4F96-B5BE-B7B82EB8A62A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WithoutMiddleware", "WithoutMiddleware", "{BF07E900-C7DE-4ADA-8563-E09E6B5AACF0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.AspNetCore31", "WithMiddleware\Sample.AspNetCore31\Sample.AspNetCore31.csproj", "{2F6620B8-D19D-4710-AAB9-4E2B785F5FA5}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.AspNetCore60", "WithMiddleware\Sample.AspNetCore60\Sample.AspNetCore60.csproj", "{2F6620B8-D19D-4710-AAB9-4E2B785F5FA5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.AspNetCore31.Client", "WithMiddleware\Sample.AspNetCore31.Client\Sample.AspNetCore31.Client.csproj", "{F9A962BB-9E7A-4FBD-9309-FF27A03856D6}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.AspNetCore60.Client", "WithMiddleware\Sample.AspNetCore60.Client\Sample.AspNetCore60.Client.csproj", "{F9A962BB-9E7A-4FBD-9309-FF27A03856D6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5A204483-5A44-4B80-8B0B-A58284CC4CCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A204483-5A44-4B80-8B0B-A58284CC4CCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A204483-5A44-4B80-8B0B-A58284CC4CCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A204483-5A44-4B80-8B0B-A58284CC4CCB}.Release|Any CPU.Build.0 = Release|Any CPU
{55E2BF82-3ECE-45E2-96BD-65C09C42843D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{55E2BF82-3ECE-45E2-96BD-65C09C42843D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{55E2BF82-3ECE-45E2-96BD-65C09C42843D}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -48,7 +42,6 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{5A204483-5A44-4B80-8B0B-A58284CC4CCB} = {BF07E900-C7DE-4ADA-8563-E09E6B5AACF0}
{55E2BF82-3ECE-45E2-96BD-65C09C42843D} = {BF07E900-C7DE-4ADA-8563-E09E6B5AACF0}
{F8839807-B6F6-41E3-BC98-DFAD3C03085E} = {29EDA9F6-189B-4F96-B5BE-B7B82EB8A62A}
{2F6620B8-D19D-4710-AAB9-4E2B785F5FA5} = {29EDA9F6-189B-4F96-B5BE-B7B82EB8A62A}
Expand Down
10 changes: 0 additions & 10 deletions samples/WithMiddleware/Sample.AspNetCore21.Nginx/.dockerignore

This file was deleted.

Loading

0 comments on commit c6ffb68

Please sign in to comment.