1+ # ------------------------------------------
2+ # CUSTOMIZABLE TEMPLATE REPOSITORY VARIABLES
3+ #
4+ env :
5+ SOLUTION_NAME : " Temp File Cleaner VS2026"
6+ SOLUTION_EXT : " slnx"
7+ SONAR_PROJECT_KEY : " ElektroStudios_Temp-File-Cleaner-for-Visual-Studio-2026"
8+ SONAR_ORGANIZATION : " elektrostudios"
9+ # ------------------------------------------
10+
11+ name : SonarQube
12+ on :
13+ push :
14+ branches :
15+ - main
16+ pull_request :
17+ types : [opened, synchronize, reopened]
18+ jobs :
19+ build :
20+ name : Build and analyze
21+ runs-on : windows-latest
22+ steps :
23+ - name : Set up JDK 17
24+ uses : actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
25+ with :
26+ java-version : 17
27+ distribution : ' zulu' # Alternative distribution options are available.
28+ - uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
29+ with :
30+ fetch-depth : 0 # Shallow clones should be disabled for a better relevancy of analysis
31+ - name : Cache SonarQube Cloud packages
32+ uses : actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
33+ with :
34+ path : ~\sonar\cache
35+ key : ${{ runner.os }}-sonar
36+ restore-keys : ${{ runner.os }}-sonar
37+ - name : Cache SonarQube Cloud scanner
38+ id : cache-sonar-scanner
39+ uses : actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
40+ with :
41+ path : ${{ runner.temp }}\scanner
42+ key : ${{ runner.os }}-sonar-scanner
43+ restore-keys : ${{ runner.os }}-sonar-scanner
44+ - name : Install SonarQube Cloud scanner
45+ if : steps.cache-sonar-scanner.outputs.cache-hit != 'true'
46+ shell : powershell
47+ run : |
48+ New-Item -Path ${{ runner.temp }}\scanner -ItemType Directory
49+ dotnet tool update dotnet-sonarscanner --tool-path ${{ runner.temp }}\scanner
50+ - name : Setup MSBuild
51+ uses : microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
52+ - name : Build and analyze
53+ env :
54+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
55+ shell : powershell
56+ run : |
57+ dotnet nuget locals all --clear
58+ & "${{ runner.temp }}\scanner\dotnet-sonarscanner" begin /k:"${{ env.SONAR_PROJECT_KEY }}" /o:"${{ env.SONAR_ORGANIZATION }}" /d:sonar.token="$env:SONAR_TOKEN" /d:sonar.sourceEncoding=UTF-8 /d:sonar.exclusions="**/*.png,**/*.ico,**/*.jpg,**/*.jpeg,**/*.gif,**/*.webp,**/*.bmp,**/*.tif,**/*.tiff,**/*.rtf,**/*.html,**/*.htm,**/*.resx,**/*.yml,**/*.myapp,**/*.sample,**/*.settings,**/*.conf,**/*.md,**/*.bin,**/*.sln,**/*.slnx,**/*.zip,**/*.rar,**/*.rev,**/*.idx,**/*.nfo,**/*.gitattributes,**/*.gitignore,**/.github/**/*"
59+ nuget restore "Source\${{ env.SOLUTION_NAME }}.${{ env.SOLUTION_EXT }}"
60+ dotnet build "Source\${{ env.SOLUTION_NAME }}.${{ env.SOLUTION_EXT }}" -p:Configuration=Release -p:GenerateResourceUsePreserializedResources=true
61+ & "${{ runner.temp }}\scanner\dotnet-sonarscanner" end /d:sonar.token="$env:SONAR_TOKEN"
0 commit comments