Test Coverage and Quality #768
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Coverage and Quality | |
on: | |
workflow_run: | |
workflows: [Build] | |
types: [completed] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
configuration: [Release] # future support for more coverage | |
runs-on: windows-latest | |
if: github.event.workflow_run.conclusion == 'success' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: | | |
21 | |
distribution: 'zulu' # Alternative distribution options are available. | |
# Install the .NET Core workload | |
- name: Install .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
8.0.x | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v4 | |
with: | |
path: ~\sonar\cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Install tools | |
run: | | |
dotnet tool install -g dotnet-sonarscanner | |
- name: NuGet Restore | |
run: dotnet restore DynamicData.sln | |
working-directory: src | |
- name: Run coverage tests | |
run: | | |
dotnet sonarscanner begin /k:"reactivemarbles_DynamicData" /o:"reactivemarbles" /d:sonar.token="${{ env.SONAR_TOKEN }}" /d:sonar.cs.opencover.reportsPaths=./**/coverage.opencover.xml /d:sonar.host.url="https://sonarcloud.io" | |
dotnet build --no-restore --no-incremental --configuration ${{ matrix.configuration }} -p:ContinuousIntegrationBuild=false DynamicData.sln | |
dotnet test --no-build --configuration ${{ matrix.configuration }} --collect:"XPlat Code Coverage" --settings coverlet.xml | |
dotnet sonarscanner end /d:sonar.token="${{ env.SONAR_TOKEN }}" | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
working-directory: src |