Skip to content

Commit cf87292

Browse files
committed
Do not interrupt the script when SonarCloud is disabled
1 parent 032ac56 commit cf87292

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

.travis.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ matrix:
66
include:
77
- dotnet: 2.1.500
88
mono: none
9-
env:
10-
- WITH_SONAR_ANALYSIS=false
119
- dotnet: 2.1 # latest available release
1210
mono: none
1311
env:
@@ -16,20 +14,20 @@ matrix:
1614
solution: Mastercard.Developer.OAuth1Signer.sln
1715
install:
1816
- dotnet restore
19-
- $WITH_SONAR_ANALYSIS && dotnet tool install --global dotnet-sonarscanner
17+
- test $WITH_SONAR_ANALYSIS && dotnet tool install --global dotnet-sonarscanner || echo 'Skipping sonarscanner install'
2018
before_script:
2119
- export PATH="$PATH:$HOME/.dotnet/tools"
2220
- |
23-
$WITH_SONAR_ANALYSIS && dotnet sonarscanner begin \
21+
test $WITH_SONAR_ANALYSIS && dotnet sonarscanner begin \
2422
/k:"$SONAR_PROJECT_KEY" \
2523
/n:"$SONAR_PROJECT_NAME" \
2624
/d:sonar.organization="$SONAR_ORGANIZATION_KEY" \
2725
/d:sonar.host.url="$SONAR_URL" \
2826
/d:sonar.login="$SONAR_TOKEN" \
2927
/d:sonar.cs.vstest.reportsPaths="${TEST_RESULTS_PATH}/tests.trx" \
30-
/d:sonar.cs.opencover.reportsPaths="${TEST_RESULTS_PATH}/coverage.xml"
28+
/d:sonar.cs.opencover.reportsPaths="${TEST_RESULTS_PATH}/coverage.xml" || echo 'Skipping sonarscanner begin'
3129
script:
3230
- dotnet test -c Release -l:"trx;LogFileName=tests.trx" -r:"bin/" /p:CollectCoverage=true /p:CoverletOutputFormat="opencover" /p:CoverletOutput="bin/coverage.xml"
3331
- dotnet publish -c Release
3432
after_success:
35-
- $WITH_SONAR_ANALYSIS && dotnet sonarscanner end /d:sonar.login="$SONAR_TOKEN"
33+
- test $WITH_SONAR_ANALYSIS && dotnet sonarscanner end /d:sonar.login="$SONAR_TOKEN" || echo 'Skipping sonarscanner end'

0 commit comments

Comments
 (0)