-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
47 lines (40 loc) · 1.51 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
image: mcr.microsoft.com/dotnet/core/sdk:3.1
variables:
OBJECTS_DIRECTORY: "obj"
NUGET_PACKAGES_DIRECTORY: ".nuget"
SOURCE_CODE_PATH: "src/"
stages:
- build
- test
cache:
key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
paths:
# Specify three paths that should be cached:
#
# 1) Main JSON file holding information about package dependency tree, packages versions,
# frameworks etc. It also holds information where to the dependencies were restored.
- "$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/project.assets.json"
# 2) Other NuGet and MSBuild related files. Also needed.
- "$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/*.csproj.nuget.*"
# 3) Path to the directory where restored dependencies are kept.
- "$NUGET_PACKAGES_DIRECTORY"
policy: pull-push
before_script:
- "dotnet restore src/Hestia.sln --packages $NUGET_PACKAGES_DIRECTORY"
build:
stage: build
script:
- "dotnet build src/Hestia.sln --no-restore"
test:
stage: test
script:
- "dotnet test src/Hestia.sln --no-restore"
cover:
stage: test
script:
- dotnet tool install --global dotnet-reportgenerator-globaltool
- dotnet tool install --global Codecov.Tool
- export PATH="$PATH:/root/.dotnet/tools"
- dotnet test src/Hestia.sln /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[xunit*]*" /p:CoverletOutput="coverage.json"
- reportgenerator "-reports:**/coverage.json" "-targetdir:coveragereport" "-reporttypes:Html;HtmlSummary;Cobertura;lcov;XML"
- codecov -f coveragereport/lcov.info