Skip to content

Commit 28a0297

Browse files
committed
Existing dotnet.yml seems to hand. SonarQube has this updated version
1 parent 00a511c commit 28a0297

File tree

1 file changed

+16
-32
lines changed

1 file changed

+16
-32
lines changed

.github/workflows/dotnet.yml

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,44 @@
1-
name: Build and analyze
1+
name: SonarQube
22

33
on:
4-
workflow_dispatch:
54
push:
6-
branches: [ "main" ]
5+
branches:
6+
- main
77
pull_request:
8-
branches: [ "main" ]
8+
types: [ opened, synchronize, reopened ]
99

1010
jobs:
1111
build:
1212
name: Build and analyze
1313
runs-on: windows-latest
14-
env:
15-
ProjectName: 'AStar.Dev.Functional.Extensions'
16-
RepositoryName: 'astar-dev-functional-extensions'
14+
1715
steps:
18-
- name: Set up JDK
19-
uses: actions/setup-java@v4.4.0
16+
- name: Set up JDK 17
17+
uses: actions/setup-java@v4
2018
with:
2119
java-version: 17
2220
distribution: 'zulu'
2321

24-
- name: Checkout
25-
uses: actions/[email protected]
22+
- uses: actions/checkout@v4
2623
with:
27-
fetch-depth: 0
24+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
2825

29-
- name: Cache SonarCloud packages
30-
uses: actions/cache@v4.2.3
26+
- name: Cache SonarQube Cloud packages
27+
uses: actions/cache@v4
3128
with:
3229
path: ~\sonar\cache
3330
key: ${{ runner.os }}-sonar
3431
restore-keys: ${{ runner.os }}-sonar
3532

36-
- name: Cache SonarCloud scanner
33+
- name: Cache SonarQube Cloud scanner
3734
id: cache-sonar-scanner
38-
uses: actions/cache@v4.2.3
35+
uses: actions/cache@v4
3936
with:
4037
path: .\.sonar\scanner
4138
key: ${{ runner.os }}-sonar-scanner
4239
restore-keys: ${{ runner.os }}-sonar-scanner
4340

44-
- name: Install SonarCloud scanner
41+
- name: Install SonarQube Cloud scanner
4542
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
4643
shell: powershell
4744
run: |
@@ -50,22 +47,9 @@ jobs:
5047
5148
- name: Build and analyze
5249
env:
53-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5450
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
5551
shell: powershell
5652
run: |
57-
dotnet tool install --global dotnet-coverage
58-
.\.sonar\scanner\dotnet-sonarscanner begin /k:"astar-development_${{ env.RepositoryName }}" /o:"astar-development" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.scanner.scanAll=false
59-
dotnet-coverage collect 'dotnet test --filter "FullyQualifiedName!~Tests.EndToEnd"' -f xml -o 'coverage.xml'
60-
dotnet build --configuration Release
61-
dotnet-coverage collect 'dotnet test --filter "FullyQualifiedName!~Tests.EndToEnd"' -f xml -o 'coverage.xml'
53+
.\.sonar\scanner\dotnet-sonarscanner begin /k:"astar-development_astar-dev-functional-extensions" /o:"astar-development" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
54+
dotnet build
6255
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
63-
64-
- name: Pack NuGet package
65-
if: github.ref == 'refs/heads/main-not'
66-
run: dotnet pack .\src\${{ env.ProjectName }}\${{ env.ProjectName }}.csproj
67-
68-
- name: Push to NuGet
69-
if: github.ref == 'refs/heads/main-not'
70-
run: dotnet nuget push "**\${{ env.ProjectName }}.*.nupkg" --api-key ${{secrets.nuget_api_key}} --skip-duplicate --source https://api.nuget.org/v3/index.json
71-

0 commit comments

Comments
 (0)