760 lines
33 KiB
YAML
760 lines
33 KiB
YAML
name: $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
|
|
|
|
parameters:
|
|
- name: sqlServerIntegrationTests
|
|
displayName: Run SQL Server Integration Tests
|
|
type: boolean
|
|
default: false
|
|
- name: myGetDeploy
|
|
displayName: Deploy to MyGet
|
|
type: boolean
|
|
default: false
|
|
- name: nuGetDeploy
|
|
displayName: Deploy to NuGet
|
|
type: boolean
|
|
default: false
|
|
- name: npmDeploy
|
|
displayName: Deploy to Npm
|
|
type: boolean
|
|
default: false
|
|
- name: buildApiDocs
|
|
displayName: Build API docs
|
|
type: boolean
|
|
default: false
|
|
- name: uploadApiDocs
|
|
displayName: Upload API docs
|
|
type: boolean
|
|
default: false
|
|
- name: forceReleaseTestFilter
|
|
displayName: Force to use the release test filters
|
|
type: boolean
|
|
default: false
|
|
- name: integrationNonReleaseTestFilter
|
|
displayName: TestFilter used for non-release type builds
|
|
type: string
|
|
default: '--filter TestCategory!=LongRunning&TestCategory!=NonCritical'
|
|
- name: integrationReleaseTestFilter
|
|
displayName: TestFilter used for release type builds
|
|
type: string
|
|
default: ' '
|
|
- name: nonWindowsIntegrationNonReleaseTestFilter
|
|
displayName: TestFilter used for non-release type builds on non windows agents
|
|
type: string
|
|
default: '--filter TestCategory!=LongRunning&TestCategory!=NonCritical'
|
|
- name: nonWindowsIntegrationReleaseTestFilter
|
|
displayName: TestFilter used for release type builds on non windows agents
|
|
type: string
|
|
default: ' '
|
|
- name: isNightly
|
|
displayName: 'Is nightly build (used for MyGet feed)'
|
|
type: boolean
|
|
default: false
|
|
|
|
variables:
|
|
nodeVersion: 20
|
|
dotnetVersion: 8.x
|
|
dotnetIncludePreviewVersions: true
|
|
solution: umbraco.sln
|
|
buildConfiguration: Release
|
|
UMBRACO__CMS__GLOBAL__ID: 00000000-0000-0000-0000-000000000042
|
|
DOTNET_NOLOGO: true
|
|
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
|
|
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
|
|
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
|
|
|
stages:
|
|
###############################################
|
|
## Build
|
|
###############################################
|
|
- stage: Build
|
|
variables:
|
|
npm_config_cache: $(Pipeline.Workspace)/.npm_client
|
|
NODE_OPTIONS: --max_old_space_size=16384
|
|
jobs:
|
|
- job: A
|
|
displayName: Build Umbraco CMS
|
|
pool:
|
|
vmImage: 'ubuntu-latest'
|
|
steps:
|
|
- checkout: self
|
|
submodules: true
|
|
- task: NodeTool@0
|
|
displayName: Use Node.js $(nodeVersion)
|
|
retryCountOnTaskFailure: 3
|
|
inputs:
|
|
versionSpec: $(nodeVersion)
|
|
- task: Cache@2
|
|
displayName: Cache node_modules
|
|
inputs:
|
|
key: '"npm_client" | "$(Agent.OS)" | $(Build.SourcesDirectory)/src/Umbraco.Web.UI.Client/package-lock.json'
|
|
restoreKeys: |
|
|
"npm_client" | "$(Agent.OS)"
|
|
"npm_client"
|
|
path: $(npm_config_cache)
|
|
- script: npm ci --no-fund --no-audit --prefer-offline
|
|
workingDirectory: src/Umbraco.Web.UI.Client
|
|
displayName: Run npm ci (Backoffice)
|
|
- task: gulp@0
|
|
displayName: Run gulp build (Backoffice)
|
|
inputs:
|
|
gulpFile: src/Umbraco.Web.UI.Client/gulpfile.js
|
|
targets: coreBuild
|
|
workingDirectory: src/Umbraco.Web.UI.Client
|
|
- script: npm ci --no-fund --no-audit --prefer-offline
|
|
displayName: Run npm ci (Login)
|
|
workingDirectory: src/Umbraco.Web.UI.Login
|
|
- script: npm run build
|
|
displayName: Run npm build (Login)
|
|
workingDirectory: src/Umbraco.Web.UI.Login
|
|
- script: npm ci --no-fund --no-audit --prefer-offline
|
|
displayName: Run npm ci (Bellissima)
|
|
workingDirectory: src/Umbraco.Web.UI.New.Client
|
|
- script: npm run build:for:cms
|
|
displayName: Run build (Bellissima)
|
|
workingDirectory: src/Umbraco.Web.UI.New.Client
|
|
- script: npm run build
|
|
displayName: Run Login Build (Bellissima)
|
|
workingDirectory: src/Umbraco.Web.UI.New.Client/apps/auth
|
|
- task: UseDotNet@2
|
|
displayName: Use .NET $(dotnetVersion)
|
|
inputs:
|
|
version: $(dotnetVersion)
|
|
performMultiLevelLookup: true
|
|
includePreviewVersions: $(dotnetIncludePreviewVersions)
|
|
- task: DotNetCoreCLI@2
|
|
displayName: Run dotnet restore
|
|
inputs:
|
|
command: restore
|
|
projects: $(solution)
|
|
- task: DotNetCoreCLI@2
|
|
name: build
|
|
displayName: Run dotnet build and generate NuGet packages
|
|
inputs:
|
|
command: build
|
|
projects: $(solution)
|
|
arguments: '--configuration $(buildConfiguration) --no-restore --property:ContinuousIntegrationBuild=true --property:GeneratePackageOnBuild=true --property:PackageOutputPath=$(Build.ArtifactStagingDirectory)/nupkg'
|
|
- task: PublishPipelineArtifact@1
|
|
displayName: Publish nupkg
|
|
inputs:
|
|
targetPath: $(Build.ArtifactStagingDirectory)/nupkg
|
|
artifactName: nupkg
|
|
- task: PublishPipelineArtifact@1
|
|
displayName: Publish build artifacts
|
|
inputs:
|
|
targetPath: $(Build.SourcesDirectory)
|
|
artifactName: build_output
|
|
- bash: |
|
|
echo "##[command]Running npm version"
|
|
echo "##[debug]Version: $PACKAGE_VERSION"
|
|
echo "##[command]Running npm pack"
|
|
echo "##[debug]Output directory: $(Build.ArtifactStagingDirectory)"
|
|
npm version $PACKAGE_VERSION --allow-same-version --no-git-tag-version
|
|
mkdir $(Build.ArtifactStagingDirectory)/npm
|
|
npm pack --pack-destination $(Build.ArtifactStagingDirectory)/npm
|
|
mv .npmrc $(Build.ArtifactStagingDirectory)/npm/
|
|
displayName: Prepare Bellissima npm package
|
|
env:
|
|
PACKAGE_VERSION: $(build.NBGV_NpmPackageVersion)
|
|
workingDirectory: src/Umbraco.Web.UI.New.Client
|
|
- task: PublishPipelineArtifact@1
|
|
displayName: Publish Bellissima npm artifact
|
|
inputs:
|
|
targetPath: $(Build.ArtifactStagingDirectory)/npm
|
|
artifactName: npm
|
|
|
|
- stage: Build_Docs
|
|
condition: and(succeeded(), or(eq(dependencies.Build.outputs['A.build.NBGV_PublicRelease'], 'True'), ${{parameters.buildApiDocs}}))
|
|
displayName: Prepare API Documentation
|
|
dependsOn: Build
|
|
variables:
|
|
umbracoMajorVersion: $[ stageDependencies.Build.A.outputs['build.NBGV_VersionMajor'] ]
|
|
jobs:
|
|
# C# API Reference
|
|
- job:
|
|
displayName: Build C# API Reference
|
|
pool:
|
|
vmImage: 'windows-latest'
|
|
steps:
|
|
- task: UseDotNet@2
|
|
displayName: Use .NET $(dotnetVersion)
|
|
inputs:
|
|
version: $(dotnetVersion)
|
|
includePreviewVersions: $(dotnetIncludePreviewVersions)
|
|
- task: PowerShell@2
|
|
displayName: Install DocFX
|
|
inputs:
|
|
targetType: inline
|
|
script: |
|
|
choco install docfx --version=2.59.4 -y
|
|
if ($lastexitcode -ne 0){
|
|
throw ("Error installing DocFX")
|
|
}
|
|
- task: PowerShell@2
|
|
displayName: Generate metadata
|
|
inputs:
|
|
targetType: inline
|
|
script: |
|
|
docfx metadata "$(Build.SourcesDirectory)/build/csharp-docs/docfx.json"
|
|
if ($lastexitcode -ne 0){
|
|
throw ("Error generating metadata.")
|
|
}
|
|
- task: PowerShell@2
|
|
displayName: Generate documentation
|
|
inputs:
|
|
targetType: inline
|
|
script: |
|
|
docfx build "$(Build.SourcesDirectory)/build/csharp-docs/docfx.json"
|
|
if ($lastexitcode -ne 0){
|
|
throw ("Error generating documentation.")
|
|
}
|
|
- task: ArchiveFiles@2
|
|
displayName: Archive C# Docs
|
|
inputs:
|
|
rootFolderOrFile: $(Build.SourcesDirectory)/build/csharp-docs/_site
|
|
includeRootFolder: false
|
|
archiveFile: $(Build.ArtifactStagingDirectory)/csharp-docs.zip
|
|
- task: PublishPipelineArtifact@1
|
|
displayName: Publish C# Docs
|
|
inputs:
|
|
targetPath: $(Build.ArtifactStagingDirectory)/csharp-docs.zip
|
|
artifact: csharp-docs
|
|
|
|
# js API Reference
|
|
- job:
|
|
displayName: Build js API Reference
|
|
pool:
|
|
vmImage: 'ubuntu-latest'
|
|
variables:
|
|
npm_config_cache: $(Pipeline.Workspace)/.npm_client
|
|
NODE_OPTIONS: --max_old_space_size=16384
|
|
BASE_PATH: /v$(umbracoMajorVersion)/ui
|
|
steps:
|
|
- checkout: self
|
|
submodules: true
|
|
- task: NodeTool@0
|
|
displayName: Use Node.js $(nodeVersion)
|
|
retryCountOnTaskFailure: 3
|
|
inputs:
|
|
versionSpec: $(nodeVersion)
|
|
- task: Cache@2
|
|
displayName: Cache node_modules
|
|
inputs:
|
|
key: '"npm_client" | "$(Agent.OS)"| $(Build.SourcesDirectory)/src/Umbraco.Web.UI.Client/package-lock.json | $(Build.SourcesDirectory)/src/Umbraco.Web.UI.New.Client/package-lock.json'
|
|
restoreKeys: |
|
|
"npm_client" | "$(Agent.OS)"
|
|
"npm_client"
|
|
path: $(npm_config_cache)
|
|
- script: npm ci --no-fund --no-audit --prefer-offline
|
|
workingDirectory: src/Umbraco.Web.UI.New.Client
|
|
displayName: Run npm ci
|
|
- script: npm run storybook:build
|
|
displayName: Build Storybook
|
|
env:
|
|
VITE_BASE_PATH: $(BASE_PATH)/
|
|
workingDirectory: $(Build.SourcesDirectory)/src/Umbraco.Web.UI.New.Client
|
|
- script: sed -i "s|/umbraco/backoffice|$(BASE_PATH)/umbraco/backoffice|" assets/*.js
|
|
displayName: Replace BASE_PATH on assets
|
|
workingDirectory: $(Build.SourcesDirectory)/src/Umbraco.Web.UI.New.Client/storybook-static
|
|
- task: ArchiveFiles@2
|
|
displayName: Archive js Docs
|
|
inputs:
|
|
rootFolderOrFile: $(Build.SourcesDirectory)/src/Umbraco.Web.UI.New.Client/storybook-static
|
|
includeRootFolder: false
|
|
archiveFile: $(Build.ArtifactStagingDirectory)/ui-docs.zip
|
|
- task: PublishPipelineArtifact@1
|
|
displayName: Publish js Docs
|
|
inputs:
|
|
targetPath: $(Build.ArtifactStagingDirectory)/ui-docs.zip
|
|
artifact: ui-docs
|
|
|
|
###############################################
|
|
## Test
|
|
###############################################
|
|
- stage: Unit
|
|
displayName: Unit Tests
|
|
dependsOn: Build
|
|
jobs:
|
|
# Unit Tests
|
|
- job:
|
|
displayName: Unit Tests
|
|
strategy:
|
|
matrix:
|
|
Windows:
|
|
vmImage: 'windows-latest'
|
|
Linux:
|
|
vmImage: 'ubuntu-latest'
|
|
macOS:
|
|
vmImage: 'macOS-latest'
|
|
pool:
|
|
vmImage: $(vmImage)
|
|
steps:
|
|
- task: DownloadPipelineArtifact@2
|
|
displayName: Download build artifacts
|
|
inputs:
|
|
artifact: build_output
|
|
path: $(Build.SourcesDirectory)
|
|
- task: UseDotNet@2
|
|
displayName: Use .NET $(dotnetVersion)
|
|
inputs:
|
|
version: $(dotnetVersion)
|
|
performMultiLevelLookup: true
|
|
includePreviewVersions: $(dotnetIncludePreviewVersions)
|
|
- task: DotNetCoreCLI@2
|
|
displayName: Run dotnet test
|
|
inputs:
|
|
command: test
|
|
projects: '**/*.Tests.UnitTests.csproj'
|
|
arguments: '--configuration $(buildConfiguration) --no-build'
|
|
testRunTitle: Unit Tests - $(Agent.OS)
|
|
|
|
- stage: Integration
|
|
displayName: Integration Tests
|
|
dependsOn: Build
|
|
variables:
|
|
releaseTestFilter: eq(dependencies.Build.outputs['A.build.NBGV_PublicRelease'], 'True')
|
|
jobs:
|
|
# Integration Tests (SQLite)
|
|
- job:
|
|
displayName: Integration Tests (SQLite)
|
|
strategy:
|
|
matrix:
|
|
Windows:
|
|
vmImage: 'windows-latest'
|
|
Linux:
|
|
vmImage: 'ubuntu-latest'
|
|
macOS:
|
|
vmImage: 'macOS-latest'
|
|
pool:
|
|
vmImage: $(vmImage)
|
|
steps:
|
|
- checkout: self
|
|
submodules: true
|
|
- task: DownloadPipelineArtifact@2
|
|
displayName: Download build artifacts
|
|
inputs:
|
|
artifact: build_output
|
|
path: $(Build.SourcesDirectory)
|
|
- task: UseDotNet@2
|
|
displayName: Use .NET $(dotnetVersion)
|
|
inputs:
|
|
version: $(dotnetVersion)
|
|
performMultiLevelLookup: true
|
|
includePreviewVersions: $(dotnetIncludePreviewVersions)
|
|
- task: DotNetCoreCLI@2
|
|
displayName: Run dotnet test Windows
|
|
condition: eq(variables['Agent.OS'],'Windows_NT')
|
|
inputs:
|
|
command: test
|
|
projects: '**/*.Tests.Integration.csproj'
|
|
testRunTitle: Integration Tests SQLite - $(Agent.OS)
|
|
${{ if or(variables.releaseTestFilter, parameters.forceReleaseTestFilter) }}:
|
|
arguments: '--configuration $(buildConfiguration) --no-build ${{parameters.integrationReleaseTestFilter}}'
|
|
${{ else }}:
|
|
arguments: '--configuration $(buildConfiguration) ${{parameters.integrationNonReleaseTestFilter}}'
|
|
env:
|
|
Tests__Database__DatabaseType: 'Sqlite'
|
|
Umbraco__CMS__Global__MainDomLock: 'FileSystemMainDomLock'
|
|
- task: DotNetCoreCLI@2
|
|
displayName: Run dotnet test Non Windows
|
|
condition: ne(variables['Agent.OS'],'Windows_NT')
|
|
inputs:
|
|
command: test
|
|
projects: '**/*.Tests.Integration.csproj'
|
|
testRunTitle: Integration Tests SQLite - $(Agent.OS)
|
|
${{ if or(variables.releaseTestFilter, parameters.forceReleaseTestFilter) }}:
|
|
arguments: '--configuration $(buildConfiguration) --no-build ${{parameters.nonWindowsIntegrationReleaseTestFilter}}'
|
|
${{ else }}:
|
|
arguments: '--configuration $(buildConfiguration) ${{parameters.nonWindowsIntegrationNonReleaseTestFilter}}'
|
|
env:
|
|
Tests__Database__DatabaseType: 'Sqlite'
|
|
Umbraco__CMS__Global__MainDomLock: 'FileSystemMainDomLock'
|
|
|
|
# Integration Tests (SQL Server)
|
|
- job:
|
|
timeoutInMinutes: 180
|
|
condition: or(eq(stageDependencies.Build.A.outputs['build.NBGV_PublicRelease'], 'True'), ${{parameters.sqlServerIntegrationTests}})
|
|
displayName: Integration Tests (SQL Server)
|
|
strategy:
|
|
matrix:
|
|
Windows:
|
|
vmImage: 'windows-latest'
|
|
testDb: LocalDb
|
|
connectionString: N/A
|
|
Linux:
|
|
vmImage: 'ubuntu-latest'
|
|
testDb: SqlServer
|
|
connectionString: 'Server=localhost,1433;User Id=sa;Password=$(SA_PASSWORD);TrustServerCertificate=true'
|
|
pool:
|
|
vmImage: $(vmImage)
|
|
variables:
|
|
SA_PASSWORD: UmbracoIntegration123!
|
|
steps:
|
|
- task: DownloadPipelineArtifact@2
|
|
displayName: Download build artifacts
|
|
inputs:
|
|
artifact: build_output
|
|
path: $(Build.SourcesDirectory)
|
|
- task: UseDotNet@2
|
|
displayName: Use .NET $(dotnetVersion)
|
|
inputs:
|
|
version: $(dotnetVersion)
|
|
includePreviewVersions: $(dotnetIncludePreviewVersions)
|
|
- powershell: sqllocaldb start mssqllocaldb
|
|
displayName: Start localdb (Windows only)
|
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
|
- powershell: docker run --name mssql -d -p 1433:1433 -e ACCEPT_EULA=Y -e SA_PASSWORD=$(SA_PASSWORD) -e MSSQL_PID=Developer mcr.microsoft.com/mssql/server:2019-latest
|
|
displayName: Start SQL Server (Linux only)
|
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
|
|
- task: DotNetCoreCLI@2
|
|
displayName: Run dotnet test Windows
|
|
condition: eq(variables['Agent.OS'],'Windows_NT')
|
|
inputs:
|
|
command: test
|
|
projects: '**/*.Tests.Integration.csproj'
|
|
testRunTitle: Integration Tests SQL Server - $(Agent.OS)
|
|
${{ if or(variables.releaseTestFilter, parameters.forceReleaseTestFilter) }}:
|
|
arguments: '--configuration $(buildConfiguration) --no-build ${{parameters.integrationReleaseTestFilter}}'
|
|
${{ else }}:
|
|
arguments: '--configuration $(buildConfiguration) --no-build ${{parameters.integrationNonReleaseTestFilter}}'
|
|
env:
|
|
Tests__Database__DatabaseType: $(testDb)
|
|
Tests__Database__SQLServerMasterConnectionString: $(connectionString)
|
|
Umbraco__CMS__Global__MainDomLock: 'SqlMainDomLock'
|
|
- task: DotNetCoreCLI@2
|
|
displayName: Run dotnet test NonWindows
|
|
condition: ne(variables['Agent.OS'],'Windows_NT')
|
|
inputs:
|
|
command: test
|
|
projects: '**/*.Tests.Integration.csproj'
|
|
testRunTitle: Integration Tests SQL Server - $(Agent.OS)
|
|
${{ if or(variables.releaseTestFilter, parameters.forceReleaseTestFilter) }}:
|
|
arguments: '--configuration $(buildConfiguration) --no-build ${{parameters.nonWindowsIntegrationReleaseTestFilter}}'
|
|
${{ else }}:
|
|
arguments: '--configuration $(buildConfiguration) --no-build ${{parameters.nonWindowsIntegrationNonReleaseTestFilter}}'
|
|
env:
|
|
Tests__Database__DatabaseType: $(testDb)
|
|
Tests__Database__SQLServerMasterConnectionString: $(connectionString)
|
|
Umbraco__CMS__Global__MainDomLock: 'SqlMainDomLock'
|
|
|
|
- stage: E2E
|
|
variables:
|
|
npm_config_cache: $(Pipeline.Workspace)/.npm_e2e
|
|
displayName: E2E Tests
|
|
dependsOn: Build
|
|
jobs:
|
|
# E2E Tests
|
|
- job:
|
|
displayName: E2E Tests
|
|
timeoutInMinutes: 120
|
|
variables:
|
|
Umbraco__CMS__Unattended__UnattendedUserName: Playwright Test
|
|
Umbraco__CMS__Unattended__UnattendedUserPassword: UmbracoAcceptance123!
|
|
Umbraco__CMS__Unattended__UnattendedUserEmail: playwright@umbraco.com
|
|
ASPNETCORE_URLS: https://localhost:8443
|
|
strategy:
|
|
matrix:
|
|
Linux:
|
|
vmImage: 'ubuntu-latest'
|
|
dockerfile: umbraco-linux.docker
|
|
dockerImageName: umbraco-linux
|
|
Windows:
|
|
vmImage: 'windows-latest'
|
|
DOTNET_GENERATE_ASPNET_CERTIFICATE: true # Automatically generate HTTPS development certificate on Windows
|
|
# Enable console logging in Release mode
|
|
Serilog__WriteTo__0__Name: Async
|
|
Serilog__WriteTo__0__Args__configure__0__Name: Console
|
|
# Set unattended install settings
|
|
Umbraco__CMS__Unattended__InstallUnattended: true
|
|
Umbraco__CMS__Global__InstallMissingDatabase: true
|
|
UmbracoDatabaseServer: (LocalDB)\MSSQLLocalDB
|
|
UmbracoDatabaseName: AcceptanceTestDB
|
|
ConnectionStrings__umbracoDbDSN: Server=$(UmbracoDatabaseServer);Database=$(UmbracoDatabaseName);Integrated Security=true;
|
|
# Custom Umbraco settings
|
|
Umbraco__CMS__Global__VersionCheckPeriod: 0
|
|
Umbraco__CMS__Global__UseHttps: true
|
|
Umbraco__CMS__HealthChecks__Notification__Enabled: false
|
|
Umbraco__CMS__KeepAlive__DisableKeepAliveTask: true
|
|
pool:
|
|
vmImage: $(vmImage)
|
|
steps:
|
|
- task: DownloadPipelineArtifact@2
|
|
displayName: Download nupkg
|
|
inputs:
|
|
artifact: nupkg
|
|
path: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/misc/nupkg
|
|
- task: NodeTool@0
|
|
displayName: Use Node.js $(nodeVersion)
|
|
retryCountOnTaskFailure: 3
|
|
inputs:
|
|
versionSpec: $(nodeVersion)
|
|
- task: Cache@2
|
|
displayName: Cache node_modules
|
|
inputs:
|
|
key: '"npm_e2e" | "$(Agent.OS)" | $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/package-lock.json'
|
|
restoreKeys: |
|
|
"npm_e2e" | "$(Agent.OS)"
|
|
"npm_e2e"
|
|
path: $(npm_config_cache)
|
|
- pwsh: |
|
|
New-Item -Path "." -Name ".env" -ItemType "file" -Value "UMBRACO_USER_LOGIN=$(Umbraco__CMS__Unattended__UnattendedUserEmail)
|
|
UMBRACO_USER_PASSWORD=$(Umbraco__CMS__Unattended__UnattendedUserPassword)
|
|
URL=$(ASPNETCORE_URLS)"
|
|
displayName: Generate .env
|
|
workingDirectory: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/
|
|
- script: npm ci --no-fund --no-audit --prefer-offline
|
|
workingDirectory: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/
|
|
displayName: Run npm ci
|
|
- pwsh: sqllocaldb start mssqllocaldb
|
|
displayName: Start localdb (Windows only)
|
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
|
- pwsh: Invoke-Sqlcmd -Query "CREATE DATABASE $env:UmbracoDatabaseName" -ServerInstance $env:UmbracoDatabaseServer
|
|
displayName: Create database (Windows only)
|
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
|
- task: UseDotNet@2
|
|
displayName: Use .NET $(dotnetVersion)
|
|
inputs:
|
|
version: $(dotnetVersion)
|
|
performMultiLevelLookup: true
|
|
includePreviewVersions: $(dotnetIncludePreviewVersions)
|
|
- pwsh: |
|
|
$sha = 'g$(Build.SourceVersion)'.substring(0, 8)
|
|
docker build -t $(dockerImageName):$sha -f $(dockerfile) .
|
|
mkdir -p $(Build.ArtifactStagingDirectory)/docker-images
|
|
docker save -o $(Build.ArtifactStagingDirectory)/docker-images/$(dockerImageName).$sha.tar $(dockerImageName):$sha
|
|
dotnet dev-certs https -ep ${HOME}/.aspnet/https/aspnetapp.pfx -p $(Umbraco__CMS__Unattended__UnattendedUserPassword)
|
|
docker run --name $(dockerImageName) -dp 8080:5000 -dp 8443:5001 -e UMBRACO__CMS__GLOBAL__ID=$(UMBRACO__CMS__GLOBAL__ID) -e ASPNETCORE_Kestrel__Certificates__Default__Password="$(Umbraco__CMS__Unattended__UnattendedUserPassword)" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx -v ${HOME}/.aspnet/https:/https/ $(dockerImageName):$sha
|
|
docker ps
|
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
|
|
displayName: Build and run container (Linux only)
|
|
workingDirectory: tests/Umbraco.Tests.AcceptanceTest/misc
|
|
- pwsh: |
|
|
dotnet new --install ./nupkg/Umbraco.Templates.*.nupkg
|
|
dotnet new umbraco --name AcceptanceTestProject --no-restore --output .
|
|
dotnet restore --configfile ./nuget.config
|
|
dotnet build --configuration $(buildConfiguration) --no-restore
|
|
dotnet dev-certs https
|
|
$process = Start-Process -FilePath "dotnet" -ArgumentList "run --configuration $(buildConfiguration) --no-build --no-launch-profile 2>&1" -PassThru -RedirectStandardOutput $(Build.ArtifactStagingDirectory)/playwright.log
|
|
Write-Host "##vso[task.setvariable variable=AcceptanceTestProcessId]$($process.Id)"
|
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
|
displayName: Build and run app (Windows only)
|
|
workingDirectory: tests/Umbraco.Tests.AcceptanceTest/misc
|
|
- pwsh: npx wait-on -v --interval 1000 --timeout 120000 $(ASPNETCORE_URLS)
|
|
displayName: Wait for app
|
|
workingDirectory: tests/Umbraco.Tests.AcceptanceTest
|
|
- pwsh: npx playwright install --with-deps
|
|
displayName: Install Playwright
|
|
workingDirectory: tests/Umbraco.Tests.AcceptanceTest
|
|
- pwsh: npm run test --ignore-certificate-errors
|
|
displayName: Run Playwright (Desktop)
|
|
continueOnError: true
|
|
workingDirectory: tests/Umbraco.Tests.AcceptanceTest
|
|
env:
|
|
CI: true
|
|
CommitId: $(Build.SourceVersion)
|
|
AgentOs: $(Agent.OS)
|
|
- pwsh: |
|
|
docker logs $(dockerImageName) > $(Build.ArtifactStagingDirectory)/playwright.log 2>&1
|
|
docker stop $(dockerImageName)
|
|
condition: eq(variables['Agent.OS'], 'Linux')
|
|
displayName: Stop app (Linux only)
|
|
- pwsh: Stop-Process $env:AcceptanceTestProcessId
|
|
condition: eq(variables['Agent.OS'], 'Windows_NT')
|
|
displayName: Stop app (Windows only)
|
|
- task: PowerShell@2
|
|
displayName: Check if artifacts folder exists
|
|
inputs:
|
|
targetType: inline
|
|
script: |
|
|
$MyVariable = Test-Path -Path $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/results
|
|
Write-Host "##vso[task.setvariable variable=resultFolderExists;]$MyVariable"
|
|
- task: CopyFiles@2
|
|
displayName: Prepare artifacts
|
|
condition: eq(variables.resultFolderExists, 'True')
|
|
inputs:
|
|
sourceFolder: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/results/
|
|
targetFolder: $(Build.ArtifactStagingDirectory)/playwright
|
|
- task: PublishPipelineArtifact@1
|
|
condition: always()
|
|
displayName: Publish test artifacts
|
|
inputs:
|
|
targetPath: $(Build.ArtifactStagingDirectory)
|
|
artifact: 'E2E artifacts - $(Agent.OS) - Attempt #$(System.JobAttempt)'
|
|
|
|
|
|
###############################################
|
|
## Release
|
|
###############################################
|
|
- stage: Deploy_MyGet
|
|
displayName: MyGet pre-release
|
|
dependsOn:
|
|
- Unit
|
|
- Integration
|
|
# - E2E
|
|
condition: and(succeeded(), or(eq(dependencies.Build.outputs['A.build.NBGV_PublicRelease'], 'True'), ${{parameters.myGetDeploy}}))
|
|
jobs:
|
|
- job:
|
|
displayName: Push to pre-release feed
|
|
steps:
|
|
- checkout: none
|
|
- task: DownloadPipelineArtifact@2
|
|
displayName: Download nupkg
|
|
inputs:
|
|
artifact: nupkg
|
|
path: $(Build.ArtifactStagingDirectory)/nupkg
|
|
- task: NuGetCommand@2
|
|
displayName: NuGet push
|
|
inputs:
|
|
command: 'push'
|
|
packagesToPush: $(Build.ArtifactStagingDirectory)/**/*.nupkg
|
|
nuGetFeedType: 'external'
|
|
${{ if eq(parameters.isNightly, true) }}:
|
|
publishFeedCredentials: 'MyGet - Umbraco Nightly'
|
|
${{ else }}:
|
|
publishFeedCredentials: 'MyGet - Pre-releases'
|
|
- job:
|
|
displayName: Push to pre-release feed (npm)
|
|
steps:
|
|
- checkout: none
|
|
- download: current
|
|
artifact: npm
|
|
- bash: |
|
|
# Check if we are on a nightly build
|
|
if [ $isNightly = "False" ]; then
|
|
echo "##[debug]Prerelease build detected"
|
|
registry="https://www.myget.org/F/umbracoprereleases/npm/"
|
|
else
|
|
echo "##[debug]Nightly build detected"
|
|
registry="https://www.myget.org/F/umbraconightly/npm/"
|
|
fi
|
|
echo "@umbraco-cms:registry=$registry" >> .npmrc
|
|
env:
|
|
isNightly: ${{parameters.isNightly}}
|
|
workingDirectory: $(Pipeline.Workspace)/npm
|
|
displayName: Add scoped registry to .npmrc
|
|
- task: npmAuthenticate@0
|
|
displayName: Authenticate with npm (MyGet)
|
|
inputs:
|
|
workingFile: '$(Pipeline.Workspace)/npm/.npmrc'
|
|
customEndpoint: 'MyGet (npm) - Umbracoprereleases, MyGet (npm) - Umbraconightly'
|
|
- bash: |
|
|
# Setup temp npm project to load in defaults from the local .npmrc
|
|
npm init -y
|
|
|
|
# Find the first .tgz file in the current directory and publish it
|
|
files=( ./*.tgz )
|
|
npm publish --access public "${files[0]}"
|
|
displayName: Push to npm (MyGet)
|
|
workingDirectory: $(Pipeline.Workspace)/npm
|
|
|
|
- stage: Deploy_NuGet
|
|
displayName: NuGet release
|
|
dependsOn:
|
|
- Deploy_MyGet
|
|
- Build_Docs
|
|
condition: and(succeeded(), or(eq(dependencies.Build.outputs['A.build.NBGV_PublicRelease'], 'True'), ${{parameters.nuGetDeploy}}))
|
|
jobs:
|
|
- job:
|
|
displayName: Push to NuGet
|
|
steps:
|
|
- checkout: none
|
|
- task: DownloadPipelineArtifact@2
|
|
displayName: Download nupkg
|
|
inputs:
|
|
artifact: nupkg
|
|
path: $(Build.ArtifactStagingDirectory)/nupkg
|
|
- task: NuGetCommand@2
|
|
displayName: NuGet push
|
|
inputs:
|
|
command: 'push'
|
|
packagesToPush: $(Build.ArtifactStagingDirectory)/**/*.nupkg
|
|
nuGetFeedType: 'external'
|
|
publishFeedCredentials: 'NuGet - Umbraco.*'
|
|
|
|
- stage: Deploy_Npm
|
|
displayName: Npm release
|
|
condition: and(succeeded(), or(eq(dependencies.Build.outputs['A.build.NBGV_PublicRelease'], 'True'), ${{parameters.npmDeploy}}))
|
|
dependsOn:
|
|
- Deploy_NuGet
|
|
jobs:
|
|
- job: Publish
|
|
displayName: Push to NPM
|
|
steps:
|
|
- checkout: none
|
|
- download: current
|
|
artifact: npm
|
|
- bash: echo "@umbraco-cms:registry=https://registry.npmjs.org" >> .npmrc
|
|
workingDirectory: $(Pipeline.Workspace)/npm
|
|
displayName: Add scoped registry to .npmrc
|
|
- task: npmAuthenticate@0
|
|
displayName: Authenticate with npm
|
|
inputs:
|
|
workingFile: $(Pipeline.Workspace)/npm/.npmrc
|
|
customEndpoint: 'NPM - Umbraco Backoffice'
|
|
- script: |
|
|
# Setup temp npm project to load in defaults from the local .npmrc
|
|
npm init -y
|
|
|
|
# Find the first .tgz file in the current directory and publish it
|
|
files=( ./*.tgz )
|
|
npm publish --tag $npmTag --access public "${files[0]}"
|
|
displayName: Push to npm
|
|
workingDirectory: $(Pipeline.Workspace)/npm
|
|
|
|
- stage: Upload_API_Docs
|
|
pool:
|
|
vmImage: 'windows-latest' # Apparently AzureFileCopy is windows only :(
|
|
variables:
|
|
umbracoMajorVersion: $[ stageDependencies.Build.A.outputs['build.NBGV_VersionMajor'] ]
|
|
displayName: Upload API Documentation
|
|
dependsOn:
|
|
- Build
|
|
- Deploy_MyGet # Change to "Deploy_Nuget" after release of v14
|
|
condition: and(succeeded(), or(eq(dependencies.Build.outputs['A.build.NBGV_PublicRelease'], 'True'), ${{parameters.uploadApiDocs}}))
|
|
jobs:
|
|
- job:
|
|
displayName: Upload C# Docs
|
|
steps:
|
|
- checkout: none
|
|
- task: DownloadPipelineArtifact@2
|
|
displayName: Download artifact
|
|
inputs:
|
|
artifact: csharp-docs
|
|
path: $(Build.SourcesDirectory)
|
|
- task: ExtractFiles@1
|
|
inputs:
|
|
archiveFilePatterns: $(Build.SourcesDirectory)/csharp-docs.zip
|
|
destinationFolder: $(Build.ArtifactStagingDirectory)/csharp-docs
|
|
- task: AzureFileCopy@4
|
|
displayName: 'Copy C# Docs to blob storage'
|
|
inputs:
|
|
SourcePath: '$(Build.ArtifactStagingDirectory)/csharp-docs/*'
|
|
azureSubscription: umbraco-storage
|
|
Destination: AzureBlob
|
|
storage: umbracoapidocs
|
|
ContainerName: '$web'
|
|
BlobPrefix: v$(umbracoMajorVersion)/csharp
|
|
CleanTargetBeforeCopy: true
|
|
- job:
|
|
displayName: Upload js Docs
|
|
steps:
|
|
- checkout: none
|
|
- task: DownloadPipelineArtifact@2
|
|
displayName: Download artifact
|
|
inputs:
|
|
artifact: ui-docs
|
|
path: $(Build.SourcesDirectory)
|
|
- task: ExtractFiles@1
|
|
inputs:
|
|
archiveFilePatterns: $(Build.SourcesDirectory)/ui-docs.zip
|
|
destinationFolder: $(Build.ArtifactStagingDirectory)/ui-docs
|
|
- task: AzureFileCopy@4
|
|
displayName: 'Copy UI Docs to blob storage'
|
|
inputs:
|
|
SourcePath: '$(Build.ArtifactStagingDirectory)/ui-docs/*'
|
|
azureSubscription: umbraco-storage
|
|
Destination: AzureBlob
|
|
storage: umbracoapidocs
|
|
ContainerName: '$web'
|
|
BlobPrefix: v$(umbracoMajorVersion)/ui
|
|
CleanTargetBeforeCopy: true
|