Skip to content
This repository was archived by the owner on Sep 13, 2023. It is now read-only.

Commit 4b25635

Browse files
US124 [CICD] Configure azure pipeline (#224)
* US124 [CICD] configure azure pipeline * US124 [CICD] configure azure pipeline
1 parent d117328 commit 4b25635

File tree

2 files changed

+185
-0
lines changed

2 files changed

+185
-0
lines changed

automation/Get-Artifacts.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
$ArtifactName = $args[0]
2+
$ArtifactSource = Join-Path $env:Workspace s/src/$ArtifactName
3+
$ArtifactDestination = Join-Path $env:Workspace s/output
4+
$ArtifactDestinationLayer = Join-Path $ArtifactDestination $ArtifactName
5+
$SubFoldersList = dir $ArtifactSource | Where-Object {$_.PSIsContainer} | ForEach-Object -Process {$_.FullName}
6+
7+
ForEach ($Folder in $SubFoldersList) {
8+
$ArtifactSourcePath = Join-Path $Folder code/obj/Debug/Package/PackageTmp
9+
robocopy $ArtifactSourcePath $ArtifactDestinationLayer /s /xo
10+
}
11+
robocopy $ArtifactSource $ArtifactDestination/unicorn/$ArtifactName *.yml /s

automation/build.yml

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# Build using Visual Studio 2017 on Windows Server 2016.
2+
3+
trigger: none
4+
5+
pool:
6+
vmImage: 'vs2017-win2016'
7+
8+
variables:
9+
build_cake: './src/build.cake'
10+
artifacts_location: '$(Pipeline.Workspace)/s/output'
11+
12+
steps:
13+
14+
- task: UseNode@1
15+
displayName: Installing Node 10
16+
inputs:
17+
script: 'npm --version'
18+
19+
- task: DownloadSecureFile@1
20+
displayName: Download license
21+
name: license_file
22+
inputs:
23+
secureFile: 'license.xml'
24+
25+
- task: DownloadPipelineArtifact@2
26+
displayName: Download node modules
27+
inputs:
28+
buildType: 'specific'
29+
project: 'c8a112df-eb95-41fa-bb80-48e83128fe75'
30+
definition: '10'
31+
buildVersionToDownload: 'latest'
32+
artifactName: 'node_modules'
33+
targetPath: '$(Pipeline.Workspace)/s/src/node_modules'
34+
35+
- task: DownloadPipelineArtifact@2
36+
displayName: Download packages
37+
inputs:
38+
buildType: 'specific'
39+
project: 'c8a112df-eb95-41fa-bb80-48e83128fe75'
40+
definition: '10'
41+
buildVersionToDownload: 'latest'
42+
artifactName: 'packages'
43+
targetPath: '$(Pipeline.Workspace)/s/src/packages'
44+
45+
- task: DownloadPipelineArtifact@2
46+
displayName: Download tools
47+
inputs:
48+
buildType: 'specific'
49+
project: 'c8a112df-eb95-41fa-bb80-48e83128fe75'
50+
definition: '10'
51+
buildVersionToDownload: 'latest'
52+
artifactName: 'tools'
53+
targetPath: '$(Pipeline.Workspace)/s/src/tools'
54+
55+
- task: PowerShell@2
56+
displayName: Config preparation
57+
inputs:
58+
targetType: 'inline'
59+
script: |
60+
Move-Item $(license_file.secureFilePath) ./src/ -Force
61+
- task: gulp@1
62+
displayName: Gulp code generation
63+
inputs:
64+
gulpFile: './src/scripts/code-generation/codeGen.js'
65+
targets:
66+
enableCodeCoverage: false
67+
68+
- task: PowerShell@2
69+
displayName: Webpack build
70+
inputs:
71+
targetType: 'inline'
72+
script: |
73+
$env:path="$env:path;$(Pipeline.Workspace)/s/src/node_modules/.bin"
74+
$env:path="$env:path;$(Pipeline.Workspace)/s/src/tools"
75+
copyfiles -f ./Project/HCA/client/public/**/* ./Project/HCA/client/build/
76+
cross-env NODE_ENV=production webpack
77+
nuget.exe restore ./HCA.sln
78+
workingDirectory: './src/'
79+
80+
- task: MSBuild@1
81+
displayName: MSBuild
82+
inputs:
83+
solution: './src/HCA.sln'
84+
msbuildVersion: '15.0'
85+
configuration: 'Debug'
86+
msbuildArguments: '/t:Rebuild'
87+
88+
- task: PowerShell@2
89+
displayName: Run Unit tests
90+
inputs:
91+
filePath: './src/build.ps1'
92+
arguments: '-Target 003-Tests'
93+
workingDirectory: './src/'
94+
95+
- task: PublishCodeCoverageResults@1
96+
displayName: Publish code coverage
97+
inputs:
98+
codeCoverageTool: 'Cobertura'
99+
summaryFileLocation: '$(Pipeline.Workspace)/s/output/tests/coverage/cobertura-coverage.xml'
100+
101+
102+
- task: MSBuild@1
103+
displayName: MSBuild for publish
104+
inputs:
105+
solution: './src/**/*.csproj'
106+
msbuildVersion: '15.0'
107+
configuration: 'Debug'
108+
msbuildArguments: '/t:Build /p:Verbosity=Minimal /p:DeployOnBuild=True'
109+
110+
- task: PowerShell@2
111+
displayName: Collect files for artifacts
112+
env:
113+
Workspace: $(Pipeline.Workspace)
114+
inputs:
115+
targetType: 'inline'
116+
script: |
117+
robocopy $(Pipeline.Workspace)/s/src/configs/Sitecore/ $(Pipeline.Workspace)/s/output/ web.config
118+
robocopy $(Pipeline.Workspace)/s/src/tools/cake.sitecore/Cake.Sitecore/tools/unicorn $(Pipeline.Workspace)/s/output/unicorn-sync /s
119+
./automation/Get-Artifacts.ps1 Feature
120+
./automation/Get-Artifacts.ps1 Foundation
121+
./automation/Get-Artifacts.ps1 Project
122+
errorActionPreference: 'continue'
123+
ignoreLASTEXITCODE: true
124+
125+
- task: PowerShell@2
126+
displayName: Change default parameters for $(project_name)
127+
inputs:
128+
targetType: 'inline'
129+
script: |
130+
(Get-Content $(project_site_config)) -replace 'hostName=$(quotes_regexp)', 'hostName="$(sitecore_hostname)"' | Set-Content $(project_site_config)
131+
(Get-Content $(foundation_commerce_config)) -replace '<server>.*</server>', '<server>$(smtp_server)</server>' | Set-Content $(foundation_commerce_config)
132+
(Get-Content $(foundation_commerce_config)) -replace '<userName>.*</userName>', '<userName>$(smtp_username)</userName>' | Set-Content $(foundation_commerce_config)
133+
(Get-Content $(foundation_commerce_config)) -replace '<password>.*</password>', '<password>$(smtp_password)</password>' | Set-Content $(foundation_commerce_config)
134+
- task: PublishPipelineArtifact@1
135+
displayName: Publish web config
136+
inputs:
137+
targetPath: '$(artifacts_location)/web.config'
138+
artifact: 'web_config'
139+
publishLocation: 'pipeline'
140+
141+
- task: PublishPipelineArtifact@1
142+
displayName: Publish unicorn
143+
inputs:
144+
targetPath: '$(artifacts_location)/unicorn'
145+
artifact: 'unicorn'
146+
publishLocation: 'pipeline'
147+
148+
- task: PublishPipelineArtifact@1
149+
displayName: Publish Feature
150+
inputs:
151+
targetPath: '$(artifacts_location)/Feature'
152+
artifact: 'Feature'
153+
publishLocation: 'pipeline'
154+
155+
- task: PublishPipelineArtifact@1
156+
displayName: Publish Foundation
157+
inputs:
158+
targetPath: '$(artifacts_location)/Foundation'
159+
artifact: 'Foundation'
160+
publishLocation: 'pipeline'
161+
162+
- task: PublishPipelineArtifact@1
163+
displayName: Publish Project
164+
inputs:
165+
targetPath: '$(artifacts_location)/Project'
166+
artifact: 'Project'
167+
publishLocation: 'pipeline'
168+
169+
- task: PublishPipelineArtifact@1
170+
displayName: Publish unicorn sync tool
171+
inputs:
172+
targetPath: '$(artifacts_location)/unicorn-sync'
173+
artifact: 'unicorn-sync'
174+
publishLocation: 'pipeline'

0 commit comments

Comments
 (0)