This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.azure-pipeline.yml
241 lines (216 loc) · 7.91 KB
/
.azure-pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
resources:
repositories:
- repository: Creator
type: github
endpoint: Innoactive
name: Innoactive/Creator
ref: develop
- repository: TextToSpeech
type: github
endpoint: Innoactive
name: Innoactive/TextToSpeech-Component
ref: develop
- repository: BasicConditionsAndBehaviors
type: github
endpoint: Innoactive
name: Innoactive/Basic-Conditions-And-Behaviors
ref: develop
- repository: BasicInteraction
type: github
endpoint: Innoactive
name: Innoactive/Basic-Interaction-Component
ref: develop
- repository: XRInteraction
type: github
endpoint: Innoactive
name: Innoactive/XR-Interaction-Component
ref: develop
- repository: UnityProject
type: github
endpoint: Innoactive
name: Innoactive/Empty-Unity-Project-2019
ref: develop
trigger:
- master
- develop
pr:
branches:
include:
- develop
pool: Unity
variables:
- group: basic-unity
stages:
- stage: Lint
displayName: Lint
jobs:
- job: CommitMessageCheck
displayName: Commit Message Check
steps:
- script: npm install @commitlint/cli commitlint-azure-pipelines-cli @commitlint/config-conventional
- script: >
npx
-p @commitlint/cli
-p commitlint-azure-pipelines-cli
-p @commitlint/config-conventional
commitlint-azure-pipelines --config .commitlintrc.json
- stage: Build
displayName: 'Build & Test'
condition: succeeded()
jobs:
- job: build
workspace:
clean: all
steps:
- checkout: UnityProject
lfs: true
- checkout: Creator
lfs: true
- checkout: TextToSpeech
lfs: true
- checkout: BasicConditionsAndBehaviors
lfs: true
- checkout: BasicInteraction
lfs: true
- checkout: XRInteraction
lfs: true
- checkout: self
lfs: true
- task: UseNode@1
- task: PowerShell@2
displayName: "Run Semantic release"
condition: eq(variables['Build.SourceBranchName'], 'master')
inputs:
targetType: 'inline'
script: |
npx -p semantic-release-ado semantic-release
workingDirectory: "Creator-Base-Template/"
env:
GH_TOKEN: "$(GITHUB_TOKEN)"
- task: PowerShell@2
displayName: Fetch version from git
condition: ne(variables['Build.SourceBranchName'], 'master')
inputs:
targetType: 'inline'
script: |
$TAG = (git tag -l "v*" --sort=committerdate | Select -last 1)
if(!$TAG) { $TAG = "v0.0.0" }
$TAG = $TAG.TrimStart("v") + "-" + (git log -1 --pretty=format:%h)
Write-Host "##vso[task.setvariable variable=Version]$TAG"
workingDirectory: "Creator-Base-Template/"
- task: CopyFiles@2
inputs:
SourceFolder: 'Empty-Unity-Project-2019/'
Contents: '**'
TargetFolder: '$(Path.Project)'
displayName: Copy base Project
- task: CopyFiles@2
inputs:
SourceFolder: 'Creator/'
Contents: '**'
TargetFolder: '$(Path.Creator)/Core'
displayName: Copy Creator Core
- task: CopyFiles@2
inputs:
SourceFolder: 'Basic-Conditions-And-Behaviors/'
Contents: '**'
TargetFolder: '$(Path.Creator)/Components/Basic-Conditions-And-Behaviors'
displayName: Copy Basic Conditions And Behaviors Component
- task: CopyFiles@2
inputs:
SourceFolder: 'Basic-Interaction-Component/'
Contents: '**'
TargetFolder: '$(Path.Creator)/Components/Basic-Interaction'
displayName: Copy Basic Interaction Component
- task: CopyFiles@2
inputs:
SourceFolder: 'XR-Interaction-Component/'
Contents: '**'
TargetFolder: '$(Path.Creator)/Components/XR-Interaction'
displayName: Copy XR Interaction Component
- task: CopyFiles@2
inputs:
SourceFolder: "TextToSpeech-Component/"
Contents: "**"
TargetFolder: "$(Path.Creator)/Components/Text-To-Speech"
displayName: Copy Text-To-Speech Component
- task: CopyFiles@2
inputs:
SourceFolder: 'Creator-Base-Template/'
Contents: '**'
TargetFolder: '$(Path.Creator)/Base-Template'
displayName: Copy IA Template
- task: DeleteFiles@1
inputs:
Contents: '!(Project)'
displayName: Clean Up
- task: PowerShell@2
displayName: Build Project
inputs:
targetType: 'inline'
script: |
u3d available -f
u3d install $(UnityVersion)
u3d run -u $(UnityVersion) -- -projectPath '$(Path.Project)' -logFile $(Build.ArtifactStagingDirectory)/logs/editor-build.log -nographics -quit -batchmode -buildWindows64Player Build\\TestBuild\\TestBuild.exe
- task: PowerShell@2
displayName: Run Tests
inputs:
targetType: 'inline'
script: |
u3d run -u $(UnityVersion) -- -projectPath '$(Path.Project)' -logFile $(Build.ArtifactStagingDirectory)/logs/editor_editmode_tests.log -batchmode -runTests -testPlatform editmode -testResults $(System.DefaultWorkingDirectory)\TEST-EditMode.xml
u3d run -u $(UnityVersion) -- -projectPath '$(Path.Project)' -logFile $(Build.ArtifactStagingDirectory)/logs/editor_playmode_tests.log -batchmode -runTests -testPlatform playmode -testResults $(System.DefaultWorkingDirectory)\TEST-PlayMode.xml
- task: PublishTestResults@2
inputs:
testResultsFormat: "NUnit"
testResultsFiles: "TEST-*.xml"
- task: PowerShell@2
displayName: Export Unity package
inputs:
targetType: 'inline'
script: |
echo 'Exporting version $(Version)'
((Get-Content -path $(Path.ExportConfig)/$(ExportConfigName) -Raw) -replace '{version}','v$(Version)') | Set-Content -Path $(Path.Project)/export-config.json
u3d run -u $(UnityVersion) -- -projectPath '$(Path.Project)' -logFile $(Build.ArtifactStagingDirectory)/logs/editor_export.log -batchmode -quit -executeMethod Innoactive.CreatorEditor.PackageExporter.Export --export-config export-config.json
Start-Sleep -s 5
- task: PublishPipelineArtifact@1
displayName: "Publish Unity Package"
inputs:
targetPath: "$(Build.ArtifactStagingDirectory)/packages/"
artifact: "base-template-unitypackage"
publishLocation: "pipeline"
- task: PublishPipelineArtifact@1
displayName: "Publish Logs"
condition: always()
inputs:
targetPath: "$(Build.ArtifactStagingDirectory)/logs/"
artifact: "creator-template-logs-$(System.JobId)"
publishLocation: "pipeline"
- stage: Release
displayName: Release
dependsOn:
- Lint
- Build
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))
jobs:
- job:
workspace:
clean: all
variables:
Version: $[stageDependencies.Build.build.outputs['ExportedVariables.Version']]
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download exported package'
inputs:
buildType: 'current'
artifactName: 'base-template-unitypackage'
targetPath: '$(Build.ArtifactStagingDirectory)/packages/'
- task: GitHubRelease@1
inputs:
gitHubConnection: 'Github.com - Jenkins / CI User'
repositoryName: 'Innoactive/Creator'
action: 'edit'
target: '$(Build.SourceVersion)'
tag: '$(Version)'
assetUploadMode: "replace"
assets: "$(Build.ArtifactStagingDirectory)/packages/*"
addChangeLog: false