Merge pull request #9459 from umbraco/netcore/feature/azure-yaml-pipeline
NetCore: Set up CI with Azure Pipelines
This commit is contained in:
221
build/azure-pipelines.yml
Normal file
221
build/azure-pipelines.yml
Normal file
@@ -0,0 +1,221 @@
|
||||
#############################################################################
|
||||
## 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: '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()
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -11,6 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{2849E9D4
|
||||
..\build\build.ps1 = ..\build\build.ps1
|
||||
..\NuGet.Config = ..\NuGet.Config
|
||||
SolutionInfo.cs = SolutionInfo.cs
|
||||
..\build\azure-pipelines.yml = ..\build\azure-pipelines.yml
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{FD962632-184C-4005-A5F3-E705D92FC645}"
|
||||
|
||||
Reference in New Issue
Block a user