Skip to content

Commit 676dd20

Browse files
committed
sonarcloud workflow updates
1 parent ef4dec4 commit 676dd20

File tree

1 file changed

+31
-14
lines changed

1 file changed

+31
-14
lines changed

.github/workflows/main.yml

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ jobs:
130130
with:
131131
setAllVars: true
132132

133-
- name: Setting VERSION and BRANCH env
134-
run: |
135-
echo "::set-env name=VERSION::$NBGV_NuGetPackageVersion"
136-
echo "::set-env name=BRANCH::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')"
133+
# - name: Setting VERSION and BRANCH env
134+
# run: |
135+
# echo "::set-env name=VERSION::$NBGV_NuGetPackageVersion"
136+
# echo "::set-env name=BRANCH::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')"
137137

138138
- uses: actions/setup-dotnet@v1
139139
with:
@@ -142,20 +142,37 @@ jobs:
142142
with:
143143
dotnet-version: '5.0.100-rc.1.20452.10'
144144

145-
- name: Install dotnet-sonarscanner
146-
run: dotnet tool install --global dotnet-sonarscanner
147-
148-
- name: Running dotnet-sonarscanner
149-
shell: bash
145+
# - name: Install dotnet-sonarscanner
146+
# run: dotnet tool install --global dotnet-sonarscanner
147+
# - name: Running dotnet-sonarscanner
148+
# shell: bash
149+
# env:
150+
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
151+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152+
# run: |
153+
# dotnet sonarscanner begin /k:"egil_bUnit" /o:"egil" /n:"bUnit" /v:"$NBGV_NuGetPackageVersion" /d:sonar.login="$SONAR_TOKEN" /d:sonar.host.url=https://sonarcloud.io /d:sonar.branch.name="$BRANCH"
154+
# dotnet build /p:UseSourceLink=true
155+
# dotnet test --no-build /p:CollectCoverage=true /p:CoverletOutput=./coverage/ /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute=\"Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute\" /p:UseSourceLink=true
156+
# dotnet sonarscanner end /d:sonar.login="$SONAR_TOKEN"
157+
- name: Sonarscanner for dotnet
158+
uses: Secbyte/dotnet-sonarscanner@v2.3
159+
with:
160+
buildCommand: dotnet build .
161+
testCommand: dotnet test .
162+
projectKey: egil_bUnit
163+
projectName: bUnit
164+
sonarOrganisation: egil
165+
beginArguments: >
166+
/d:sonar.verbose="true"
167+
/d:sonar.cs.opencover.reportsPaths="tests/**/coverage/*.opencover.xml"
168+
/d:sonar.coverage.exclusions='"**/*.cs","**/*.md"'
150169
env:
151170
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
152171
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153-
run: |
154-
dotnet sonarscanner begin /k:"egil_bUnit" /o:"egil" /n:"bUnit" /v:"$NBGV_NuGetPackageVersion" /d:sonar.login="$SONAR_TOKEN" /d:sonar.host.url=https://sonarcloud.io /d:sonar.branch.name="$BRANCH"
155-
dotnet build /p:UseSourceLink=true
156-
dotnet test --no-build /p:CollectCoverage=true /p:CoverletOutput=./coverage/ /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute=\"Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute\" /p:UseSourceLink=true
157-
dotnet sonarscanner end /d:sonar.login="$SONAR_TOKEN"
158172

173+
#/d:sonar.cs.opencover.reportsPaths='"/path/to/coverage.xml","/path/to/coverage.2.xml"'
174+
#/v:"$NBGV_NuGetPackageVersion"
175+
#/d:sonar.branch.name="$BRANCH"
159176
code-ql:
160177
if: github.event_name != 'pull_request'
161178
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)