Skip to content

Fix scoped ASP.NET health checks, correct AddHealthContributor docs #512

Fix scoped ASP.NET health checks, correct AddHealthContributor docs

Fix scoped ASP.NET health checks, correct AddHealthContributor docs #512

Workflow file for this run

name: SonarQube
on:
workflow_dispatch:
push:
branches:
- main
- '[0-9]+.x'
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
env:
STEELTOE_MACOS_DIAGNOSE_HOSTNAME_LOOKUP: true
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: true
SOLUTION_FILE: 'src/Steeltoe.All.sln'
SONAR_TEST_ARGS: >-
--no-build --configuration Release --collect "XPlat Code Coverage" --logger trx --results-directory ${{ github.workspace }}/TestOutput
--settings coverlet.runsettings -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.UseSourceLink=false
jobs:
analyze:
name: Analyze
timeout-minutes: 60
runs-on: ubuntu-latest
services:
eurekaServer:
image: 'steeltoe.azurecr.io/eureka-server'
ports:
- 8761:8761
configServer:
image: 'steeltoe.azurecr.io/config-server'
env:
eureka.client.enabled: true
eureka.client.serviceUrl.defaultZone: http://eurekaServer:8761/eureka
eureka.instance.hostname: localhost
eureka.instance.instanceId: localhost:configServer:8888
ports:
- 8888:8888
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.*
9.0.*
10.0.*
- name: Install Sonar .NET Scanner
run: dotnet tool install --global dotnet-sonarscanner
- name: Git checkout
uses: actions/checkout@v6
with:
persist-credentials: false
# Sonar: Shallow clones should be disabled for a better relevancy of analysis.
fetch-depth: 0
- name: Restore packages
run: dotnet restore ${{ env.SOLUTION_FILE }} /p:Configuration=Release --verbosity minimal
- name: Begin Sonar .NET scanner
id: sonar_begin
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: >-
dotnet sonarscanner begin /k:"SteeltoeOSS_steeltoe" /o:"steeltoeoss" /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
/d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml
- name: Build solution
run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore --configuration Release --verbosity minimal
- name: Test
run: dotnet test ${{ env.SOLUTION_FILE }} --filter "Category!=MemoryDumps" ${{ env.SONAR_TEST_ARGS }}
- name: Test (memory dumps)
run: dotnet test src/Management/test/Endpoint.Test --filter "Category=MemoryDumps" ${{ env.SONAR_TEST_ARGS }}
- name: End Sonar .NET scanner
if: ${{ !cancelled() && steps.sonar_begin.outcome == 'success' }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"