Projekt

Obecné

Profil

Stáhnout (5.73 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
  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
  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
  dependencies:
78
    - build_job_windows
79
#Job for testing linux
80
test_job_linux:
81
  stage: test
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
  dependencies:
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
(2-2/4)