Skip to content

Update dependency @microsoft/applicationinsights-web to v3.3.4 - autoclosed #8029

Update dependency @microsoft/applicationinsights-web to v3.3.4 - autoclosed

Update dependency @microsoft/applicationinsights-web to v3.3.4 - autoclosed #8029

name: .NET Build and Test
on:
push:
branches:
- main
- develop
paths:
- 'Dfe.ManageFreeSchoolProjects/**'
- '!Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/**'
pull_request:
branches: [ main, develop, release/** ]
types: [ opened, synchronize, reopened ]
paths:
- 'Dfe.ManageFreeSchoolProjects/**'
- '!Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/**'
jobs:
build-test:
runs-on: ubuntu-latest
env:
# Note: The database name may be overridden by the tests
CONNECTION_STRING: 'Server=localhost,1433;Database=integrationtests;User Id=sa;Password=P1swrd!$;TrustServerCertificate=True;integrated security=false;'
CONNECTION_STRING_KEY: 'ConnectionStrings:DefaultConnection'
services:
sql-server:
image: mcr.microsoft.com/mssql/server:2022-latest
ports:
- 1433:1433
env:
ACCEPT_EULA: Y
MSSQL_SA_PASSWORD: P1swrd!$
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones disabled for a better relevancy of SC analysis
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'microsoft'
- name: Add nuget package source
run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/DFE-Digital/index.json"
- 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 dotnet reportgenerator
run: dotnet tool install --global dotnet-reportgenerator-globaltool
- name: Restore dependencies
run: dotnet restore Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.sln
- name: Build solution, test and run SonarCloud scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
dotnet-sonarscanner begin /d:sonar.scanner.skipJreProvisioning=true /k:"DFE-Digital_manage-free-schools-projects" /o:"dfe-digital" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths=./Dfe.ManageFreeSchoolProjects/CoverageReport/SonarQube.xml
dotnet build Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.sln --no-restore
dotnet test Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.sln --no-build --verbosity normal --collect:"XPlat Code Coverage" --environment "${{env.CONNECTION_STRING_KEY}}"="${{env.CONNECTION_STRING}}"
reportgenerator -reports:"./**/coverage.cobertura.xml" -targetdir:./Dfe.ManageFreeSchoolProjects/CoverageReport -reporttypes:SonarQube
dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"