Skip to content

Update README.md

Update README.md #11

Workflow file for this run

name: SonarQube
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build and analyze
runs-on: windows-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache SonarQube Cloud packages
uses: actions/cache@v4
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarQube Cloud 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 SonarQube Cloud 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: List directory contents
shell: powershell
run: |
Write-Host "Current directory contents:"
Get-ChildItem -Force
Write-Host "Looking for .sln files:"
Get-ChildItem -Filter "*.sln" -Recurse
Write-Host "Looking for .csproj files:"
Get-ChildItem -Filter "*.csproj" -Recurse
- name: Build and analyze
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
# Find solution or project file
$solutionFile = Get-ChildItem -Filter "*.sln" | Select-Object -First 1
$projectFile = Get-ChildItem -Filter "*.csproj" -Recurse | Select-Object -First 1
if ($solutionFile) {
$buildTarget = $solutionFile.Name
Write-Host "Found solution file: $buildTarget"
} elseif ($projectFile) {
$buildTarget = $projectFile.FullName
Write-Host "Found project file: $buildTarget"
} else {
Write-Host "No solution or project file found"
exit 1
}
.\.sonar\scanner\dotnet-sonarscanner begin /k:"JacksonJS12_SunNext" /o:"jacksonjs12" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet restore $buildTarget
dotnet build $buildTarget --configuration Release --no-restore
dotnet test $buildTarget --configuration Release --no-build --collect:"Code Coverage;Format=xml" --results-directory ./TestResults/ --logger trx --verbosity normal
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"