Projekt

Obecné

Profil

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