Update pr-test-coverage.yml #4
Workflow file for this run
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: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
configuration: [Release] # future support for more coverage | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'zulu' # Alternative distribution options are available. | |
# Install the .NET Core workload | |
- name: Install .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
8.0.x | |
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild | |
- name: Setup MSBuild.exe | |
uses: microsoft/[email protected] | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v3 | |
with: | |
path: ~\sonar\cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache SonarCloud scanner | |
id: cache-sonar-scanner | |
uses: actions/cache@v3 | |
with: | |
path: .\.sonar\scanner | |
key: ${{ runner.os }}-sonar-scanner | |
restore-keys: ${{ runner.os }}-sonar-scanner | |
- name: Install SonarCloud scanner | |
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' | |
run: | | |
dotnet tool install -g dotnet-sonarscanner | |
- name: Install JetBrains DotCover | |
run: dotnet tool install --global JetBrains.dotCover.GlobalTool | |
- name: NuGet Restore | |
run: dotnet restore DynamicData.sln | |
working-directory: src | |
- name: Build | |
working-directory: src | |
- name: Run coverage tests | |
run: | | |
dotnet sonarscanner begin /k:"reactivemarbles_DynamicData" /d:sonar.token="${{ env.SONAR_TOKEN }}" /d:sonar.cs.dotcover.reportsPaths=dotCover.Output.html /d:sonar.hc | |
dotnet build --no-restore --no-incremental --configuration Release DynamicData.sln | |
dotnet dotcover test --dcReportType=HTML | |
dotnet sonarscanner end /d:sonar.token="${{ env.SONAR_TOKEN }}" | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
working-directory: src |