Sonar workflow updates #321
This file contains hidden or 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 | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - "**/*.cs" | |
| - "**/*.csproj" | |
| - "**/*.props" | |
| - "**/packages.lock.json" | |
| - "docker-compose.yml" | |
| - ".config/dotnet-tools.json" | |
| - "global.json" | |
| - ".github/workflows/test.yml" | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| os: ["ubuntu-latest"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: ./global.json | |
| cache: true | |
| cache-dependency-path: "**/packages.lock.json" | |
| - name: Install Report Generator | |
| run: dotnet tool restore | |
| - name: Restore | |
| run: dotnet restore --locked-mode | |
| - name: Build | |
| run: dotnet build -c Release --no-restore | |
| - name: Test & collect coverage | |
| run: | | |
| dotnet test -c Release --no-restore --no-build \ | |
| --settings tests/coverage.runsettings --results-directory ${{ github.workspace }}/test-results | |
| env: | |
| USE_MOCK_SERVER: ${{ vars.USE_MOCK_SERVER }} | |
| SHOW_MOCK_SERVER_LOGS: ${{ vars.SHOW_MOCK_SERVER_LOGS }} | |
| TESTING_LOG_LEVEL: ${{ vars.TESTING_LOG_LEVEL }} | |
| - name: Find coverage files and generate report | |
| run: | | |
| dotnet tool run reportgenerator -reports:"${{ github.workspace }}/test-results/**/*cobertura.xml" \ | |
| -targetdir:"coverage-report" \ | |
| -reporttypes:MarkdownSummaryGithub | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: coverage-report | |
| path: coverage-report | |
| - name: Add coverage to summary | |
| run: cat coverage-report/SummaryGithub.md >> $GITHUB_STEP_SUMMARY |