diff --git a/build/azure-pipelines.yml b/build/azure-pipelines.yml new file mode 100644 index 0000000000..8a99f941b0 --- /dev/null +++ b/build/azure-pipelines.yml @@ -0,0 +1,244 @@ +############################################################################# +## ASP.NET Core ## +## Build and test ASP.NET Core projects targeting .NET Core. ## +## Runs tests, creates NuGet packages: ## +## https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core ## +############################################################################# + +# Variables & their default values +variables: + buildConfiguration: 'Release' + +stages: +- stage: Linux + dependsOn: [] # this removes the implicit dependency on previous stage and causes this to run in parallel + jobs: + + - job: Unit_Tests + displayName: 'Unit Tests' + pool: + vmImage: 'ubuntu-latest' + steps: + + - task: UseDotNet@2 + displayName: 'Use .Net Core sdk 3.1.x' + inputs: + version: 3.1.x + + - task: DotNetCoreCLI@2 + displayName: 'dotnet test' + inputs: + command: test + projects: '**/*.Tests.UnitTests.csproj' + +- stage: macOS_X + dependsOn: [] # this removes the implicit dependency on previous stage and causes this to run in parallel + jobs: + + - job: Unit_Tests + displayName: 'Unit Tests' + pool: + vmImage: 'macOS-latest' + steps: + + - task: UseDotNet@2 + displayName: 'Use .Net Core sdk 3.1.x' + inputs: + version: 3.1.x + + - task: DotNetCoreCLI@2 + displayName: 'dotnet test' + inputs: + command: test + projects: '**/*.Tests.UnitTests.csproj' + + +- stage: Windows + dependsOn: [] # this removes the implicit dependency on previous stage and causes this to run in parallel + jobs: + + - job: Unit_Tests + displayName: 'Unit Tests' + pool: + vmImage: 'windows-latest' + steps: + + - task: UseDotNet@2 + displayName: 'Use .Net Core sdk 3.1.x' + inputs: + version: 3.1.x + + - task: DotNetCoreCLI@2 + displayName: 'dotnet test' + inputs: + command: test + projects: '**\*.Tests.UnitTests.csproj' + + + - job: Integration_Tests + timeoutInMinutes: 120 + displayName: 'Integration Tests' + pool: + vmImage: 'windows-latest' + steps: + + - task: UseDotNet@2 + displayName: 'Use .Net Core sdk 3.1.x' + inputs: + version: 3.1.x + + - task: DotNetCoreCLI@2 + displayName: 'dotnet build' + inputs: + projects: '**\Umbraco.Tests.Integration.csproj' + + - powershell: 'sqllocaldb start mssqllocaldb' + displayName: 'Start MSSQL LocalDb' + + - task: DotNetCoreCLI@2 + displayName: 'dotnet test' + inputs: + command: test + projects: '**\Umbraco.Tests.Integration.csproj' + arguments: '--no-build' + + + - job: Build_Artifacts + displayName: 'Build Artifacts' + pool: + vmImage: 'windows-latest' + steps: + + - task: UseDotNet@2 + displayName: 'Use .Net Core sdk 3.1.x' + inputs: + version: 3.1.x + + - task: NuGetToolInstaller@1 + displayName: 'Use NuGet Latest' + + - task: NuGetCommand@2 + displayName: 'Restore NuGet Packages' + inputs: + restoreSolution: '*\src\umbraco.sln' + feedsToUse: config + + - task: PowerShell@1 + displayName: 'Update Version' + condition: eq(variables['Umbraco.IsReleaseBuild'], 'false') + inputs: + scriptType: inlineScript + inlineScript: | + Write-Host "Working folder: $pwd" + $ubuild = build/build.ps1 -get -continue + + $version = $ubuild.GetUmbracoVersion() + if ($version.Comment -ne "") + { + # 8.0.0-beta.33.1234 + $continuous = "$($version.Semver).$(Build.BuildNumber)" + } + else + { + # 8.0.0-alpha.1234 + $continuous = "$($version.Release)-alpha.$(Build.BuildNumber)" + } + $ubuild.SetUmbracoVersion($continuous) + Write-Host "Building: $continuous" + + - task: PowerShell@1 + displayName: 'Prepare Build' + inputs: + scriptType: inlineScript + inlineScript: | + Write-Host "Working folder: $pwd" + $ubuild = build\build.ps1 -get + + $ubuild.PrepareBuild("vso") + + - task: NodeTool@0 + displayName: 'Use Node 11.x' + inputs: + versionSpec: 11.x + + - task: Npm@1 + displayName: 'npm install' + inputs: + workingDir: src\Umbraco.Web.UI.Client + verbose: false + + - task: gulp@0 + displayName: 'gulp build' + inputs: + gulpFile: src\Umbraco.Web.UI.Client\gulpfile.js + targets: build + workingDirectory: src\Umbraco.Web.UI.Client + publishJUnitResults: true + testResultsFiles: '**\TESTS-*.xml' + + - task: PowerShell@1 + displayName: 'Prepare Packages & Zip' + inputs: + scriptType: inlineScript + inlineScript: | + Write-Host "Working folder: $pwd" + $ubuild = build\build.ps1 -get -continue + + $ubuild.CompileUmbraco() + $ubuild.PreparePackages() + $ubuild.PackageZip() + + - task: CopyFiles@2 + displayName: 'Copy Zip Files to Staging' + inputs: + SourceFolder: build.out + Contents: '*.zip' + TargetFolder: '$(build.artifactstagingdirectory)' + CleanTargetFolder: true + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Zip Files' + inputs: + PathtoPublish: '$(build.artifactstagingdirectory)' + ArtifactName: zips + + - task: PowerShell@1 + displayName: 'Verify & Package NuGet' + inputs: + scriptType: inlineScript + inlineScript: | + Write-Host "Working folder: $pwd" + $ubuild = build\build.ps1 -get -continue + + $ubuild.VerifyNuGet() + $ubuild.PackageNuGet() + + - task: CopyFiles@2 + displayName: 'Copy NuPkg Files to Staging' + inputs: + SourceFolder: build.out + Contents: '*.nupkg' + TargetFolder: '$(build.artifactstagingdirectory)' + CleanTargetFolder: true + + - task: PublishBuildArtifacts@1 + displayName: 'Publish NuPkg Files' + inputs: + PathtoPublish: '$(build.artifactstagingdirectory)' + ArtifactName: nupkg + + - task: CopyFiles@2 + displayName: 'Copy Log Files to Staging' + inputs: + SourceFolder: build.tmp + Contents: '*.log' + TargetFolder: '$(build.artifactstagingdirectory)' + CleanTargetFolder: true + condition: succeededOrFailed() + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Log Files' + inputs: + PathtoPublish: '$(build.artifactstagingdirectory)' + ArtifactName: logs + condition: succeededOrFailed() diff --git a/src/Umbraco.Tests.Common/TestHelperBase.cs b/src/Umbraco.Tests.Common/TestHelperBase.cs index f4f55c1de8..24759f9ffb 100644 --- a/src/Umbraco.Tests.Common/TestHelperBase.cs +++ b/src/Umbraco.Tests.Common/TestHelperBase.cs @@ -48,7 +48,7 @@ namespace Umbraco.Tests.Common public TypeLoader GetMockedTypeLoader() { - return new TypeLoader(Mock.Of(), Mock.Of(), new DirectoryInfo(IOHelper.MapPath("~/App_Data/TEMP")), Mock.Of>(), Mock.Of()); + return new TypeLoader(Mock.Of(), Mock.Of(), new DirectoryInfo(GetHostingEnvironment().MapPathContentRoot("~/App_Data/TEMP")), Mock.Of>(), Mock.Of()); } // public Configs GetConfigs() => GetConfigsFactory().Create(); diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs index 4cc2a54327..4a6c73c8c4 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs @@ -68,7 +68,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Components private static TypeLoader MockTypeLoader() { var ioHelper = IOHelper; - return new TypeLoader(Mock.Of(), Mock.Of(), new DirectoryInfo(ioHelper.MapPath("~/App_Data/TEMP")), Mock.Of>(), Mock.Of()); + return new TypeLoader(Mock.Of(), Mock.Of(), new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot("~/App_Data/TEMP")), Mock.Of>(), Mock.Of()); } @@ -83,7 +83,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Components var composers = new Composers(composition, types, Enumerable.Empty(), Mock.Of>()); Composed.Clear(); // 2 is Core and requires 4 - // 3 is User + // 3 is User // => reorder components accordingly composers.Compose(); AssertTypeArray(TypeArray(), Composed); @@ -377,13 +377,12 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Components [Test] public void AllComposers() { - var ioHelper = IOHelper; var typeFinder = TestHelper.GetTypeFinder(); - var typeLoader = new TypeLoader(typeFinder, AppCaches.Disabled.RuntimeCache, new DirectoryInfo(ioHelper.MapPath("~/App_Data/TEMP")), Mock.Of>(), Mock.Of()); + var typeLoader = new TypeLoader(typeFinder, AppCaches.Disabled.RuntimeCache, new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot("~/App_Data/TEMP")), Mock.Of>(), Mock.Of()); var register = MockRegister(); var builder = new UmbracoBuilder(register, Mock.Of(), TestHelper.GetMockedTypeLoader()); - + var allComposers = typeLoader.GetTypes().ToList(); var types = allComposers.Where(x => x.FullName.StartsWith("Umbraco.Core.") || x.FullName.StartsWith("Umbraco.Web")).ToList(); diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/ComposingTestBase.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/ComposingTestBase.cs index 66d55cda39..43760d1c6c 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/ComposingTestBase.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/ComposingTestBase.cs @@ -23,8 +23,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Composing ProfilingLogger = new ProfilingLogger(Mock.Of>(), Mock.Of()); var typeFinder = TestHelper.GetTypeFinder(); - var ioHelper = TestHelper.IOHelper; - TypeLoader = new TypeLoader(typeFinder, NoAppCache.Instance, new DirectoryInfo(ioHelper.MapPath("~/App_Data/TEMP")), Mock.Of>(), ProfilingLogger, false, AssembliesToScan); + TypeLoader = new TypeLoader(typeFinder, NoAppCache.Instance, new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot("~/App_Data/TEMP")), Mock.Of>(), ProfilingLogger, false, AssembliesToScan); } protected virtual IEnumerable AssembliesToScan diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeLoaderTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeLoaderTests.cs index 8486dabcbf..20e9f8feef 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeLoaderTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeLoaderTests.cs @@ -28,7 +28,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Composing // this ensures it's reset var typeFinder = TestHelper.GetTypeFinder(); _typeLoader = new TypeLoader(typeFinder, NoAppCache.Instance, - new DirectoryInfo(TestHelper.IOHelper.MapPath("~/App_Data/TEMP")), + new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot("~/App_Data/TEMP")), Mock.Of>(), new ProfilingLogger(Mock.Of>(), Mock.Of()), false, // for testing, we'll specify which assemblies are scanned for the PluginTypeResolver diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 7e3565922f..78633bdf37 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -135,31 +135,7 @@ True Settings.settings - - - - - - - - - - - - - - - - - - - - - - - - ClientDependency.config Designer @@ -190,7 +166,6 @@ serilog.config Designer - SettingsSingleFileGenerator diff --git a/src/Umbraco.Web.UI/config/logviewer.searches.config.js b/src/Umbraco.Web.UI/config/logviewer.searches.config.js deleted file mode 100644 index 345fe23764..0000000000 --- a/src/Umbraco.Web.UI/config/logviewer.searches.config.js +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "name": "Find all logs where the Level is NOT Verbose and NOT Debug", - "query": "Not(@Level='Verbose') and Not(@Level='Debug')" - }, - { - "name": "Find all logs that has an exception property (Warning, Error & Fatal with Exceptions)", - "query": "Has(@Exception)" - }, - { - "name": "Find all logs that have the property 'Duration'", - "query": "Has(Duration)" - }, - { - "name": "Find all logs that have the property 'Duration' and the duration is greater than 1000ms", - "query": "Has(Duration) and Duration > 1000" - }, - { - "name": "Find all logs that are from the namespace 'Umbraco.Core'", - "query": "StartsWith(SourceContext, 'Umbraco.Core')" - }, - { - "name": "Find all logs that use a specific log message template", - "query": "@MessageTemplate = '[Timing {TimingId}] {EndMessage} ({TimingDuration}ms)'" - }, - { - "name": "Find logs where one of the items in the SortedComponentTypes property array is equal to", - "query": "SortedComponentTypes[?] = 'Umbraco.Web.Search.ExamineComponent'" - }, - { - "name": "Find logs where one of the items in the SortedComponentTypes property array contains", - "query": "Contains(SortedComponentTypes[?], 'DatabaseServer')" - }, - { - "name": "Find all logs that the message has localhost in it with SQL like", - "query": "@Message like '%localhost%'" - }, - { - "name": "Find all logs that the message that starts with 'end' in it with SQL like", - "query": "@Message like 'end%'" - } -] diff --git a/src/umbraco.sln b/src/umbraco.sln index 34a186aca1..f3d6aede87 100644 --- a/src/umbraco.sln +++ b/src/umbraco.sln @@ -17,6 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{2849E9D4 ..\linting\codeanalysis.tests.ruleset = ..\linting\codeanalysis.tests.ruleset ..\Directory.Build.props = ..\Directory.Build.props ..\Directory.Build.targets = ..\Directory.Build.targets + ..\build\azure-pipelines.yml = ..\build\azure-pipelines.yml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{FD962632-184C-4005-A5F3-E705D92FC645}"