-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
106 lines (95 loc) · 2.63 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
image: microsoft/dotnet:latest
stages:
- build
- test
- publish
- deploy
build Package XML:
stage: build
script:
- 'dotnet build'
tags:
- docker-executor
test Package XML:
stage: test
script:
- 'cd RobSharper.Ros.PackageXml.Tests'
- "dotnet test --logger \"junit\" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=\"$PWD/coverage/\" /p:Exclude=\"[xunit*]*%2C[RobSharper.Ros.PackageXml.Tests]*\" /p:ExcludeByAttribute=\"GeneratedCodeAttribute%2CObsolete%2CCompilerGeneratedAttribute\""
- 'dotnet $(find ~/.nuget/packages/reportgenerator -name ReportGenerator.dll | head -n1) -reports:coverage/coverage.opencover.xml -targetdir:coverage/report -verbosity:Warning -reporttypes:Html'
coverage: '/Total\s+\|\s+(\d{0,2}\.\d{1,2}%)/'
artifacts:
paths:
- 'RobSharper.Ros.PackageXml.Tests/overage'
- 'RobSharper.Ros.PackageXml.Tests/TestResults/TestResults.xml'
reports:
junit: 'RobSharper.Ros.PackageXml.Tests/TestResults/TestResults.xml'
tags:
- docker-executor
# Create a versioned NuGet package
# This task is only executed for the branches develop and master as well as version tags
nuget-pack:
stage: publish
only:
- develop
- master
- /^v.*$/
script:
- 'export X_CI_VERSION=$(git describe | cut -c 2-)'
- 'echo Publishing version $X_CI_VERSION'
- 'cd RobSharper.Ros.PackageXml'
- 'dotnet pack -c Release -o ../nuget/ /p:Version=$X_CI_VERSION'
artifacts:
paths:
- 'nuget'
- 'RobSharper.Ros.PackageXml/bin/Release/'
tags:
- docker-executor
# Deploy to JR BaGet server
# This is done for all pushes of version tags (v*) automatically
# Pushes to the master branch and web pipeline triggers must be deployed manually
.baget_base: &baget_base
stage: deploy
dependencies:
- nuget-pack
variables:
GIT_STRATEGY: none
environment:
name: JR BaGet
url: http://robv005:33333/
script:
- 'cd nuget'
- 'dotnet nuget push *.nupkg -s $JR_BAGET_URL -k $JR_BAGET_API_KEY'
tags:
- docker-executor
baget auto:
<<: *baget_base
only:
- /^v.*$/
except:
- web
- schedules
baget manual:
<<: *baget_base
only:
- master
when: manual
# Deploy to NuGet.org
# This task has to be triggered manually
nuget.org:
stage: deploy
dependencies:
- nuget-pack
variables:
GIT_STRATEGY: none
environment:
name: NuGet.org
url: https://www.nuget.org/
only:
- master
- /^v.*$/
script:
- 'cd nuget'
- 'dotnet nuget push *.nupkg -s https://api.nuget.org/v3/index.json -k $NUGET_ORG_API_KEY'
tags:
- docker-executor
when: manual