1
|
#CI_COMMIT_MESSAGE is header and description
|
2
|
#Only childs are ANDed and child restrictions are ORed
|
3
|
variables:
|
4
|
VSTEST_PATH: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow\\vstest.console.exe"
|
5
|
RELEASE_FOLDER: "C:\\Users\\cztestman01\\OneDrive - Leuze electronic GmbH + Co. KG\\00_BUILDS\\DummyProject"
|
6
|
stages:
|
7
|
- build
|
8
|
- test
|
9
|
# - release
|
10
|
before_script:
|
11
|
- 'echo "Execution time"' # Current time
|
12
|
- 'date'
|
13
|
#Job for building on windows
|
14
|
build_job_windows:
|
15
|
stage: build
|
16
|
tags:
|
17
|
- dotnet
|
18
|
- windows10
|
19
|
only:
|
20
|
refs:
|
21
|
- branches
|
22
|
variables:
|
23
|
- $CI_COMMIT_MESSAGE =~ /@build/i #manual trigger for building
|
24
|
- $CI_COMMIT_MESSAGE =~ /@test/i #manual trigger for testing
|
25
|
- $CI_COMMIT_MESSAGE =~ /@deploy/i #manual trigger for deploy
|
26
|
- $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab
|
27
|
- $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command
|
28
|
- $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command
|
29
|
script:
|
30
|
- 'dotnet build' #Build project
|
31
|
artifacts:
|
32
|
expire_in: 2 days
|
33
|
paths:
|
34
|
- '.\src\Presentation\Leuze.App\bin\Debug\net5.0' #Upload all builds as artifact
|
35
|
- '.\src\Presentation\Leuze.Modules\net5.0' #Upload all builds as artifact
|
36
|
#Job for building on linux
|
37
|
build_job_linux:
|
38
|
stage: build
|
39
|
tags:
|
40
|
- dotnet
|
41
|
- linux
|
42
|
only:
|
43
|
refs:
|
44
|
- branches
|
45
|
variables:
|
46
|
- $CI_COMMIT_MESSAGE =~ /@build/i #manual trigger for building
|
47
|
- $CI_COMMIT_MESSAGE =~ /@test/i #manual trigger for testing
|
48
|
- $CI_COMMIT_MESSAGE =~ /@deploy/i #manual trigger for deploy
|
49
|
- $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab
|
50
|
- $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command
|
51
|
- $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command
|
52
|
script:
|
53
|
- 'dotnet build' #Build project
|
54
|
artifacts:
|
55
|
expire_in: 2 days
|
56
|
paths:
|
57
|
- './src/Presentation/Leuze.App/bin/Debug/net5.0' #Upload all builds as artifact
|
58
|
- './src/Presentation/Leuze.Modules/net5.0' #Upload all builds as artifact
|
59
|
#Job for testing windows
|
60
|
test_job_windows:
|
61
|
stage: test
|
62
|
needs: ["build_job_windows"]
|
63
|
tags:
|
64
|
- dotnet
|
65
|
- windows10
|
66
|
only:
|
67
|
refs:
|
68
|
- branches
|
69
|
variables:
|
70
|
- $CI_COMMIT_MESSAGE =~ /@testWindows/i #manual trigger for testing
|
71
|
- $CI_COMMIT_MESSAGE =~ /@deploy/i #manual trigger for deploy
|
72
|
- $CI_COMMIT_MESSAGE =~ /@testFull/i #manual trigger for testing full
|
73
|
- $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab
|
74
|
- $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command
|
75
|
- $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command
|
76
|
script:
|
77
|
- 'dotnet test' #Run tests using console mode of MSTest (Unit)
|
78
|
#Job for testing linux
|
79
|
test_job_linux:
|
80
|
stage: test
|
81
|
needs: ["build_job_linux"]
|
82
|
tags:
|
83
|
- dotnet
|
84
|
- linux
|
85
|
only:
|
86
|
refs:
|
87
|
- branches
|
88
|
variables:
|
89
|
- $CI_COMMIT_MESSAGE =~ /@testLinux/i #manual trigger for testing
|
90
|
- $CI_COMMIT_MESSAGE =~ /@deploy/i #manual trigger for deploy
|
91
|
- $CI_COMMIT_MESSAGE =~ /@testFull/i #manual trigger for testing full
|
92
|
- $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab
|
93
|
- $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command
|
94
|
- $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command
|
95
|
script:
|
96
|
- 'dotnet test' #Run tests using console mode of MSTest (Unit)
|
97
|
##Job for release public
|
98
|
#release_public_job:
|
99
|
# stage: release
|
100
|
# tags:
|
101
|
# - csharp
|
102
|
# - win10
|
103
|
# only:
|
104
|
# refs:
|
105
|
# - master
|
106
|
# variables:
|
107
|
# - $CI_COMMIT_MESSAGE =~ /@deploy/i #manual trigger for testing
|
108
|
# - $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab
|
109
|
# - $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command
|
110
|
# - $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command
|
111
|
# script:
|
112
|
# - '$today = (Get-Date).ToString("yyyy_MM_dd-HH_mm_ss")'
|
113
|
# - '& mkdir "$RELEASE_FOLDER\$today"'
|
114
|
# - '& echo "Build branch: $CI_COMMIT_BRANCH`n" > $RELEASE_FOLDER\$today\buildLog.txt'
|
115
|
# - '& echo "Pipeline: $CI_PIPELINE_URL`n" >> $RELEASE_FOLDER\$today\buildLog.txt'
|
116
|
# - '& echo "Pipeline trigger source: $CI_PIPELINE_SOURCE`n" >> $RELEASE_FOLDER\$today\buildLog.txt'
|
117
|
# - '& echo "Runner: $CI_RUNNER_DESCRIPTION`n" >> $RELEASE_FOLDER\$today\buildLog.txt'
|
118
|
# - '& echo "Description: $CI_COMMIT_MESSAGE`n" >> $RELEASE_FOLDER\$today\buildLog.txt'
|
119
|
# - '& xcopy /y /s ".\DummyProject\bin\*.*" "$RELEASE_FOLDER\$today"'
|
120
|
# artifacts:
|
121
|
# name: "Deploy artifact"
|
122
|
# expire_in: 30 days
|
123
|
# paths:
|
124
|
# - '.\DummyProject\DummyProject\bin\'
|
125
|
# dependencies:
|
126
|
# - build_job #Build must be ok and using this, artifacts will be used
|
127
|
# - test_job #Only when tests are OK
|