Update azure azure-sdk-for-net monorepo #6064
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: .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' | |
CONNECTION_STRING_KEY: 'ConnectionStrings:DefaultConnection' | |
services: | |
sql-server: | |
image: mcr.microsoft.com/mssql/server:2022-latest | |
ports: | |
- 1433:1433 | |
env: | |
ACCEPT_EULA: Y | |
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: 7.0.x | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'microsoft' | |
- 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 /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=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}}" --filter "FullyQualifiedName!~ConcernsCaseWork.Integration.Tests" | |
reportgenerator -reports:./**/coverage.cobertura.xml -targetdir:./Dfe.ManageFreeSchoolProjects/CoverageReport -reporttypes:SonarQube | |
dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |