Skip to content

chore(deps): update terraform github.com/dfe-digital/terraform-azurerm-key-vault-tfvars to v0.4.1 #483

chore(deps): update terraform github.com/dfe-digital/terraform-azurerm-key-vault-tfvars to v0.4.1

chore(deps): update terraform github.com/dfe-digital/terraform-azurerm-key-vault-tfvars to v0.4.1 #483

name: SonarCloud scanning and coverage generation
on:
push:
branches:
- master
pull_request:
branches: [ master ]
types: [ opened, synchronize, reopened ]
env:
JAVA_VERSION: '17'
jobs:
build-and-test:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0 # Shallow clones disabled for a better relevancy of SC analysis
- name: Install Nuget
uses: nuget/setup-nuget@v2
with:
nuget-version: ${{ needs.set-env.outputs.nuget_version }}
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: NuGet restore
run: nuget restore DFE.SIP.API.SharePointOnline.sln
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'microsoft'
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v4
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'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
# This will need re-enabling once there is coverage to be collected
#- name: Install dotnet reportgenerator
# run: dotnet tool install --global dotnet-reportgenerator-globaltool
- name: Build, Test and Analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"API-SIP-SharePointOnline" /o:"dfe-digital" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
msbuild -p:Configuration=Release `
-p:DeployOnBuild=true `
-p:PackageAsSingleFile=false `
-p:WebPublishMethod=Package `
-p:SkipInvalidConfigurations=true
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"