diff --git a/Cake.Frosting.Issues.Recipe/Cake.Frosting.Issues.Recipe/Cake.Frosting.Issues.Recipe.csproj b/Cake.Frosting.Issues.Recipe/Cake.Frosting.Issues.Recipe/Cake.Frosting.Issues.Recipe.csproj index 681719e9..3ed7b88c 100644 --- a/Cake.Frosting.Issues.Recipe/Cake.Frosting.Issues.Recipe/Cake.Frosting.Issues.Recipe.csproj +++ b/Cake.Frosting.Issues.Recipe/Cake.Frosting.Issues.Recipe/Cake.Frosting.Issues.Recipe.csproj @@ -1,7 +1,7 @@ - net6.0;net7.0 + net6.0;net7.0;net8.0 bin\$(Configuration)\$(TargetFramework)\Cake.Frosting.Issues.Recipe.xml true AllEnabledByDefault diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a2865f8e..ee061042 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,12 +19,19 @@ jobs: - task: UseDotNet@2 inputs: version: '5.x' + displayName: 'Install .NET 5' - task: UseDotNet@2 inputs: version: '6.x' + displayName: 'Install .NET 6' - task: UseDotNet@2 inputs: version: '7.x' + displayName: 'Install .NET 7' + - task: UseDotNet@2 + inputs: + version: '8.x' + displayName: 'Install .NET 8' - powershell: ./build.ps1 displayName: 'Build' - publish: $(Build.SourcesDirectory)/BuildArtifacts/Packages/NuGet @@ -40,6 +47,7 @@ jobs: - task: UseDotNet@2 inputs: version: '6.x' + displayName: 'Install .NET 6' - task: NodeTool@0 inputs: versionSpec: '14.x' @@ -70,6 +78,7 @@ jobs: - task: UseDotNet@2 inputs: version: '7.x' + displayName: 'Install .NET 7' - task: NodeTool@0 inputs: versionSpec: '14.x' @@ -90,6 +99,37 @@ jobs: - publish: $(Build.SourcesDirectory)/tests/frosting/net7.0/build/BuildArtifacts/output artifact: Integration Tests Frosting Windows 2022 (.NET 7) displayName: 'Publish generated reports as build artifact' +# Integration Tests Frosting Windows (.NET 8) +- job: Test_Frosting_Windows_2022_Net8 + displayName: Integration Tests Frosting Windows 2022 (.NET 8) + dependsOn: Build + pool: + vmImage: 'windows-2022' + steps: + - task: UseDotNet@2 + inputs: + version: '8.x' + displayName: 'Install .NET 8' + - task: NodeTool@0 + inputs: + versionSpec: '14.x' + displayName: 'Install NodeJs 14.x' + - powershell: choco install markdownlint-cli --no-progress + displayName: 'Install required tools' + - download: current + artifact: NuGet Package + displayName: 'Download build artifact' + - task: CopyFiles@2 + inputs: + sourceFolder: $(Pipeline.Workspace)/NuGet Package + targetFolder: $(Build.SourcesDirectory)/BuildArtifacts/Packages/NuGet + displayName: 'Copy build artifact for test run' + - powershell: ./build.ps1 --verbosity=diagnostic + workingDirectory: ./tests/frosting/net8.0 + displayName: 'Run integration tests' + - publish: $(Build.SourcesDirectory)/tests/frosting/net8.0/build/BuildArtifacts/output + artifact: Integration Tests Frosting Windows 2022 (.NET 8) + displayName: 'Publish generated reports as build artifact' # Integration Tests Script Runner Windows 2019 (.NET Core tool) - job: Test_Script_Runner_Windows_2019_DotNetCoreTool displayName: Integration Tests Script Runner Windows 2019 (.NET Core tool) diff --git a/tests/frosting/net8.0/build.ps1 b/tests/frosting/net8.0/build.ps1 new file mode 100644 index 00000000..eace4c8f --- /dev/null +++ b/tests/frosting/net8.0/build.ps1 @@ -0,0 +1,13 @@ +$RECIPE_PACKAGE_PATH = "packages/cake.frosting.issues.recipe" +if (Test-Path $RECIPE_PACKAGE_PATH) +{ + Write-Host "Cleaning up cached version of $RECIPE_PACKAGE_PATH..." + Remove-Item $RECIPE_PACKAGE_PATH -Recurse; +} +else +{ + Write-Host "$RECIPE_PACKAGE_PATH not cached..." +} + +dotnet run --project build/Build.csproj -- $args +exit $LASTEXITCODE; \ No newline at end of file diff --git a/tests/frosting/net8.0/build.sh b/tests/frosting/net8.0/build.sh new file mode 100755 index 00000000..8dafc54e --- /dev/null +++ b/tests/frosting/net8.0/build.sh @@ -0,0 +1,11 @@ + +$RECIPE_PACKAGE_PATH = "packages/cake.frosting.issues.recipe" +if [ -d "$RECIPE_PACKAGE_PATH" ] +then + echo "Cleaning up cached version of $RECIPE_PACKAGE_PATH..." + rm -Rf $RECIPE_PACKAGE_PATH +else + echo "$RECIPE_PACKAGE_PATH not cached..." +fi + +dotnet run --project ./build/Build.csproj -- "$@" diff --git a/tests/frosting/net8.0/build/.gitignore b/tests/frosting/net8.0/build/.gitignore new file mode 100644 index 00000000..29cb0b57 --- /dev/null +++ b/tests/frosting/net8.0/build/.gitignore @@ -0,0 +1,2 @@ +### Cake ### +tools/* \ No newline at end of file diff --git a/tests/frosting/net8.0/build/Build.csproj b/tests/frosting/net8.0/build/Build.csproj new file mode 100644 index 00000000..391daf3b --- /dev/null +++ b/tests/frosting/net8.0/build/Build.csproj @@ -0,0 +1,11 @@ + + + Exe + net8.0 + $(MSBuildProjectDirectory) + + + + + + \ No newline at end of file diff --git a/tests/frosting/net8.0/build/Program.cs b/tests/frosting/net8.0/build/Program.cs new file mode 100644 index 00000000..e6ec3709 --- /dev/null +++ b/tests/frosting/net8.0/build/Program.cs @@ -0,0 +1,125 @@ +using System; +using System.Reflection; +using Cake.Common; +using Cake.Common.Diagnostics; +using Cake.Common.Tools.InspectCode; +using Cake.Core; +using Cake.Core.Diagnostics; +using Cake.Core.IO; +using Cake.Frosting; +using Cake.Frosting.Issues.Recipe; + +public static class Program +{ + public static int Main(string[] args) + { + return new CakeHost() + .UseContext() + .UseLifetime() + .InstallTool(new Uri("nuget:?package=JetBrains.ReSharper.CommandLineTools")) + // Register Cake.Frosting.Issues.Recipe tasks. + .AddAssembly(Assembly.GetAssembly(typeof(IssuesTask))) + .Run(args); + } +} + +public class BuildContext : IssuesContext +{ + public BuildContext(ICakeContext context) + : base(context) + { + } + + protected override BuildParameters CreateIssuesParameters() + { + return new BuildParameters(); + } + + protected override BuildState CreateIssuesState() + { + return new BuildState(this); + } +} + +public class BuildParameters : IssuesParameters +{ + public DirectoryPath LogDirectoryPath => this.OutputDirectory.Combine("logs"); + + public BuildParameters() + { + this.OutputDirectory = this.OutputDirectory.Combine("output"); + } +} + +public class BuildState : IssuesState +{ + public FilePath SolutionFilePath { get; } + + public BuildState(BuildContext context) + : base(context, RepositoryInfoProviderType.Cli) + { + this.SolutionFilePath = + this.ProjectRootDirectory + .Combine("src") + .CombineWithFilePath("ClassLibrary1.sln"); + } +} + +public class Lifetime : FrostingLifetime +{ + public override void Setup(BuildContext context, ISetupContext info) + { + // Determine Build Identifier + var platform = context.Environment.Platform.Family.ToString(); + var runtime = context.Environment.Runtime.IsCoreClr ? ".NET Core" : ".NET Framework"; + + context.Parameters.BuildIdentifier = $"Cake Frosting {platform} ({runtime})"; + + context.Information("Build identifier: {0}", context.Parameters.BuildIdentifier); + } + + public override void Teardown(BuildContext context, ITeardownContext info) + { + } +} + +[TaskName("Run-InspectCode")] +public sealed class RunInspectCodeTask : FrostingTask +{ + public override bool ShouldRun(BuildContext context) + { + return context.IsRunningOnWindows(); + } + + public override void Run(BuildContext context) + { + // Run InspectCode. + var inspectCodeLogFilePath = context.Parameters.LogDirectoryPath.CombineWithFilePath("inspectCode.log"); + + var settings = new InspectCodeSettings() { + OutputFile = inspectCodeLogFilePath, + ArgumentCustomization = x => x.Append("--no-build"), + WorkingDirectory = context.State.ProjectRootDirectory + }; + + context.InspectCode( + context.State.SolutionFilePath, + settings); + + // Pass path to InspectCode log file to Cake.Frosting.Issues.Recipe. + context.Parameters.InputFiles.AddInspectCodeLogFile(inspectCodeLogFilePath); + } +} + +[TaskName("Lint")] +[IsDependentOn(typeof(RunInspectCodeTask))] +[IsDependeeOf(typeof(ReadIssuesTask))] +public class LintTask : FrostingTask +{ +} + +[TaskName("Default")] +[IsDependentOn(typeof(IssuesTask))] +public class DefaultTask : FrostingTask +{ +} diff --git a/tests/frosting/net8.0/nuget.config b/tests/frosting/net8.0/nuget.config new file mode 100644 index 00000000..663b555f --- /dev/null +++ b/tests/frosting/net8.0/nuget.config @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/frosting/net8.0/src/ClassLibrary1.sln b/tests/frosting/net8.0/src/ClassLibrary1.sln new file mode 100644 index 00000000..62df92e3 --- /dev/null +++ b/tests/frosting/net8.0/src/ClassLibrary1.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "ClassLibrary1\ClassLibrary1.csproj", "{9B73BB5B-06A3-46F3-9068-E3607A8217B0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tests/frosting/net8.0/src/ClassLibrary1/Class1.cs b/tests/frosting/net8.0/src/ClassLibrary1/Class1.cs new file mode 100644 index 00000000..4ea00049 --- /dev/null +++ b/tests/frosting/net8.0/src/ClassLibrary1/Class1.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ClassLibrary1 +{ + public class Class1 + { + public void Foo() + { + var foo = "foo"; + var bar = "bar"; + if (!string.IsNullOrEmpty(foo) && !string.IsNullOrEmpty(bar)) + { + var foobar = foo + bar; + } + } + + public void Bar() + { + var foo = "foo"; + var bar = "bar"; + if (!string.IsNullOrEmpty(foo) && !string.IsNullOrEmpty(bar)) + { + var foobar = foo + bar; + } + } + } +} diff --git a/tests/frosting/net8.0/src/ClassLibrary1/ClassLibrary1.csproj b/tests/frosting/net8.0/src/ClassLibrary1/ClassLibrary1.csproj new file mode 100644 index 00000000..9ec4dd90 --- /dev/null +++ b/tests/frosting/net8.0/src/ClassLibrary1/ClassLibrary1.csproj @@ -0,0 +1,21 @@ + + + + netstandard2.0 + + + + + all + 3.0.0 + + + all + 1.1.118 + + + + + + + \ No newline at end of file