Skip to content

Commit 23288b6

Browse files
Add updated build pipeline
1 parent 935444a commit 23288b6

File tree

3 files changed

+124
-2
lines changed

3 files changed

+124
-2
lines changed

Umbraco.Deploy.Contrib.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1313
.gitattributes = .gitattributes
1414
.gitignore = .gitignore
1515
.globalconfig = .globalconfig
16+
azure-pipelines.yml = azure-pipelines.yml
1617
CONTRIBUTING.md = CONTRIBUTING.md
1718
Directory.Build.props = Directory.Build.props
1819
Directory.Packages.props = Directory.Packages.props

azure-pipelines.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
trigger:
2+
branches:
3+
include:
4+
- 'v2/*'
5+
- 'v3/*'
6+
- 'v4/*'
7+
tags:
8+
include:
9+
- release-2.*
10+
- release-3.*
11+
- release-4.*
12+
13+
pr:
14+
branches:
15+
include:
16+
- 'v2/*'
17+
- 'v3/*'
18+
- 'v4/*'
19+
20+
parameters:
21+
- name: cache_nuget
22+
displayName: Cache NuGet packages
23+
type: boolean
24+
default: false # As long as we're overwriting versions on MyGet, we can't cache NuGet packages
25+
26+
variables:
27+
solution: Umbraco.Deploy.Contrib.sln
28+
buildConfiguration: Release
29+
DOTNET_NOLOGO: true
30+
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
31+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
32+
DOTNET_CLI_TELEMETRY_OPTOUT: true
33+
34+
stages:
35+
- stage: Build
36+
variables:
37+
NUGET_PACKAGES: $(Pipeline.Workspace)/.nuget/packages
38+
jobs:
39+
- job: Build
40+
pool:
41+
vmImage: 'windows-latest' # Required for .NET Framework projects
42+
steps:
43+
# Checkout source (avoid shallow clone to calculate version height)
44+
- checkout: self
45+
fetchDepth: 0
46+
47+
# Setup build environment
48+
- task: UseDotNet@2
49+
displayName: Use .NET SDK from global.json
50+
inputs:
51+
useGlobalJson: true
52+
53+
# Cache and restore NuGet packages
54+
- task: Cache@2
55+
condition: ${{ parameters.cache_nuget }}
56+
displayName: Cache NuGet packages
57+
inputs:
58+
key: 'nuget | "$(Agent.OS)" | **/packages.lock.json, !**/bin/**, !**/obj/**'
59+
restoreKeys: |
60+
nuget | "$(Agent.OS)"
61+
nuget
62+
path: $(NUGET_PACKAGES)
63+
64+
- script: dotnet restore $(solution) --locked-mode
65+
displayName: Restore NuGet packages
66+
67+
# Build
68+
- script: dotnet build $(solution) --configuration $(buildConfiguration) --no-restore -p:ContinuousIntegrationBuild=true
69+
displayName: Run dotnet build
70+
71+
# Pack
72+
- script: dotnet pack $(solution) --configuration $(buildConfiguration) --no-build --output $(Build.ArtifactStagingDirectory)/nupkg
73+
displayName: Run dotnet pack
74+
75+
# Publish
76+
- task: PublishPipelineArtifact@1
77+
displayName: Publish NuGet packages
78+
inputs:
79+
targetPath: $(Build.ArtifactStagingDirectory)/nupkg
80+
artifactName: nupkg
81+
82+
- task: PublishPipelineArtifact@1
83+
displayName: Publish build output
84+
inputs:
85+
targetPath: $(Build.SourcesDirectory)
86+
artifactName: build_output
87+
88+
- stage: Test
89+
dependsOn: Build
90+
jobs:
91+
- job: UnitTests
92+
displayName: Unit Tests
93+
pool:
94+
vmImage: 'windows-latest'
95+
steps:
96+
# Setup test environment
97+
- task: DownloadPipelineArtifact@2
98+
displayName: Download build artifacts
99+
inputs:
100+
artifact: build_output
101+
path: $(Build.SourcesDirectory)
102+
103+
- task: UseDotNet@2
104+
displayName: Use .NET SDK from global.json
105+
inputs:
106+
useGlobalJson: true
107+
108+
# Test
109+
- script: dotnet test $(solution) --configuration $(buildConfiguration) --no-build --logger trx --results-directory $(Build.ArtifactStagingDirectory)/tests
110+
displayName: Run dotnet test
111+
112+
# Publish
113+
- task: PublishTestResults@2
114+
displayName: Publish test results
115+
condition: succeededOrFailed()
116+
inputs:
117+
testResultsFormat: VSTest
118+
testResultsFiles: '*.trx'
119+
searchFolder: $(Build.ArtifactStagingDirectory)/tests
120+
testRunTitle: Unit Tests
121+
configuration: $(buildConfiguration)

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"rollForward": "latestFeature",
4-
"version": "8.0.100"
3+
"version": "8.0.100",
4+
"rollForward": "latestFeature"
55
}
66
}

0 commit comments

Comments
 (0)