1
|
#CI_COMMIT_MESSAGE is header and description
|
2
|
#Only childs are ANDed and child restrictions are ORed
|
3
|
variables:
|
4
|
RELEASE_FOLDER: "C:\\Users\\cztestman01\\OneDrive - Leuze electronic GmbH + Co. KG\\00_BUILDS\\DummyProject"
|
5
|
stages:
|
6
|
- build
|
7
|
- test
|
8
|
- release
|
9
|
before_script:
|
10
|
- 'echo "Execution time"' # Current time
|
11
|
- 'date'
|
12
|
#Job for building on windows
|
13
|
build_job_windows:
|
14
|
stage: build
|
15
|
tags:
|
16
|
- dotnet
|
17
|
- windows10
|
18
|
only:
|
19
|
refs:
|
20
|
- branches
|
21
|
variables:
|
22
|
- $CI_COMMIT_MESSAGE =~ /@build/i #manual trigger for building
|
23
|
- $CI_COMMIT_MESSAGE =~ /@test/i #manual trigger for testing
|
24
|
- $CI_COMMIT_MESSAGE =~ /@deploy/i #manual trigger for deploy
|
25
|
- $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab
|
26
|
- $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command
|
27
|
- $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command
|
28
|
script:
|
29
|
- 'dotnet build' #Build project
|
30
|
artifacts:
|
31
|
expire_in: 2 days
|
32
|
paths:
|
33
|
- '.\src\Presentation\Leuze.App\bin\Debug\net5.0' #Upload all builds as artifact
|
34
|
- '.\src\Presentation\Leuze.Modules\net5.0' #Upload all builds as artifact
|
35
|
#Job for building on linux
|
36
|
build_job_linux:
|
37
|
stage: build
|
38
|
tags:
|
39
|
- dotnet
|
40
|
- linux
|
41
|
only:
|
42
|
refs:
|
43
|
- branches
|
44
|
variables:
|
45
|
- $CI_COMMIT_MESSAGE =~ /@build/i #manual trigger for building
|
46
|
- $CI_COMMIT_MESSAGE =~ /@test/i #manual trigger for testing
|
47
|
- $CI_COMMIT_MESSAGE =~ /@deploy/i #manual trigger for deploy
|
48
|
- $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab
|
49
|
- $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command
|
50
|
- $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command
|
51
|
script:
|
52
|
- 'dotnet build' #Build project
|
53
|
artifacts:
|
54
|
expire_in: 2 days
|
55
|
paths:
|
56
|
- './src/Presentation/Leuze.App/bin/Debug/net5.0' #Upload all builds as artifact
|
57
|
- './src/Presentation/Leuze.Modules/net5.0' #Upload all builds as artifact
|
58
|
#Job for testing windows
|
59
|
test_job_windows:
|
60
|
stage: test
|
61
|
needs: ["build_job_windows"]
|
62
|
tags:
|
63
|
- dotnet
|
64
|
- windows10
|
65
|
only:
|
66
|
refs:
|
67
|
- branches
|
68
|
variables:
|
69
|
- $CI_COMMIT_MESSAGE =~ /@testWindows/i #manual trigger for testing
|
70
|
- $CI_COMMIT_MESSAGE =~ /@deploy/i #manual trigger for deploy
|
71
|
- $CI_COMMIT_MESSAGE =~ /@testFull/i #manual trigger for testing full
|
72
|
- $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab
|
73
|
- $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command
|
74
|
- $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command
|
75
|
script:
|
76
|
- 'dotnet test --collect:"XPlat Code Coverage" -r "./TestResults/"' #Run tests using console mode of MSTest (Unit)¨
|
77
|
- 'reportgenerator "-reports:.\TestResults\*\coverage.cobertura.xml" "-targetdir:coveragereport" -reporttypes:Html'
|
78
|
- '(Get-Content .\coveragereport\index.html) -match "Line coverage:"'
|
79
|
artifacts:
|
80
|
expire_in: 2 days
|
81
|
paths:
|
82
|
- './coveragereport'
|
83
|
reports:
|
84
|
cobertura:
|
85
|
- ./TestResults/*.xml
|
86
|
|
87
|
#Job for testing linux
|
88
|
test_job_linux:
|
89
|
stage: test
|
90
|
needs: ["build_job_linux"]
|
91
|
tags:
|
92
|
- dotnet
|
93
|
- linux
|
94
|
only:
|
95
|
refs:
|
96
|
- branches
|
97
|
variables:
|
98
|
- $CI_COMMIT_MESSAGE =~ /@testLinux/i #manual trigger for testing
|
99
|
- $CI_COMMIT_MESSAGE =~ /@deploy/i #manual trigger for deploy
|
100
|
- $CI_COMMIT_MESSAGE =~ /@testFull/i #manual trigger for testing full
|
101
|
- $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab
|
102
|
- $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command
|
103
|
- $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command
|
104
|
script:
|
105
|
- 'dotnet test' #Run tests using console mode of MSTest (Unit)
|
106
|
#Job for release manual windows
|
107
|
release_manual_job_windows:
|
108
|
stage: release
|
109
|
needs: ["test_job_windows"]
|
110
|
tags:
|
111
|
- dotnet
|
112
|
- windows10
|
113
|
only:
|
114
|
refs:
|
115
|
- branches
|
116
|
variables:
|
117
|
- $CI_COMMIT_MESSAGE =~ /@deploy/i #manual trigger for testing
|
118
|
script:
|
119
|
- 'dotnet publish'
|
120
|
- '$today = (Get-Date).ToString("yyyy_MM_dd-HH_mm_ss")'
|
121
|
- '& mkdir "deploy/modules"'
|
122
|
- '& echo "Build time: $today`n" > deploy\00_buildLog.txt'
|
123
|
- '& echo "Build branch: $CI_COMMIT_BRANCH`n" >> deploy\00_buildLog.txt'
|
124
|
- '& echo "Pipeline: $CI_PIPELINE_URL`n" >> deploy\00_buildLog.txt'
|
125
|
- '& echo "Pipeline trigger source: $CI_PIPELINE_SOURCE`n" >> deploy\00_buildLog.txt'
|
126
|
- '& echo "Runner: $CI_RUNNER_DESCRIPTION`n" >> deploy\00_buildLog.txt'
|
127
|
- '& echo "Description: $CI_COMMIT_MESSAGE`n" >> deploy\00_buildLog.txt'
|
128
|
- '& xcopy /y /s ".\src\Presentation\Leuze.App\bin\Debug\net5.0\publish\*.*" "deploy"'
|
129
|
- '& xcopy /y /s ".\src\Presentation\Leuze.Modules\net5.0\publish\*.*" "deploy\modules"'
|
130
|
artifacts:
|
131
|
name: "Manual Deploy artifact - windows"
|
132
|
expire_in: 30 days
|
133
|
paths:
|
134
|
- '.\deploy'
|
135
|
#Job for release developmental windows
|
136
|
release_developmental_job_windows:
|
137
|
stage: release
|
138
|
needs: ["test_job_windows"]
|
139
|
tags:
|
140
|
- dotnet
|
141
|
- windows10
|
142
|
only:
|
143
|
refs:
|
144
|
- dev
|
145
|
variables:
|
146
|
- $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab
|
147
|
- $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command
|
148
|
- $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command
|
149
|
script:
|
150
|
- 'dotnet publish'
|
151
|
- '$today = (Get-Date).ToString("yyyy_MM_dd-HH_mm_ss")'
|
152
|
- '& mkdir "deploy/modules"'
|
153
|
- '& echo "Build time: $today`n" > deploy\00_buildLog.txt'
|
154
|
- '& echo "Build branch: $CI_COMMIT_BRANCH`n" >> deploy\00_buildLog.txt'
|
155
|
- '& echo "Pipeline: $CI_PIPELINE_URL`n" >> deploy\00_buildLog.txt'
|
156
|
- '& echo "Pipeline trigger source: $CI_PIPELINE_SOURCE`n" >> deploy\00_buildLog.txt'
|
157
|
- '& echo "Runner: $CI_RUNNER_DESCRIPTION`n" >> deploy\00_buildLog.txt'
|
158
|
- '& echo "Description: $CI_COMMIT_MESSAGE`n" >> deploy\00_buildLog.txt'
|
159
|
- '& xcopy /y /s ".\src\Presentation\Leuze.App\bin\Debug\net5.0\publish\*.*" "deploy"'
|
160
|
- '& xcopy /y /s ".\src\Presentation\Leuze.Modules\net5.0\publish\*.*" "deploy\modules"'
|
161
|
artifacts:
|
162
|
name: "Developmental Deploy artifact - windows"
|
163
|
expire_in: 30 days
|
164
|
paths:
|
165
|
- '.\deploy'
|
166
|
#Job for release master windows
|
167
|
release_master_job_windows:
|
168
|
stage: release
|
169
|
needs: ["test_job_windows"]
|
170
|
tags:
|
171
|
- dotnet
|
172
|
- windows10
|
173
|
only:
|
174
|
refs:
|
175
|
- master
|
176
|
variables:
|
177
|
- $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab
|
178
|
- $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command
|
179
|
- $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command
|
180
|
script:
|
181
|
- 'dotnet publish'
|
182
|
- '$today = (Get-Date).ToString("yyyy_MM_dd-HH_mm_ss")'
|
183
|
- '& mkdir "deploy/modules"'
|
184
|
- '& echo "Build time: $today`n" > deploy\00_buildLog.txt'
|
185
|
- '& echo "Build branch: $CI_COMMIT_BRANCH`n" >> deploy\00_buildLog.txt'
|
186
|
- '& echo "Pipeline: $CI_PIPELINE_URL`n" >> deploy\00_buildLog.txt'
|
187
|
- '& echo "Pipeline trigger source: $CI_PIPELINE_SOURCE`n" >> deploy\00_buildLog.txt'
|
188
|
- '& echo "Runner: $CI_RUNNER_DESCRIPTION`n" >> deploy\00_buildLog.txt'
|
189
|
- '& echo "Description: $CI_COMMIT_MESSAGE`n" >> deploy\00_buildLog.txt'
|
190
|
- '& xcopy /y /s ".\src\Presentation\Leuze.App\bin\Debug\net5.0\publish\*.*" "deploy"'
|
191
|
- '& xcopy /y /s ".\src\Presentation\Leuze.Modules\net5.0\publish\*.*" "deploy\modules"'
|
192
|
artifacts:
|
193
|
name: "Master Deploy artifact - windows"
|
194
|
expire_in: 30 days
|
195
|
paths:
|
196
|
- '.\deploy'
|
197
|
#Job for release manual linux
|
198
|
release_manual_job_linux:
|
199
|
stage: release
|
200
|
needs: ["test_job_linux"]
|
201
|
tags:
|
202
|
- dotnet
|
203
|
- linux
|
204
|
only:
|
205
|
refs:
|
206
|
- branches
|
207
|
variables:
|
208
|
- $CI_COMMIT_MESSAGE =~ /@deploy/i #manual trigger for testing
|
209
|
script:
|
210
|
- 'dotnet publish'
|
211
|
- 'today=$(date)'
|
212
|
- 'mkdir -p "./deploy/modules"'
|
213
|
- 'echo -e "Build time: $today\n" > ./deploy/00_buildLog.txt'
|
214
|
- 'echo -e "Build branch: $CI_COMMIT_BRANCH\n" >> ./deploy/00_buildLog.txt'
|
215
|
- 'echo -e "Pipeline: $CI_PIPELINE_URL\n" >> ./deploy/00_buildLog.txt'
|
216
|
- 'echo -e "Pipeline trigger source: $CI_PIPELINE_SOURCE\n" >> ./deploy/00_buildLog.txt'
|
217
|
- 'echo -e "Runner: $CI_RUNNER_DESCRIPTION\n" >> ./deploy/00_buildLog.txt'
|
218
|
- 'echo -e "Description: $CI_COMMIT_MESSAGE\n" >> ./deploy/00_buildLog.txt'
|
219
|
- 'cp -r "./src/Presentation/Leuze.App/bin/Debug/net5.0/publish/." "./deploy"'
|
220
|
- 'cp -r "./src/Presentation/Leuze.Modules/net5.0/publish/." "./deploy/modules"'
|
221
|
artifacts:
|
222
|
name: "Manual Deploy artifact - linux"
|
223
|
expire_in: 30 days
|
224
|
paths:
|
225
|
- './deploy'
|
226
|
#Job for release developmental linux
|
227
|
release_developmental_job_linux:
|
228
|
stage: release
|
229
|
needs: ["test_job_linux"]
|
230
|
tags:
|
231
|
- dotnet
|
232
|
- linux
|
233
|
only:
|
234
|
refs:
|
235
|
- dev
|
236
|
variables:
|
237
|
- $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab
|
238
|
- $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command
|
239
|
- $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command
|
240
|
script:
|
241
|
- 'dotnet publish'
|
242
|
- 'today=$(date)'
|
243
|
- 'mkdir -p "./deploy/modules"'
|
244
|
- 'echo -e "Build time: $today\n" > ./deploy/00_buildLog.txt'
|
245
|
- 'echo -e "Build branch: $CI_COMMIT_BRANCH\n" >> ./deploy/00_buildLog.txt'
|
246
|
- 'echo -e "Pipeline: $CI_PIPELINE_URL\n" >> ./deploy/00_buildLog.txt'
|
247
|
- 'echo -e "Pipeline trigger source: $CI_PIPELINE_SOURCE\n" >> ./deploy/00_buildLog.txt'
|
248
|
- 'echo -e "Runner: $CI_RUNNER_DESCRIPTION\n" >> ./deploy/00_buildLog.txt'
|
249
|
- 'echo -e "Description: $CI_COMMIT_MESSAGE\n" >> ./deploy/00_buildLog.txt'
|
250
|
- 'cp -r "./src/Presentation/Leuze.App/bin/Debug/net5.0/publish/." "./deploy"'
|
251
|
- 'cp -r "./src/Presentation/Leuze.Modules/net5.0/publish/." "./deploy/modules"'
|
252
|
artifacts:
|
253
|
name: "Developmental Deploy artifact - linux"
|
254
|
expire_in: 30 days
|
255
|
paths:
|
256
|
- './deploy'
|
257
|
#Job for release master linux
|
258
|
release_master_job_linux:
|
259
|
stage: release
|
260
|
needs: ["test_job_linux"]
|
261
|
tags:
|
262
|
- dotnet
|
263
|
- linux
|
264
|
only:
|
265
|
refs:
|
266
|
- master
|
267
|
variables:
|
268
|
- $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab
|
269
|
- $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command
|
270
|
- $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command
|
271
|
script:
|
272
|
- 'dotnet publish'
|
273
|
- 'today=$(date)'
|
274
|
- 'mkdir -p "./deploy/modules"'
|
275
|
- 'echo -e "Build time: $today\n" > ./deploy/00_buildLog.txt'
|
276
|
- 'echo -e "Build branch: $CI_COMMIT_BRANCH\n" >> ./deploy/00_buildLog.txt'
|
277
|
- 'echo -e "Pipeline: $CI_PIPELINE_URL\n" >> ./deploy/00_buildLog.txt'
|
278
|
- 'echo -e "Pipeline trigger source: $CI_PIPELINE_SOURCE\n" >> ./deploy/00_buildLog.txt'
|
279
|
- 'echo -e "Runner: $CI_RUNNER_DESCRIPTION\n" >> ./deploy/00_buildLog.txt'
|
280
|
- 'echo -e "Description: $CI_COMMIT_MESSAGE\n" >> ./deploy/00_buildLog.txt'
|
281
|
- 'cp -r "./src/Presentation/Leuze.App/bin/Debug/net5.0/publish/." "./deploy"'
|
282
|
- 'cp -r "./src/Presentation/Leuze.Modules/net5.0/publish/." "./deploy/modules"'
|
283
|
artifacts:
|
284
|
name: "Master Deploy artifact - linux"
|
285
|
expire_in: 30 days
|
286
|
paths:
|
287
|
- './deploy'
|