Fix header link #77
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: Code PR Check | |
on: | |
pull_request: | |
branches: ["main", "Development"] | |
paths: | |
- "src/**" | |
- "tests/**" | |
- ".github/workflows/code-pr-check.yml" | |
concurrency: | |
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" | |
cancel-in-progress: true | |
env: | |
DOTNET_VERSION: '8.0.x' | |
jobs: | |
build-test-web-app: | |
name: Build and run unit tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
cache: false | |
- name: Install dotnet coverage | |
run: dotnet tool install --global dotnet-coverage --version 17.9.3 | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v4 | |
with: | |
path: ~\sonar\cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Install SonarCloud scanners | |
run: dotnet tool install --global dotnet-sonarscanner | |
- name: Install latest JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "microsoft" | |
java-version: "17" | |
- name: Start SonarCloud scanner | |
run: | | |
dotnet-sonarscanner begin \ | |
/k:"DFE-Digital_sts-content-support" \ | |
/o:"dfe-digital" \ | |
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" \ | |
/d:sonar.host.url="https://sonarcloud.io" \ | |
/d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml \ | |
/d:sonar.coverage.exclusions=**/Program.cs,**/wwwroot/**,**/Dfe.ContentSupport.Web.E2ETests/** \ | |
/d:sonar.issue.ignore.multicriteria=e1 \ | |
/d:sonar.issue.ignore.multicriteria.e1.ruleKey=csharpsquid:S6602 \ | |
/d:sonar.issue.ignore.multicriteria.e1.resourceKey=src/**/*.cs | |
- name: Build web app | |
uses: ./.github/actions/build-dotnet-app | |
with: | |
dotnet_version: ${{ env.DOTNET_VERSION }} | |
solution_filename: sts-contentsupport.sln | |
- name: Run unit tests | |
uses: ./.github/actions/run-unit-tests | |
with: | |
solution_filename: sts-contentsupport.sln | |
- name: Merge test results | |
run: dotnet-coverage merge -f xml -o "coverage.xml" -s "coverage.settings.xml" -r coverage.cobertura.xml | |
- name: End SonarCloud Scanner | |
run: dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage-report | |
path: coverage.xml |