Revize 2fed27a9
Přidáno uživatelem Milan Hotovec před téměř 4 roky(ů)
.gitlab-ci.yml | ||
---|---|---|
1 | 1 |
#CI_COMMIT_MESSAGE is header and description |
2 | 2 |
#Only childs are ANDed and child restrictions are ORed |
3 | 3 |
variables: |
4 |
NUGET_PATH: "C:\\Tools\\Nuget\\nuget.exe" |
|
5 |
MSBUILD_PATH: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" |
|
6 | 4 |
VSTEST_PATH: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow\\vstest.console.exe" |
7 | 5 |
RELEASE_FOLDER: "C:\\Users\\cztestman01\\OneDrive - Leuze electronic GmbH + Co. KG\\00_BUILDS\\DummyProject" |
8 | 6 |
stages: |
9 | 7 |
- build |
10 | 8 |
- test |
11 |
- release |
|
9 |
# - release
|
|
12 | 10 |
before_script: |
13 |
- 'echo "Execution time" (Get-Date).ToString("yyyy_MM_dd-HH_mm_ss")' # Current time |
|
14 |
- 'cd .\DummyProject' #Change directory to lowest same working directory |
|
15 |
- '& "$NUGET_PATH" restore' #Before all restore packages |
|
16 |
#Job for building |
|
17 |
build_job: |
|
11 |
- 'echo "Execution time"' # Current time |
|
12 |
- 'date' |
|
13 |
#Job for building on windows |
|
14 |
build_job_windows: |
|
18 | 15 |
stage: build |
19 | 16 |
tags: |
20 |
- csharp
|
|
21 |
- win10 |
|
17 |
- dotnet
|
|
18 |
- windows10
|
|
22 | 19 |
only: |
23 | 20 |
refs: |
24 | 21 |
- branches |
25 | 22 |
variables: |
23 |
- $CI_COMMIT_MESSAGE =~ /@build/i #manual trigger for building |
|
26 | 24 |
- $CI_COMMIT_MESSAGE =~ /@test/i #manual trigger for testing |
27 | 25 |
- $CI_COMMIT_MESSAGE =~ /@deploy/i #manual trigger for deploy |
28 | 26 |
- $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab |
29 | 27 |
- $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command |
30 | 28 |
- $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command |
31 | 29 |
script: |
32 |
- '& "$MSBUILD_PATH" /p:Platform=x64' #Build project |
|
33 |
- '& "$MSBUILD_PATH" /p:Configuration="Release" /p:Platform=x64' #Build project |
|
30 |
- 'dotnet build' #Build project |
|
34 | 31 |
artifacts: |
35 | 32 |
expire_in: 2 days |
36 | 33 |
paths: |
37 |
- '.\DummyProject\DummyProject\bin\' #Upload all builds as artifact |
|
38 |
- '.\DummyProject\CalcTests\bin\' #Upload all builds as artifact |
|
39 |
#Job for testing |
|
40 |
test_job: |
|
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: |
|
41 | 61 |
stage: test |
42 | 62 |
tags: |
43 |
- csharp
|
|
44 |
- win10 |
|
63 |
- dotnet
|
|
64 |
- windows10
|
|
45 | 65 |
only: |
46 | 66 |
refs: |
47 | 67 |
- branches |
48 | 68 |
variables: |
49 |
- $CI_COMMIT_MESSAGE =~ /@testApp/i #manual trigger for testing
|
|
69 |
- $CI_COMMIT_MESSAGE =~ /@testWindows/i #manual trigger for testing
|
|
50 | 70 |
- $CI_COMMIT_MESSAGE =~ /@deploy/i #manual trigger for deploy |
51 | 71 |
- $CI_COMMIT_MESSAGE =~ /@testFull/i #manual trigger for testing full |
52 | 72 |
- $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab |
53 | 73 |
- $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command |
54 | 74 |
- $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command |
55 | 75 |
script: |
56 |
- '& "$VSTEST_PATH" .\CalcTests\bin\x64\Release\CalcTests.dll' #Run tests using console mode of MSTest (Unit)
|
|
76 |
- 'dotnet test' #Run tests using console mode of MSTest (Unit)
|
|
57 | 77 |
dependencies: |
58 |
- build_job |
|
59 |
#Job for release public
|
|
60 |
release_public_job:
|
|
61 |
stage: release
|
|
78 |
- build_job_windows
|
|
79 |
#Job for testing linux
|
|
80 |
test_job_linux:
|
|
81 |
stage: test
|
|
62 | 82 |
tags: |
63 |
- csharp
|
|
64 |
- win10
|
|
83 |
- dotnet
|
|
84 |
- linux
|
|
65 | 85 |
only: |
66 | 86 |
refs: |
67 |
- master
|
|
87 |
- branches
|
|
68 | 88 |
variables: |
69 |
- $CI_COMMIT_MESSAGE =~ /@deploy/i #manual trigger for testing |
|
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 |
|
70 | 92 |
- $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab |
71 | 93 |
- $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command |
72 | 94 |
- $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command |
73 | 95 |
script: |
74 |
- '$today = (Get-Date).ToString("yyyy_MM_dd-HH_mm_ss")' |
|
75 |
- '& mkdir "$RELEASE_FOLDER\$today"' |
|
76 |
- '& echo "Build branch: $CI_COMMIT_BRANCH`n" > $RELEASE_FOLDER\$today\buildLog.txt' |
|
77 |
- '& echo "Pipeline: $CI_PIPELINE_URL`n" >> $RELEASE_FOLDER\$today\buildLog.txt' |
|
78 |
- '& echo "Pipeline trigger source: $CI_PIPELINE_SOURCE`n" >> $RELEASE_FOLDER\$today\buildLog.txt' |
|
79 |
- '& echo "Runner: $CI_RUNNER_DESCRIPTION`n" >> $RELEASE_FOLDER\$today\buildLog.txt' |
|
80 |
- '& echo "Description: $CI_COMMIT_MESSAGE`n" >> $RELEASE_FOLDER\$today\buildLog.txt' |
|
81 |
- '& xcopy /y /s ".\DummyProject\bin\*.*" "$RELEASE_FOLDER\$today"' |
|
82 |
artifacts: |
|
83 |
name: "Deploy artifact" |
|
84 |
expire_in: 30 days |
|
85 |
paths: |
|
86 |
- '.\DummyProject\DummyProject\bin\' |
|
96 |
- 'dotnet test' #Run tests using console mode of MSTest (Unit) |
|
87 | 97 |
dependencies: |
88 |
- build_job #Build must be ok and using this, artifacts will be used |
|
89 |
- test_job #Only when tests are OK |
|
98 |
- build_job_linux |
|
99 |
##Job for release public |
|
100 |
#release_public_job: |
|
101 |
# stage: release |
|
102 |
# tags: |
|
103 |
# - csharp |
|
104 |
# - win10 |
|
105 |
# only: |
|
106 |
# refs: |
|
107 |
# - master |
|
108 |
# variables: |
|
109 |
# - $CI_COMMIT_MESSAGE =~ /@deploy/i #manual trigger for testing |
|
110 |
# - $CI_COMMIT_MESSAGE =~ /See merge request/ #auto trigger for merge requests from GitLab |
|
111 |
# - $CI_COMMIT_MESSAGE =~ /merge branch/i #auto trigger for merge requests from command |
|
112 |
# - $CI_COMMIT_MESSAGE =~ /Merge remote-tracking branch/i #auto trigger for remote merge requests from command |
|
113 |
# script: |
|
114 |
# - '$today = (Get-Date).ToString("yyyy_MM_dd-HH_mm_ss")' |
|
115 |
# - '& mkdir "$RELEASE_FOLDER\$today"' |
|
116 |
# - '& echo "Build branch: $CI_COMMIT_BRANCH`n" > $RELEASE_FOLDER\$today\buildLog.txt' |
|
117 |
# - '& echo "Pipeline: $CI_PIPELINE_URL`n" >> $RELEASE_FOLDER\$today\buildLog.txt' |
|
118 |
# - '& echo "Pipeline trigger source: $CI_PIPELINE_SOURCE`n" >> $RELEASE_FOLDER\$today\buildLog.txt' |
|
119 |
# - '& echo "Runner: $CI_RUNNER_DESCRIPTION`n" >> $RELEASE_FOLDER\$today\buildLog.txt' |
|
120 |
# - '& echo "Description: $CI_COMMIT_MESSAGE`n" >> $RELEASE_FOLDER\$today\buildLog.txt' |
|
121 |
# - '& xcopy /y /s ".\DummyProject\bin\*.*" "$RELEASE_FOLDER\$today"' |
|
122 |
# artifacts: |
|
123 |
# name: "Deploy artifact" |
|
124 |
# expire_in: 30 days |
|
125 |
# paths: |
|
126 |
# - '.\DummyProject\DummyProject\bin\' |
|
127 |
# dependencies: |
|
128 |
# - build_job #Build must be ok and using this, artifacts will be used |
|
129 |
# - test_job #Only when tests are OK |
Také k dispozici: Unified diff
Initial Build and test config
@testFull