Deprecated resource policy #1012
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: Build, analyse and test .NET code | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main, '**-feature' ] | |
types: [ opened, synchronize, reopened] | |
env: | |
JAVA_VERSION: '17' | |
jobs: | |
build: | |
name: Build .NET | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: 0 # Shallow clones disabled for a better relevancy of SC analysis | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: 'microsoft' | |
- 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 --global dotnet-sonarscanner | |
- name: Install dotnet-coverage | |
run: dotnet tool install --global dotnet-coverage | |
- name: Install dotnet-stryker (mutation testing tool) | |
run: dotnet tool restore | |
- name: Build and Analyse solution | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
dotnet-sonarscanner begin /k:"DFE-Digital_find-information-about-academies-and-trusts" /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="**/*.js" | |
dotnet restore DfE.FindInformationAcademiesTrusts | |
dotnet build DfE.FindInformationAcademiesTrusts -c Release | |
dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml" | |
dotnet stryker -r "cleartext" -r "html" --threshold-high 90 --threshold-low 81 --break-at 80 | |
dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: mutation-report | |
path: ./**/mutation-report.html | |
retention-days: 7 |