forked from game-ci/unity-test-runner
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsonar-scanner.sh
48 lines (36 loc) · 947 Bytes
/
sonar-scanner.sh
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
#!/bin/sh -l
set -eu
begin_cmd="/dotnet-sonarscanner begin"
end_cmd="/dotnet-sonarscanner end"
if [ -n "$INPUT_PROJECTKEY" ]
then
begin_cmd="$begin_cmd /k:\"$INPUT_PROJECTKEY\""
fi
if [ -n "$INPUT_PROJECTNAME" ]
then
begin_cmd="$begin_cmd /n:\"$INPUT_PROJECTNAME\""
fi
if [ -n "$INPUT_SONARHOSTNAME" ]
then
begin_cmd="$begin_cmd /d:sonar.host.url=\"$INPUT_SONARHOSTNAME\""
fi
if [ -n "$INPUT_SONARORGANISATION" ]
then
begin_cmd="$begin_cmd /o:\"$INPUT_SONARORGANISATION\""
fi
if [ -n "$INPUT_BEGINARGUMENTS" ]
then
begin_cmd="$begin_cmd $INPUT_BEGINARGUMENTS"
fi
if [ -n "$INPUT_ENDARGUMENTS" ]
then
end_cmd="$end_cmd $INPUT_ENDARGUMENTS"
fi
if [ -n "${SONAR_TOKEN}" ]
then
begin_cmd="$begin_cmd /d:sonar.login=\"${SONAR_TOKEN}\""
end_cmd="$end_cmd /d:sonar.login=\"${SONAR_TOKEN}\""
fi
sh -c "$begin_cmd"
sh -c "/opt/Unity/Editor/Data/NetCore/Sdk-2.2.107/dotnet build ${INPUT_SOLUTION}"
sh -c "$end_cmd"