Merge branch 'netcore/netcore' into netcore/linting

This commit is contained in:
James Jackson-South
2020-12-02 16:19:37 +00:00
committed by GitHub
8 changed files with 252 additions and 76 deletions

244
build/azure-pipelines.yml Normal file
View File

@@ -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()

View File

@@ -48,7 +48,7 @@ namespace Umbraco.Tests.Common
public TypeLoader GetMockedTypeLoader()
{
return new TypeLoader(Mock.Of<ITypeFinder>(), Mock.Of<IAppPolicyCache>(), new DirectoryInfo(IOHelper.MapPath("~/App_Data/TEMP")), Mock.Of<ILogger<TypeLoader>>(), Mock.Of<IProfilingLogger>());
return new TypeLoader(Mock.Of<ITypeFinder>(), Mock.Of<IAppPolicyCache>(), new DirectoryInfo(GetHostingEnvironment().MapPathContentRoot("~/App_Data/TEMP")), Mock.Of<ILogger<TypeLoader>>(), Mock.Of<IProfilingLogger>());
}
// public Configs GetConfigs() => GetConfigsFactory().Create();

View File

@@ -68,7 +68,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Components
private static TypeLoader MockTypeLoader()
{
var ioHelper = IOHelper;
return new TypeLoader(Mock.Of<ITypeFinder>(), Mock.Of<IAppPolicyCache>(), new DirectoryInfo(ioHelper.MapPath("~/App_Data/TEMP")), Mock.Of<ILogger<TypeLoader>>(), Mock.Of<IProfilingLogger>());
return new TypeLoader(Mock.Of<ITypeFinder>(), Mock.Of<IAppPolicyCache>(), new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot("~/App_Data/TEMP")), Mock.Of<ILogger<TypeLoader>>(), Mock.Of<IProfilingLogger>());
}
@@ -83,7 +83,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Components
var composers = new Composers(composition, types, Enumerable.Empty<Attribute>(), Mock.Of<ILogger<Composers>>());
Composed.Clear();
// 2 is Core and requires 4
// 3 is User
// 3 is User
// => reorder components accordingly
composers.Compose();
AssertTypeArray(TypeArray<Composer1, Composer4, Composer2>(), 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<ILogger<TypeLoader>>(), Mock.Of<IProfilingLogger>());
var typeLoader = new TypeLoader(typeFinder, AppCaches.Disabled.RuntimeCache, new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot("~/App_Data/TEMP")), Mock.Of<ILogger<TypeLoader>>(), Mock.Of<IProfilingLogger>());
var register = MockRegister();
var builder = new UmbracoBuilder(register, Mock.Of<IConfiguration>(), TestHelper.GetMockedTypeLoader());
var allComposers = typeLoader.GetTypes<IComposer>().ToList();
var types = allComposers.Where(x => x.FullName.StartsWith("Umbraco.Core.") || x.FullName.StartsWith("Umbraco.Web")).ToList();

View File

@@ -23,8 +23,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Composing
ProfilingLogger = new ProfilingLogger(Mock.Of<ILogger<ProfilingLogger>>(), Mock.Of<IProfiler>());
var typeFinder = TestHelper.GetTypeFinder();
var ioHelper = TestHelper.IOHelper;
TypeLoader = new TypeLoader(typeFinder, NoAppCache.Instance, new DirectoryInfo(ioHelper.MapPath("~/App_Data/TEMP")), Mock.Of<ILogger<TypeLoader>>(), ProfilingLogger, false, AssembliesToScan);
TypeLoader = new TypeLoader(typeFinder, NoAppCache.Instance, new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot("~/App_Data/TEMP")), Mock.Of<ILogger<TypeLoader>>(), ProfilingLogger, false, AssembliesToScan);
}
protected virtual IEnumerable<Assembly> AssembliesToScan

View File

@@ -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<ILogger<TypeLoader>>(), new ProfilingLogger(Mock.Of<ILogger<ProfilingLogger>>(), Mock.Of<IProfiler>()), false,
// for testing, we'll specify which assemblies are scanned for the PluginTypeResolver

View File

@@ -135,31 +135,7 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Content Include="Config\grid.editors.config.js" />
<Content Include="Config\Lang\cs-CZ.user.xml" />
<Content Include="Config\Lang\da-DK.user.xml" />
<Content Include="Config\Lang\de-DE.user.xml" />
<Content Include="Config\Lang\en-GB.user.xml" />
<Content Include="Config\Lang\en-US.user.xml" />
<Content Include="Config\Lang\es-ES.user.xml" />
<Content Include="Config\Lang\fr-FR.user.xml" />
<Content Include="Config\Lang\he-IL.user.xml" />
<Content Include="Config\Lang\it-IT.user.xml" />
<Content Include="Config\Lang\ja-JP.user.xml" />
<Content Include="Config\Lang\ko-KR.user.xml" />
<Content Include="Config\Lang\nl-NL.user.xml" />
<Content Include="Config\Lang\nb-NO.user.xml" />
<Content Include="Config\Lang\pl-PL.user.xml" />
<Content Include="Config\Lang\pt-BR.user.xml" />
<Content Include="Config\Lang\ru-RU.user.xml" />
<Content Include="Config\Lang\sv-SE.user.xml" />
<Content Include="Config\Lang\zh-CN.user.xml" />
<None Include="Config\splashes\NoNodes.cshtml" />
<Content Include="Umbraco\Config\Lang\cs.xml" />
<Content Include="Umbraco\Config\Lang\cy.xml" />
<Content Include="Umbraco\Config\Lang\tr.xml" />
<Content Include="Umbraco\Config\Lang\zh_tw.xml" />
<Content Include="Umbraco\Install\Views\Web.config" />
<None Include="Config\ClientDependency.Release.config">
<DependentUpon>ClientDependency.config</DependentUpon>
<SubType>Designer</SubType>
@@ -190,7 +166,6 @@
<DependentUpon>serilog.config</DependentUpon>
<SubType>Designer</SubType>
</None>
<Content Include="Config\logviewer.searches.config.js" />
<Content Include="Media\Web.config" />
<Content Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>

View File

@@ -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%'"
}
]

View File

@@ -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}"