-
Notifications
You must be signed in to change notification settings - Fork 83
68 lines (59 loc) · 2.28 KB
/
Copy pathsonar-cloud.yml
File metadata and controls
68 lines (59 loc) · 2.28 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# https://github.com/SonarSource/sonarcloud-github-action
name: SonarCloud
on:
push:
pull_request:
types: [opened, synchronize, reopened]
branches: [main]
paths-ignore:
- ".github/workflows/**"
- "**/*.md"
- "**/*.yml"
jobs:
build:
name: Build and Analyze
runs-on: windows-latest
steps:
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
check-latest: true
distribution: "sapmachine"
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.0.x"
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Cache SonarCloud Packages
uses: actions/cache@v4
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud Scanner
id: cache-sonar-scanner
uses: actions/cache@v4
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud Scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Build, Test and Analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"ASP.NET-Core-Clean-Architecture-CQRS-Event-Sourcing" /o:"jeangatto" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.verbose=false /d:sonar.scanner.scanAll=false /d:sonar.dotnet.excludeTestProjects=true /d:sonar.scanner.skipJreProvisioning=true
dotnet restore Shop.slnx
dotnet build Shop.slnx --nologo --no-restore
dotnet test Shop.slnx --nologo --no-build --no-restore --verbosity minimal -p:CollectCoverage=true -p:CoverletOutputFormat=opencover -p:CoverletOutput=TestResults/
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"