-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (48 loc) · 2.03 KB
/
ci.yml
File metadata and controls
61 lines (48 loc) · 2.03 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
name: CI
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-test:
runs-on: windows-latest
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Install .NET tools
run: |
dotnet tool install --global dotnet-sonarscanner
dotnet tool install --global dotnet-coverage
dotnet tool install --global csharpier
echo "$HOME/.dotnet/tools" >> $GITHUB_PATH
- name: Check code formatting
run: dotnet csharpier --check .
- name: Begin SonarCloud analysis
run: dotnet sonarscanner begin /k:"jonathanalgar_CustomCode-Analyzer" /o:"jonathanalgar" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
- name: Restore dependencies
run: dotnet restore
- name: Build and test Analyzer
run: |
dotnet build src/CustomCode-Analyzer/CustomCode-Analyzer.csproj --configuration Release
dotnet build tests/CustomCode-Analyzer.Tests/CustomCode-Analyzer.Tests.csproj --configuration Release
dotnet-coverage collect "dotnet test tests/CustomCode-Analyzer.Tests/CustomCode-Analyzer.Tests.csproj --no-build --configuration Release --verbosity normal" -f xml -o "coverage.xml"
- name: Build VSIX
run: msbuild src\CustomCode-Analyzer.Vsix\CustomCode-Analyzer.Vsix.csproj /p:Configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=Normal /m:4
- name: End SonarCloud analysis
run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
- name: Upload build artifacts
uses: actions/upload-artifact@v4.5.0
with:
name: build-artifacts
path: |
src/CustomCode-Analyzer.Vsix/bin/Release/CustomCode_Analyzer.vsix
src/CustomCode-Analyzer/bin/Release/*.nupkg