-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsonar-scan.sh
More file actions
executable file
·26 lines (20 loc) · 971 Bytes
/
sonar-scan.sh
File metadata and controls
executable file
·26 lines (20 loc) · 971 Bytes
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
#!/usr/bin/env bash
set -o xtrace,errexit
# $SONAR_TOKEN must be defined
# $GitVersion_FullSemVer can be used to specify the current version (see GitVersion)
VERSION=""
if [ -n "$GitVersion_FullSemVer" ]; then
VERSION="/v:"$GitVersion_FullSemVer
fi
dotnet build-server shutdown
dotnet sonarscanner begin \
/d:sonar.host.url="https://sonarcloud.io" /d:sonar.token="$SONAR_TOKEN" \
/o:"alexeyshockov" /k:"alexeyshockov_LocalPost.NET" "$VERSION" \
/d:sonar.dotnet.excludeTestProjects=true \
/d:sonar.coverage.exclusions="**/examples/**" \
/d:sonar.cs.opencover.reportsPaths="tests/*/TestResults/*/coverage.opencover.xml" \
/d:sonar.cs.vstest.reportsPaths="tests/*/TestResults/*.trx"
# See "Importing .NET reports" here: https://docs.sonarqube.org/latest/analysis/coverage/
dotnet build
dotnet test --no-build --collect:"XPlat Code Coverage" --settings coverlet.runsettings --logger=trx
dotnet sonarscanner end /d:sonar.token="$SONAR_TOKEN"