-
Notifications
You must be signed in to change notification settings - Fork 6
71 lines (59 loc) · 2.12 KB
/
Build.yaml
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
69
70
71
name: FileSystem [Build]
env:
JAVA_VERSION: 17
JAVA_DISTRIBUTION: microsoft
DOTNET_VERSION: |
3.1.x
6.0.x
7.0.x
8.0.x
DOTNET_BUILD_CONFIGURATION: Release
SONAR_PATH: .\.sonar\scanner
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST: https://sonarcloud.io
SONAR_ORGANIZATION: sharpgrip
SONAR_PROJECT: SharpGrip_FileSystem
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on:
workflow_dispatch:
push:
branches:
- "**"
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install dotnet-coverage
shell: powershell
run: dotnet tool install --global dotnet-coverage
- name: Install SonarCloud scanner
shell: powershell
run: |
New-Item -Path ${{ env.SONAR_PATH }} -ItemType Directory -Force
dotnet tool update dotnet-sonarscanner --tool-path ${{ env.SONAR_PATH }}
- name: Build solution
run: dotnet build -c ${{ env.DOTNET_BUILD_CONFIGURATION }} /warnaserror
- name: Test solution
run: dotnet test --no-build -c ${{ env.DOTNET_BUILD_CONFIGURATION }} --verbosity normal
- name: Clean solution
run: dotnet clean
- name: Analyze solution
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"${{ env.SONAR_PROJECT }}" /o:"${{ env.SONAR_ORGANIZATION }}" /d:sonar.token="${{ env.SONAR_TOKEN }}" /d:sonar.host.url="${{ env.SONAR_HOST }}" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
dotnet build -c ${{ env.DOTNET_BUILD_CONFIGURATION }}
dotnet-coverage collect "dotnet test -c ${{ env.DOTNET_BUILD_CONFIGURATION }}" -f xml -o "coverage.xml"
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ env.SONAR_TOKEN }}"