-
Notifications
You must be signed in to change notification settings - Fork 22
/
.gitlab-ci.yml
66 lines (61 loc) · 2.11 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
# This file is a template, and might need editing before it works on your project.
# Official docker image.
image: microsoft/dotnet:2.1-sdk-alpine
variables:
project_name: Kveer.XmlRPC
configuration: Release
build:
stage: build
before_script:
- apk add --no-cache git xmlstarlet
script:
- cd "${project_name}"
- |
if [ -n "$CI_COMMIT_TAG" ]; then
MSG=$(git tag -l --format='%(contents)' $CI_COMMIT_TAG | xmlstarlet esc)
xmlstarlet ed --inplace -u '/Project/PropertyGroup/Version' -v "$CI_COMMIT_TAG" "${project_name}.csproj"
xmlstarlet ed --inplace -u '/Project/PropertyGroup/PackageReleaseNotes' -v "$MSG" "${project_name}.csproj"
fi
- dotnet restore "${project_name}.csproj"
- dotnet build -c "${configuration}" "${project_name}.csproj"
- dotnet pack -c "${configuration}" --include-symbols "${project_name}.csproj"
artifacts:
paths:
- $PWD/${project_name}/bin/${configuration}/*.nupkg
only:
- master
- tags
test:
stage: test
dependencies:
- build
script:
- cd "${project_name}.Tests"
- dotnet add package coverlet.msbuild
- dotnet test /p:CollectCoverage=true /p:Exclude="[NUnit3.*]*" "${project_name}.Tests.csproj"
coverage: '/Total Line: \d+%/'
publish-nuget:
stage: deploy
dependencies:
- build
script:
- cd "${project_name}"
- dotnet nuget push bin/"${configuration}"/${project_name}.$CI_COMMIT_TAG.nupkg -k $nuget_key -s nuget.org
- dotnet nuget push bin/"${configuration}"/${project_name}.$CI_COMMIT_TAG.symbols.nupkg -k $nuget_key -s https://nuget.smbsrc.net/
only:
- tags
sast:
image: docker:stable
allow_failure: true
services:
- docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}"
--volume "$PWD:/code"
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code
artifacts:
reports:
sast: [gl-sast-report.json]