Projekt

Obecné

Profil

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