Update dependency Moq to 4.20.72 (main) #5472
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 | |
paths: | |
- 'ConcernsCaseWork/ConcernsCaseWork*/**' | |
- '!ConcernsCaseWork/ConcernsCaseWork.CypressTests/**' | |
pull_request: | |
branches: [ main, release/** ] | |
types: [ opened, synchronize, reopened ] | |
paths: | |
- 'ConcernsCaseWork/ConcernsCaseWork*/**' | |
- '!ConcernsCaseWork/ConcernsCaseWork.CypressTests/**' | |
env: | |
JAVA_VERSION: '17' | |
jobs: | |
appsettings: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Check appsettings validity | |
run: | | |
DIRECTORY=./ConcernsCaseWork/ConcernsCaseWork | |
for i in "$DIRECTORY"/appsettings*.json; do | |
echo "$i" && jq . "$i" | |
done | |
build-test: | |
runs-on: ubuntu-latest | |
environment: dev | |
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!$ | |
redis: | |
image: redis:alpine | |
ports: | |
- 6379:6379 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
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 11 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'microsoft' | |
java-version: ${{ env.JAVA_VERSION }} | |
- 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: 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: Restore dependencies | |
run: dotnet restore ConcernsCaseWork/ConcernsCaseWork.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_record-concerns-support-trusts" /o:"dfe-digital" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths=./ConcernsCaseWork/CoverageReport/SonarQube.xml | |
dotnet build ConcernsCaseWork/ConcernsCaseWork.sln --no-restore | |
dotnet test ConcernsCaseWork/ConcernsCaseWork.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:./ConcernsCaseWork/CoverageReport -reporttypes:SonarQube | |
dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |