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 8
/
Copy path.azure-pipelines.yml
189 lines (168 loc) · 6.43 KB
/
.azure-pipelines.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
resources:
repositories:
- repository: UnityProject
type: github
endpoint: Innoactive
name: Innoactive/Empty-Unity-Project-2019
ref: develop
- repository: Templates
type: github
endpoint: Innoactive
name: Innoactive/Creator-Azure-Templates
ref: master
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: self
lfs: true
- 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: 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
condition: always()
continueOnError: true
inputs:
testResultsFormat: "NUnit"
testResultsFiles: "TEST-*.xml"
- 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/"
env:
GH_TOKEN: "$(GITHUB_TOKEN)"
- template: replace-string.yml@Templates
parameters:
FilePathInCreator: 'Core/Editor/Analytics/GoogleTracker.cs'
OldString: '$(DEV_TRACKING_ID)'
NewString: '$(LIVE_TRACKING_ID)'
Condition: eq(variables['Build.SourceBranchName'], 'master')
- 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/"
- task: PowerShell@2
displayName: Publish variables
inputs:
targetType: 'inline'
script: |
echo "##vso[task.setvariable variable=Version;isOutput=true]v$(Version)"
name: ExportedVariables
- 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: "creator-core-unitypackage"
publishLocation: "pipeline"
- task: PublishPipelineArtifact@1
displayName: "Publish Logs"
condition: always()
continueOnError: true
inputs:
targetPath: "$(Build.ArtifactStagingDirectory)/logs/"
artifact: "creator-core-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: 'creator-core-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