Projekt

Obecné

Profil

Stáhnout (12.1 KB) Statistiky
| Větev: | Tag: | Revize:
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
#Job for testing linux
84
test_job_linux:
85
  stage: test
86
  needs: ["build_job_linux"]
87
  tags:
88
    - dotnet
89
    - linux
90
  only:
91
    refs:
92
      - branches
93
    variables:
94
      - $CI_COMMIT_MESSAGE =~ /@testLinux/i                       #manual trigger for testing
95
      - $CI_COMMIT_MESSAGE =~ /@deploy/i                        #manual trigger for deploy
96
      - $CI_COMMIT_MESSAGE =~ /@testFull/i                      #manual trigger for testing full
97
      - $CI_COMMIT_MESSAGE =~ /See merge request/               #auto trigger for merge requests from GitLab
98
      - $CI_COMMIT_MESSAGE =~ /merge branch/i                   #auto trigger for merge requests from command
99
      - $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i   #auto trigger for remote merge requests from command
100
  script:
101
    - 'dotnet test'    #Run tests using console mode of MSTest (Unit)
102
#Job for release manual windows
103
release_manual_job_windows:
104
  stage: release
105
  needs: ["test_job_windows"]
106
  tags:
107
    - dotnet
108
    - windows10
109
  only:
110
    refs:
111
      - branches
112
    variables:
113
      - $CI_COMMIT_MESSAGE =~ /@deploy/i                        #manual trigger for testing
114
  script:
115
    - 'dotnet publish'
116
    - '$today = (Get-Date).ToString("yyyy_MM_dd-HH_mm_ss")'
117
    - '& mkdir "deploy/modules"'
118
    - '& echo "Build time: $today`n" > deploy\00_buildLog.txt'
119
    - '& echo "Build branch: $CI_COMMIT_BRANCH`n" >> deploy\00_buildLog.txt'
120
    - '& echo "Pipeline: $CI_PIPELINE_URL`n" >> deploy\00_buildLog.txt'
121
    - '& echo "Pipeline trigger source: $CI_PIPELINE_SOURCE`n" >> deploy\00_buildLog.txt'
122
    - '& echo "Runner: $CI_RUNNER_DESCRIPTION`n" >> deploy\00_buildLog.txt'
123
    - '& echo "Description: $CI_COMMIT_MESSAGE`n" >> deploy\00_buildLog.txt'
124
    - '& xcopy /y /s ".\src\Presentation\Leuze.App\bin\Debug\net5.0\publish\*.*" "deploy"'
125
    - '& xcopy /y /s ".\src\Presentation\Leuze.Modules\net5.0\publish\*.*" "deploy\modules"'
126
  artifacts:
127
    name: "Manual Deploy artifact - windows"
128
    expire_in: 30 days
129
    paths:
130
      - '.\deploy'
131
#Job for release developmental windows
132
release_developmental_job_windows:
133
  stage: release
134
  needs: ["test_job_windows"]
135
  tags:
136
    - dotnet
137
    - windows10
138
  only:
139
    refs:
140
      - dev
141
    variables:
142
      - $CI_COMMIT_MESSAGE =~ /See merge request/               #auto trigger for merge requests from GitLab
143
      - $CI_COMMIT_MESSAGE =~ /merge branch/i                   #auto trigger for merge requests from command
144
      - $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i   #auto trigger for remote merge requests from command
145
  script:
146
    - 'dotnet publish'
147
    - '$today = (Get-Date).ToString("yyyy_MM_dd-HH_mm_ss")'
148
    - '& mkdir "deploy/modules"'
149
    - '& echo "Build time: $today`n" > deploy\00_buildLog.txt'
150
    - '& echo "Build branch: $CI_COMMIT_BRANCH`n" >> deploy\00_buildLog.txt'
151
    - '& echo "Pipeline: $CI_PIPELINE_URL`n" >> deploy\00_buildLog.txt'
152
    - '& echo "Pipeline trigger source: $CI_PIPELINE_SOURCE`n" >> deploy\00_buildLog.txt'
153
    - '& echo "Runner: $CI_RUNNER_DESCRIPTION`n" >> deploy\00_buildLog.txt'
154
    - '& echo "Description: $CI_COMMIT_MESSAGE`n" >> deploy\00_buildLog.txt'
155
    - '& xcopy /y /s ".\src\Presentation\Leuze.App\bin\Debug\net5.0\publish\*.*" "deploy"'
156
    - '& xcopy /y /s ".\src\Presentation\Leuze.Modules\net5.0\publish\*.*" "deploy\modules"'
157
  artifacts:
158
    name: "Developmental Deploy artifact - windows"
159
    expire_in: 30 days
160
    paths:
161
      - '.\deploy'
162
#Job for release master windows
163
release_master_job_windows:
164
  stage: release
165
  needs: ["test_job_windows"]
166
  tags:
167
    - dotnet
168
    - windows10
169
  only:
170
    refs:
171
      - master
172
    variables:
173
      - $CI_COMMIT_MESSAGE =~ /See merge request/               #auto trigger for merge requests from GitLab
174
      - $CI_COMMIT_MESSAGE =~ /merge branch/i                   #auto trigger for merge requests from command
175
      - $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i   #auto trigger for remote merge requests from command
176
  script:
177
    - 'dotnet publish'
178
    - '$today = (Get-Date).ToString("yyyy_MM_dd-HH_mm_ss")'
179
    - '& mkdir "deploy/modules"'
180
    - '& echo "Build time: $today`n" > deploy\00_buildLog.txt'
181
    - '& echo "Build branch: $CI_COMMIT_BRANCH`n" >> deploy\00_buildLog.txt'
182
    - '& echo "Pipeline: $CI_PIPELINE_URL`n" >> deploy\00_buildLog.txt'
183
    - '& echo "Pipeline trigger source: $CI_PIPELINE_SOURCE`n" >> deploy\00_buildLog.txt'
184
    - '& echo "Runner: $CI_RUNNER_DESCRIPTION`n" >> deploy\00_buildLog.txt'
185
    - '& echo "Description: $CI_COMMIT_MESSAGE`n" >> deploy\00_buildLog.txt'
186
    - '& xcopy /y /s ".\src\Presentation\Leuze.App\bin\Debug\net5.0\publish\*.*" "deploy"'
187
    - '& xcopy /y /s ".\src\Presentation\Leuze.Modules\net5.0\publish\*.*" "deploy\modules"'
188
  artifacts:
189
    name: "Master Deploy artifact - windows"
190
    expire_in: 30 days
191
    paths:
192
      - '.\deploy'
193
#Job for release manual linux
194
release_manual_job_linux:
195
  stage: release
196
  needs: ["test_job_linux"]
197
  tags:
198
    - dotnet
199
    - linux
200
  only:
201
    refs:
202
      - branches
203
    variables:
204
      - $CI_COMMIT_MESSAGE =~ /@deploy/i                        #manual trigger for testing
205
  script:
206
    - 'dotnet publish'
207
    - 'today=$(date)'
208
    - 'mkdir -p "./deploy/modules"'
209
    - 'echo -e "Build time: $today\n" > ./deploy/00_buildLog.txt'
210
    - 'echo -e "Build branch: $CI_COMMIT_BRANCH\n" >> ./deploy/00_buildLog.txt'
211
    - 'echo -e "Pipeline: $CI_PIPELINE_URL\n" >> ./deploy/00_buildLog.txt'
212
    - 'echo -e "Pipeline trigger source: $CI_PIPELINE_SOURCE\n" >> ./deploy/00_buildLog.txt'
213
    - 'echo -e "Runner: $CI_RUNNER_DESCRIPTION\n" >> ./deploy/00_buildLog.txt'
214
    - 'echo -e "Description: $CI_COMMIT_MESSAGE\n" >> ./deploy/00_buildLog.txt'
215
    - 'cp -r "./src/Presentation/Leuze.App/bin/Debug/net5.0/publish/." "./deploy"'
216
    - 'cp -r "./src/Presentation/Leuze.Modules/net5.0/publish/." "./deploy/modules"'
217
  artifacts:
218
    name: "Manual Deploy artifact - linux"
219
    expire_in: 30 days
220
    paths:
221
      - './deploy'
222
#Job for release developmental linux
223
release_developmental_job_linux:
224
  stage: release
225
  needs: ["test_job_linux"]
226
  tags:
227
    - dotnet
228
    - linux
229
  only:
230
    refs:
231
      - dev
232
    variables:
233
      - $CI_COMMIT_MESSAGE =~ /See merge request/               #auto trigger for merge requests from GitLab
234
      - $CI_COMMIT_MESSAGE =~ /merge branch/i                   #auto trigger for merge requests from command
235
      - $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i   #auto trigger for remote merge requests from command
236
  script:
237
    - 'dotnet publish'
238
    - 'today=$(date)'
239
    - 'mkdir -p "./deploy/modules"'
240
    - 'echo -e "Build time: $today\n" > ./deploy/00_buildLog.txt'
241
    - 'echo -e "Build branch: $CI_COMMIT_BRANCH\n" >> ./deploy/00_buildLog.txt'
242
    - 'echo -e "Pipeline: $CI_PIPELINE_URL\n" >> ./deploy/00_buildLog.txt'
243
    - 'echo -e "Pipeline trigger source: $CI_PIPELINE_SOURCE\n" >> ./deploy/00_buildLog.txt'
244
    - 'echo -e "Runner: $CI_RUNNER_DESCRIPTION\n" >> ./deploy/00_buildLog.txt'
245
    - 'echo -e "Description: $CI_COMMIT_MESSAGE\n" >> ./deploy/00_buildLog.txt'
246
    - 'cp -r "./src/Presentation/Leuze.App/bin/Debug/net5.0/publish/." "./deploy"'
247
    - 'cp -r "./src/Presentation/Leuze.Modules/net5.0/publish/." "./deploy/modules"'
248
  artifacts:
249
    name: "Developmental Deploy artifact - linux"
250
    expire_in: 30 days
251
    paths:
252
      - './deploy'
253
#Job for release master linux
254
release_master_job_linux:
255
  stage: release
256
  needs: ["test_job_linux"]
257
  tags:
258
    - dotnet
259
    - linux
260
  only:
261
    refs:
262
      - master
263
    variables:
264
      - $CI_COMMIT_MESSAGE =~ /See merge request/               #auto trigger for merge requests from GitLab
265
      - $CI_COMMIT_MESSAGE =~ /merge branch/i                   #auto trigger for merge requests from command
266
      - $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i   #auto trigger for remote merge requests from command
267
  script:
268
    - 'dotnet publish'
269
    - 'today=$(date)'
270
    - 'mkdir -p "./deploy/modules"'
271
    - 'echo -e "Build time: $today\n" > ./deploy/00_buildLog.txt'
272
    - 'echo -e "Build branch: $CI_COMMIT_BRANCH\n" >> ./deploy/00_buildLog.txt'
273
    - 'echo -e "Pipeline: $CI_PIPELINE_URL\n" >> ./deploy/00_buildLog.txt'
274
    - 'echo -e "Pipeline trigger source: $CI_PIPELINE_SOURCE\n" >> ./deploy/00_buildLog.txt'
275
    - 'echo -e "Runner: $CI_RUNNER_DESCRIPTION\n" >> ./deploy/00_buildLog.txt'
276
    - 'echo -e "Description: $CI_COMMIT_MESSAGE\n" >> ./deploy/00_buildLog.txt'
277
    - 'cp -r "./src/Presentation/Leuze.App/bin/Debug/net5.0/publish/." "./deploy"'
278
    - 'cp -r "./src/Presentation/Leuze.Modules/net5.0/publish/." "./deploy/modules"'
279
  artifacts:
280
    name: "Master Deploy artifact - linux"
281
    expire_in: 30 days
282
    paths:
283
      - './deploy'
(2-2/4)