Skip to content

Commit bacea40

Browse files
committed
Enable SonarCloud analysis (true / false)
1 parent e22a370 commit bacea40

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
name: Build with Tests
22

33
on:
4-
push:
5-
workflow_dispatch:
6-
pull_request:
7-
types: [opened, edited]
4+
push:
5+
workflow_dispatch:
6+
inputs:
7+
SonarScanner:
8+
description: 'Enable SonarCloud analysis'
9+
type: boolean
10+
required: false
11+
default: true
12+
pull_request:
13+
types: [opened, edited]
814

915
jobs:
1016
build_and_test_Windows:
@@ -69,10 +75,10 @@ jobs:
6975
fi
7076
7177
- name: Begin analysis on SonarCloud
72-
if: ${{ steps.secret-check.outputs.run_analysis == 'true' }}
78+
if: ${{ steps.secret-check.outputs.run_analysis == 'true' && inputs.SonarScanner }}
7379
run: |
7480
dotnet sonarscanner begin /k:"zzzprojects_System.Linq.Dynamic.Core" /o:"zzzprojects" /d:sonar.branch.name=$BranchName /d:sonar.host.url="https://sonarcloud.io" /d:sonar.token=${{ secrets.SONAR_TOKEN }} /d:sonar.pullrequest.provider=github /d:sonar.dotnet.excludeTestProjects=true /d:sonar.cs.vscoveragexml.reportsPaths=**/dynamic-coverage-*.xml /d:sonar.verbose=true
75-
81+
7682
- name: Build
7783
run: |
7884
dotnet build ./src/System.Linq.Dynamic.Core/System.Linq.Dynamic.Core.csproj -c Debug -p:buildType=azure-pipelines-ci
@@ -94,6 +100,6 @@ jobs:
94100
dotnet-coverage collect 'dotnet test ./test/System.Linq.Dynamic.Core.SystemTextJson.Tests/System.Linq.Dynamic.Core.SystemTextJson.Tests.csproj --configuration Debug --framework net10.0 -p:buildType=azure-pipelines-ci' -f xml -o dynamic-coverage-systemtextjson.xml
95101
96102
- name: End analysis on SonarCloud
97-
if: ${{ steps.secret-check.outputs.run_analysis == 'true' }}
103+
if: ${{ steps.secret-check.outputs.run_analysis == 'true' && inputs.SonarScanner }}
98104
run: |
99-
dotnet sonarscanner end /d:sonar.token=${{ secrets.SONAR_TOKEN }}
105+
dotnet sonarscanner end /d:sonar.token=${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)