Files
Umbraco-CMS/build/azure-pipelines.yml
Paul Johnson 3961c4c233 v10 SQLite support + distributed locking abstractions (#11922)
* Created Persistence.SQLite project skeleton.

* SQLite database initialization

* Various changes and hacks to make things work.

* WIP integration tests

* Fix thread safety tests

* Fix tests that relied on tie breaker sorting.

Spent a fair amount of time looking for a less lazy fix but gave up.

* Convert right join to left join ContentTypeRepository.PerformGetByQuery
SQLite doesn't support right join

* Fix test Can_Generate_Delete_SubQuery_Statement

Worth noting that NPoco.DatabaseTypes.SQLiteDatabaseType doesn't override
EscapeSqlIdentifier so NPoco will escape with [].

SQLite docs say > "A keyword enclosed in square brackets is an identifier.
This is not standard SQL.
This quoting mechanism is used by MS Access and SQL Server and is
included in SQLite for compatibility."

Also could have updated SqliteSyntaxProvider to match npoco but
decided against it.

* Fixes for paginated custom order by

* Fix tests broken by lack of unique indexes.

* Fix SqlServerTableByTableTest tests.

These tests didn't actually do anything as the tables already exist so schema creator just returned.

Did however point out that the default implementation for DoesTableExist just returns false so added a default naive implementation.

* Fix ValidateLoginSession - SelectTop must come later

* dry up database cleanup

* Fix up db migration tests.
We can't drop pk in sqlite without recreating table.
Test looks to be testing that add column works as intended which we can test.

* Prevent schema creation errors.

* SQLite ignore lock tests, WAL back on.

* Fix package schema tests

* Fix NPocoFetchTests - case sensitivity not under test

* Fix AdvancedMigrationTests (where possible)

Migrations probably need a good look later.
Maybe nuke old migrations and only support moving to v10 from v9.

If we do that can do some cleanup.

* Cleanup test database configuration

* Run integration tests against SQLite on build agent.

* Drop MS.Data.SQLite
System.Data.SQLite was quicker to roll out due to more CLR type mapping

* YAML

* Skip Umbraco.Tests.Integration.SqlCe

* Drop SqlServerTableByTable tests.

Until this week they did nothing anyway as they with NewSchemaPerTest
so the tests all passed as CreateTable was no op (already exists).

Also all of the tables are created in an empty database by SchemaValidationTest.cs
DatabaseSchemaCreation_Produces_DatabaseSchemaResult_With_Zero_Errors

* Might aswell run against macOS also.

* Copy azure pipelines task header layout

* Delete SQLCe projects

* Remove SQL CE specific code.

* Remove SQL CE NuSpec, template params, build script setup

* Delete umbraco-netcore-only.sln

* Add SkipTests solution configuration and use for codeql

* Remove reference to deleted nuspec file.

* Refactor ConnectionStrings WRT DataDirectory placeholder & ProviderName.

At this point you can try out SQLite support by setting the following
in appsettings.json and then completing the install process.

"ConnectionStrings": {
  "umbracoDbDSN": "Data Source=|DataDirectory|/umbraco.sqlite",
  "umbracoDbDSN_ProviderName": "System.Data.SQLite"
},

Not currently possible via installer UI without provider name pre-set in
configuration.

* Switch to Microsoft.Data.Sqlite

Some gross hacks but will be good to find out if this works
with apple silicon.

* Enable selection of SQLite via installer UI (also quick install)

* Remove SqlServerDbProviderFactoryCreator to cleanup a TODO

* Move SQL Server support to its own class library

* Add persistence dependencies to Umbraco.CMS metapackage

* Bugfix packages delete query

Created invalid query for SQLite.

* Try out cypress tests Linux + SQLite

* Prevent cypress test artifact upload failure on attempt 2+

* LocalDb bugfixes

* Drop redundant enum

* Move SqlClient constant

* Misc whitespace

* Remove IsSqlCe extension (TODO: drop non 9->10 migrations later).

* Umbraco.Persistence.* -> Umbraco.Cms.Persistence.*

* Display quick install defaults and per provider default database name.

* Misc remove old comment

* little re-arrange

* Remove almost all usages of IsSqlite extension.

* visual adjustments

* Custom Database Configuration is last step and should then say Install.

* use text instead of disabled inputs

* move legend, rename to Install

* Update SqlMainDomLock to work without distributed locks.

* Added IDistributedLockingMechanism interface and in memory impl.

* Drop locking from ISqlSyntaxProvider & wire up scope to abstraction.

* Added SqlServerDistributedLockingMechanism

* Move distributed locking interfaces and exceptions to Core + xmldocs.

* Fix tests, Misc cleanup, Add SQL distributed locking integration tests

* Provide mechanism to specify DistributedLockingMechanism in config
(even if added by composer)

* Nomplementation -> NoImplementation

* Fix misleading comment

* Integration tests use SqlServerDistributedLockingMechanism when possible

* Handle up-gradable locks SqlServerDistributedLockingMechanism.
TODO: InMemoryDistributedLockingMechanism.

Note: Nuked SqlServerDistributedLockingMechanismTests, will still sleep
at night.
Is covered by Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.LockTests

* Make tests pass for InMemoryDistributedLockingMechanism, pretty hacky.

* Tweak constraints on WithCollectionBuilder so i can drop bad constructor

* Added SqliteDistributedLockingMechanism

* Dropped InMemoryDistributedMechanism + magic

InMemoryDistributedMechanism was pretty rubbish and now we have
a decent implementation for SQLite as we no longer block readers
see 8d1f42b.

Also drop the CollectionBuilder setup, instead do the same as we do
for syntax providers etc, it's more automagical so we never require an
explicit selection although we are allowing for it.

However keeping the optional IUmbracoBuilder constructor param for
CollectionBuilders as it's extremely useful.

* Fix quick install "" database name.

* Hide Database Configuration section when a connection string is pre-set.

Doesn't seem worth it to extract db name from connection string.

* Ensure wal test 2+

* Fix logging inconsistencies.

* Ensure in transaction when obtaining locks + no-op the SQLite read lock.

There's no point in running the query just to make a single test pass.

* Fix installer database display names

* Allow SQLite shared cache without losing deferred transactions

* Opt into shared cache for new SQLite databases + fix filename

* Fix misc inconsistency in .gitignore

* Prefer our interceptor interface

* Restore DEBUG_DATABASES code OnConnectionOpened in case it's used.

* Back to private cache.

* Added retry strategy for SQLite + refactor out SQL server specific stuff

* Fix SQL server tests.

* Misc - Orphaned comment, incorrect casing.

* InMemory SQLite test database & turn shared cache back on everywhere.

Co-authored-by: Niels Lyngsø <niels.lyngso@gmail.com>
2022-03-11 17:14:20 +01:00

736 lines
32 KiB
YAML

name: $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
variables:
buildConfiguration: Release
SA_PASSWORD: UmbracoIntegration123!
UmbracoBuild: AzurePipeline
nodeVersion: 14.18.1
resources:
containers:
- container: mssql
image: 'mcr.microsoft.com/mssql/server:2017-latest'
env:
ACCEPT_EULA: 'Y'
SA_PASSWORD: $(SA_PASSWORD)
MSSQL_PID: Developer
ports:
- '1433:1433'
options: '--name mssql'
stages:
- stage: Determine_build_type
displayName: Determine build type
dependsOn: [ ]
jobs:
- job: Set_build_variables
displayName: Set build variables
pool:
vmImage: windows-latest
steps:
- task: PowerShell@1
name: setReleaseVariable
displayName: Set isRelease variable
inputs:
scriptType: inlineScript
inlineScript: >
$isRelease = [regex]::matches($env:BUILD_SOURCEBRANCH,"v\d+\/\d+.\d+.*")
if ($isRelease.Count -gt 0){
Write-Host "##vso[build.addbuildtag]Release build"
Write-Host "##vso[task.setvariable variable=isRelease;isOutput=true]true"
}else{
Write-Host "##vso[task.setvariable variable=isRelease;isOutput=true]false"
}
- stage: Unit_Tests
displayName: Unit Tests
dependsOn: []
jobs:
- job: Linux_Unit_Tests
displayName: Linux
pool:
vmImage: ubuntu-latest
steps:
- task: UseDotNet@2
displayName: Use .Net 6.x
inputs:
version: 6.x
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: build
projects: '**/umbraco.sln'
- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: test
projects: '**/*.Tests.UnitTests.csproj'
arguments: '--no-build'
- job: MacOS_Unit_Tests
displayName: Mac OS
pool:
vmImage: macOS-latest
steps:
- task: UseDotNet@2
displayName: Use .Net 6.x
inputs:
version: 6.x
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: build
projects: '**/umbraco.sln'
- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: test
projects: '**/*.Tests.UnitTests.csproj'
arguments: '--no-build'
- job: Windows_Unit_Tests
displayName: Windows
pool:
vmImage: windows-latest
steps:
- task: UseDotNet@2
displayName: Use .Net 6.x
inputs:
version: 6.x
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: build
projects: '**/umbraco.sln'
- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: test
projects: '**/*.Tests.UnitTests.csproj'
arguments: '--no-build'
- stage: Integration_Tests
displayName: Integration Tests
dependsOn: []
jobs:
- job: Linux_Integration_Tests_SQLite
timeoutInMinutes: 120
displayName: Linux (SQLite)
pool:
vmImage: ubuntu-latest
steps:
- task: UseDotNet@2
displayName: Use .Net 6.x
inputs:
version: 6.x
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: build
projects: '**/umbraco.sln'
- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: test
projects: '**/Umbraco.Tests.Integration.csproj'
arguments: '--no-build'
env:
Tests__Database__DatabaseType: 'Sqlite'
Umbraco__Cms__global__MainDomLock: 'FileSystemMainDomLock'
- job: Linux_Integration_Tests_SQLServer
services:
mssql: mssql
timeoutInMinutes: 120
displayName: Linux (SQL Server)
pool:
vmImage: ubuntu-latest
steps:
- task: UseDotNet@2
displayName: Use .Net 6.x
inputs:
version: 6.x
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: build
projects: '**/umbraco.sln'
- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: test
projects: '**/Umbraco.Tests.Integration.csproj'
arguments: '--no-build'
env:
Tests__Database__DatabaseType: 'SqlServer'
Tests__Database__SQLServerMasterConnectionString: 'Server=localhost,1433;User Id=sa;Password=$(SA_PASSWORD);'
Umbraco__Cms__global__MainDomLock: 'SqlMainDomLock'
- job: macOS_Integration_Tests_SQLite
timeoutInMinutes: 120
displayName: macOS (SQLite)
pool:
vmImage: macOS-latest
steps:
- task: UseDotNet@2
displayName: Use .Net 6.x
inputs:
version: 6.x
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: build
projects: '**/umbraco.sln'
- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: test
projects: '**/Umbraco.Tests.Integration.csproj'
arguments: '--no-build'
env:
Tests__Database__DatabaseType: 'Sqlite'
Umbraco__Cms__global__MainDomLock: 'FileSystemMainDomLock'
- job: Windows_Integration_Tests_LocalDb
timeoutInMinutes: 120
displayName: Windows (LocalDb)
pool:
vmImage: windows-latest
steps:
- task: UseDotNet@2
displayName: Use .Net 6.x
inputs:
version: 6.x
- powershell: sqllocaldb start mssqllocaldb
displayName: Start MSSQL LocalDb
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: build
projects: '**/umbraco.sln'
- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: test
projects: '**/Umbraco.Tests.Integration.csproj'
arguments: '--no-build'
env:
Tests__Database__DatabaseType: 'LocalDb'
Umbraco__Cms__global__MainDomLock: 'MainDomSemaphoreLock'
- stage: Acceptance_Tests
displayName: Acceptance Tests
dependsOn: []
variables:
- name: Umbraco__CMS__Unattended__InstallUnattended
value: true
- name: Umbraco__CMS__Unattended__UnattendedUserName
value: Cypress Test
- name: Umbraco__CMS__Unattended__UnattendedUserEmail
value: cypress@umbraco.com
- name: Umbraco__CMS__Unattended__UnattendedUserPassword
value: UmbracoAcceptance123!
jobs:
- job: Windows_Acceptance_tests
variables:
- name: UmbracoDatabaseServer
value: (LocalDB)\MSSQLLocalDB
- name: UmbracoDatabaseName
value: Cypress
- name: ConnectionStrings__umbracoDbDSN
value: Server=$(UmbracoDatabaseServer);Database=$(UmbracoDatabaseName);Integrated Security=true;
displayName: Windows
pool:
vmImage: windows-latest
steps:
- task: UseDotNet@2
displayName: Use .Net 6.x
inputs:
version: 6.x
- powershell: sqllocaldb start mssqllocaldb
displayName: Start MSSQL LocalDb
- powershell: Invoke-Sqlcmd -Query "CREATE DATABASE $env:UmbracoDatabaseName" -ServerInstance $env:UmbracoDatabaseServer
displayName: Create database
# - task: DotNetCoreCLI@2
# displayName: dotnet build
# inputs:
# command: build
# projects: '**/Umbraco.Web.UI.csproj'
- task: NodeTool@0
displayName: Use Node $(nodeVersion)
inputs:
versionSpec: $(nodeVersion)
- task: Npm@1
displayName: npm ci (Client)
inputs:
command: ci
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
- powershell: Start-Process -FilePath "dotnet" -ArgumentList "run", "-p", "src\Umbraco.Web.UI\Umbraco.Web.UI.csproj"
displayName: dotnet run
# - powershell: dotnet run --no-build -p .\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj
# displayName: dotnet run
- task: PowerShell@1
displayName: Generate Cypress.env.json
inputs:
scriptType: inlineScript
inlineScript: >
@{ username = $env:Umbraco__CMS__Unattended__UnattendedUserEmail; password = $env:Umbraco__CMS__Unattended__UnattendedUserPassword } | ConvertTo-Json | Set-Content -Path "tests\Umbraco.Tests.AcceptanceTest\cypress.env.json"
- task: Npm@1
name: PrepareTask
displayName: npm ci (AcceptanceTest)
inputs:
command: ci
workingDir: 'tests\Umbraco.Tests.AcceptanceTest'
- task: PowerShell@2
displayName: Run Cypress (Desktop)
condition: always()
continueOnError: true
inputs:
targetType: inline
workingDirectory: tests\Umbraco.Tests.AcceptanceTest
script: 'npm run test -- --reporter junit --reporter-options "mochaFile=results/test-output-D-[hash].xml,toConsole=true" --config="viewportHeight=1600,viewportWidth=2560,screenshotsFolder=cypress/artifacts/desktop/screenshots,videosFolder=cypress/artifacts/desktop/videos,videoUploadOnPasses=false"'
- task: PublishTestResults@2
condition: always()
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'tests/Umbraco.Tests.AcceptanceTest/results/test-output-D-*.xml'
mergeTestResults: true
testRunTitle: "Test results Desktop"
# - task: Npm@1
# displayName: Run Cypress (Tablet portrait)
# condition: always()
# inputs:
# workingDir: tests\Umbraco.Tests.AcceptanceTest
# command: 'custom'
# customCommand: 'run test -- --config="viewportHeight=1366,viewportWidth=1024,screenshotsFolder=cypress/artifacts/tablet/screenshots,videosFolder=cypress/artifacts/tablet/videos,videoUploadOnPasses=false"'
#
# - task: Npm@1
# displayName: Run Cypress (Mobile protrait)
# condition: always()
# inputs:
# workingDir: tests\Umbraco.Tests.AcceptanceTest
# command: 'custom'
# customCommand: 'run test -- --config="viewportHeight=812,viewportWidth=375,screenshotsFolder=cypress/artifacts/mobile/screenshots,videosFolder=cypress/artifacts/mobile/videos,videoUploadOnPasses=false"'
- task: PublishPipelineArtifact@1
displayName: "Publish test artifacts"
inputs:
targetPath: '$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/cypress/artifacts'
artifact: 'Test artifacts - Windows - Attempt #$(System.JobAttempt)'
- job: Linux_Acceptance_tests_SqlServer
displayName: Linux (SQL Server)
variables:
- name: UmbracoDatabaseServer
value: localhost
- name: UmbracoDatabaseName
value: Cypress
- name: ConnectionStrings__umbracoDbDSN
value: Server=localhost,1433;Database=$(UmbracoDatabaseName);User Id=sa;Password=$(SA_PASSWORD);
services:
mssql: mssql
pool:
vmImage: ubuntu-latest
steps:
- task: UseDotNet@2
displayName: Use .Net 6.x
inputs:
version: 6.x
- task: Bash@3
displayName: Create database
inputs:
targetType: 'inline'
script: 'sqlcmd -S . -U sa -P $SA_PASSWORD -Q "CREATE DATABASE $DBNAME"'
env:
DBNAME: $(UmbracoDatabaseName)
SA_PASSWORD: $(SA_PASSWORD)
- task: NodeTool@0
displayName: Use Node $(nodeVersion)
inputs:
versionSpec: $(nodeVersion)
- task: Npm@1
displayName: npm ci (Client)
inputs:
command: ci
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
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: build
projects: src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
- task: Bash@3
displayName: dotnet run
inputs:
targetType: 'inline'
script: 'nohup dotnet run --no-build -p ./src/Umbraco.Web.UI/ > $(Build.ArtifactStagingDirectory)/dotnet_run_log_linux.txt &'
- task: Bash@3
displayName: Generate Cypress.env.json
inputs:
targetType: 'inline'
script: 'echo "{ \"username\": \"$USERNAME\", \"password\": \"$PASSWORD\" }" > "tests/Umbraco.Tests.AcceptanceTest/cypress.env.json"'
env:
USERNAME: $(Umbraco__CMS__Unattended__UnattendedUserEmail)
PASSWORD: $(Umbraco__CMS__Unattended__UnattendedUserPassword)
- task: Npm@1
name: PrepareTask
displayName: npm ci (AcceptanceTest)
inputs:
command: ci
workingDir: 'tests/Umbraco.Tests.AcceptanceTest'
- task: Bash@3
displayName: Run Cypress (Desktop)
condition: always()
continueOnError: true
inputs:
targetType: inline
workingDirectory: tests/Umbraco.Tests.AcceptanceTest
script: 'npm run test -- --reporter junit --reporter-options "mochaFile=results/test-output-D-[hash].xml,toConsole=true" --config="viewportHeight=1600,viewportWidth=2560,screenshotsFolder=cypress/artifacts/desktop/screenshots,videosFolder=cypress/artifacts/desktop/videos,videoUploadOnPasses=false"'
- task: PublishTestResults@2
condition: always()
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'tests/Umbraco.Tests.AcceptanceTest/results/test-output-D-*.xml'
mergeTestResults: true
testRunTitle: "Test results Desktop"
# - task: Npm@1
# displayName: Run Cypress (Tablet portrait)
# condition: always()
# inputs:
# workingDir: tests/Umbraco.Tests.AcceptanceTest
# command: 'custom'
# customCommand: 'run test -- --config="viewportHeight=1366,viewportWidth=1024,screenshotsFolder=cypress/artifacts/tablet/screenshots,videosFolder=cypress/artifacts/tablet/videos,videoUploadOnPasses=false"'
#
# - task: Npm@1
# displayName: Run Cypress (Mobile protrait)
# condition: always()
# inputs:
# workingDir: tests/Umbraco.Tests.AcceptanceTest
# command: 'custom'
# customCommand: 'run test -- --config="viewportHeight=812,viewportWidth=375,screenshotsFolder=cypress/artifacts/mobile/screenshots,videosFolder=cypress/artifacts/mobile/videos,videoUploadOnPasses=false"'
- task: PublishPipelineArtifact@1
displayName: "Publish test artifacts"
inputs:
targetPath: '$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/cypress/artifacts'
artifact: 'Test artifacts - Linux (SQL Server) - Attempt #$(System.JobAttempt)'
- task: PublishPipelineArtifact@1
displayName: "Publish run log"
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/dotnet_run_log_linux.txt'
artifact: 'Test Run logs - Linux (SQL Server) - Attempt #$(System.JobAttempt)'
- job: Linux_Acceptance_tests_SQLite
displayName: Linux (SQLite)
variables:
- name: ConnectionStrings__umbracoDbDSN
value: Data Source=|DataDirectory|/umbraco-cms-cypress.sqlite.db;Cache=Private;Foreign Keys=True
- name: ConnectionStrings__umbracoDbDSN_ProviderName
value: Microsoft.Data.SQLite
pool:
vmImage: ubuntu-latest
steps:
- task: UseDotNet@2
displayName: Use .Net 6.x
inputs:
version: 6.x
- task: NodeTool@0
displayName: Use Node $(nodeVersion)
inputs:
versionSpec: $(nodeVersion)
- task: Npm@1
displayName: npm ci (Client)
inputs:
command: ci
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
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: build
projects: src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
- task: Bash@3
displayName: dotnet run
inputs:
targetType: 'inline'
script: 'nohup dotnet run --no-build -p ./src/Umbraco.Web.UI/ > $(Build.ArtifactStagingDirectory)/dotnet_run_log_linux.txt &'
- task: Bash@3
displayName: Generate Cypress.env.json
inputs:
targetType: 'inline'
script: 'echo "{ \"username\": \"$USERNAME\", \"password\": \"$PASSWORD\" }" > "tests/Umbraco.Tests.AcceptanceTest/cypress.env.json"'
env:
USERNAME: $(Umbraco__CMS__Unattended__UnattendedUserEmail)
PASSWORD: $(Umbraco__CMS__Unattended__UnattendedUserPassword)
- task: Npm@1
name: PrepareTask
displayName: npm ci (AcceptanceTest)
inputs:
command: ci
workingDir: 'tests/Umbraco.Tests.AcceptanceTest'
- task: Bash@3
displayName: Run Cypress (Desktop)
condition: always()
continueOnError: true
inputs:
targetType: inline
workingDirectory: tests/Umbraco.Tests.AcceptanceTest
script: 'npm run test -- --reporter junit --reporter-options "mochaFile=results/test-output-D-[hash].xml,toConsole=true" --config="viewportHeight=1600,viewportWidth=2560,screenshotsFolder=cypress/artifacts/desktop/screenshots,videosFolder=cypress/artifacts/desktop/videos,videoUploadOnPasses=false"'
- task: PublishTestResults@2
condition: always()
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'tests/Umbraco.Tests.AcceptanceTest/results/test-output-D-*.xml'
mergeTestResults: true
testRunTitle: "Test results Desktop"
- task: PublishPipelineArtifact@1
displayName: "Publish test artifacts"
inputs:
targetPath: '$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/cypress/artifacts'
artifact: 'Test artifacts - Linux (SQLite) - Attempt #$(System.JobAttempt)'
- task: PublishPipelineArtifact@1
displayName: "Publish run log"
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/dotnet_run_log_linux.txt'
artifact: 'Test Run logs - Linux (SQLite) - Attempt #$(System.JobAttempt)'
- stage: Artifacts
dependsOn: []
jobs:
- job: Build_Artifacts
displayName: Build Artifacts
pool:
vmImage: windows-latest
steps:
- task: UseDotNet@2
displayName: Use .Net 6.x
inputs:
version: 6.x
- task: NuGetToolInstaller@1
displayName: Use NuGet Latest
- task: NuGetCommand@2
displayName: Restore NuGet Packages
inputs:
restoreSolution: 'umbraco.sln'
feedsToUse: config
- task: PowerShell@1
displayName: Update Version and Artifact Name
inputs:
scriptType: inlineScript
inlineScript: >
Write-Host "Working folder: $pwd"
$ubuild = build/build.ps1 -get -continue
$version = $ubuild.GetUmbracoVersion()
$isRelease = [regex]::matches($env:BUILD_SOURCEBRANCH,"v\d+\/\d+.\d+.*")
if ($isRelease.Count -gt 0){
$continuous = $version.Semver
}
else
{
$date = (Get-Date).ToString("yyyyMMdd")
$continuous = "$($version.release)-preview$date.$(Build.BuildId)"
$ubuild.SetUmbracoVersion($continuous)
#Update the version in templates also
$templatePath =
'build/templates/UmbracoProject/.template.config/template.json'
$a = Get-Content $templatePath -raw | ConvertFrom-Json
$a.symbols.version.defaultValue = $continuous
$a | ConvertTo-Json -depth 32| set-content $templatePath
$templatePath =
'build/templates/UmbracoPackage/.template.config/template.json'
$a = Get-Content $templatePath -raw | ConvertFrom-Json
$a.symbols.version.defaultValue = $continuous
$a | ConvertTo-Json -depth 32| set-content $templatePath
}
Write-Host "##vso[build.updatebuildnumber]$continuous.$(Build.BuildId)"
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: PowerShell@1
displayName: Prepare JSON Schema
inputs:
scriptType: inlineScript
inlineScript: |
Write-Host "Working folder: $pwd"
$ubuild = build\build.ps1 -get -continue
$ubuild.CompileJsonSchema()
- task: NodeTool@0
displayName: Use Node $(nodeVersion)
inputs:
versionSpec: $(nodeVersion)
- task: Npm@1
displayName: npm ci (Client)
inputs:
command: ci
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
inputs:
scriptType: inlineScript
inlineScript: |
Write-Host "Working folder: $pwd"
$ubuild = build\build.ps1 -get -continue
$ubuild.CompileUmbraco()
$ubuild.PreparePackages()
- 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()
- stage: Artifacts_Docs
displayName: 'Static Code Documentation'
dependsOn: [Determine_build_type]
jobs:
- job: Generate_Docs_CSharp
timeoutInMinutes: 60
displayName: Generate C# Docs
condition: eq(stageDependencies.Determine_build_type.Set_build_variables.outputs['setReleaseVariable.isRelease'], 'true')
pool:
vmImage: windows-latest
steps:
- task: UseDotNet@2
displayName: Use .Net 6.x
inputs:
version: 6.x
- task: PowerShell@2
displayName: 'Prep build tool - C# Docs'
inputs:
targetType: inline
script: |
choco install docfx --version=2.59.0 -y
if ($lastexitcode -ne 0){
throw ("Error installing DocFX")
}
docfx metadata --loglevel Verbose "$(Build.SourcesDirectory)\src\ApiDocs\docfx.json"
if ($lastexitcode -ne 0){
throw ("Error generating docs.")
}
docfx build --loglevel Verbose "$(Build.SourcesDirectory)\src\ApiDocs\docfx.json"
if ($lastexitcode -ne 0){
throw ("Error generating docs.")
}
errorActionPreference: continue
workingDirectory: build
- task: ArchiveFiles@2
displayName: 'Zip C# Docs'
inputs:
rootFolderOrFile: $(Build.SourcesDirectory)\src\ApiDocs\_site
includeRootFolder: false
archiveType: zip
archiveFile: $(Build.ArtifactStagingDirectory)\docs\csharp-docs.zip
replaceExistingArchive: true
- task: PublishPipelineArtifact@1
displayName: Publish to artifacts - C# Docs
inputs:
targetPath: $(Build.ArtifactStagingDirectory)\docs\csharp-docs.zip
artifact: docs-cs
publishLocation: pipeline
- job: Generate_Docs_JS
timeoutInMinutes: 60
displayName: Generate JS Docs
condition: eq(stageDependencies.Determine_build_type.Set_build_variables.outputs['setReleaseVariable.isRelease'], 'true')
pool:
vmImage: windows-latest
steps:
- task: PowerShell@2
displayName: Prep build tool - JS Docs
inputs:
targetType: inline
script: |
$uenv=./build.ps1 -get -doc
$uenv.SandboxNode()
$uenv.CompileBelle()
$uenv.PrepareAngularDocs()
$uenv.RestoreNode()
errorActionPreference: continue
workingDirectory: build
- task: PublishPipelineArtifact@1
displayName: Publish to artifacts - JS Docs
inputs:
targetPath: $(Build.Repository.LocalPath)\build.out\
artifact: docs
publishLocation: pipeline