feat: migration to vps #2
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 & run tests (dev) | |
on: | |
pull_request: | |
branches: [ dev ] | |
jobs: | |
dev-branch-check: | |
runs-on: ubuntu-latest | |
env: | |
TARGET_DIRECTORY: $PWD/sonarqubecoverage | |
COVERAGE_REPORT: $PWD/*/*/TestResults/*/coverage.cobertura.xml | |
SONAR_REPORT: SonarQube.xml | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Variable substitution appsettings file for Development (NET Core) | |
uses: TomaszKandula/variable-substitution@v1.0.2 | |
with: | |
files: ${{ github.workspace }}/EmailSender.Configuration/appsettings.Development.json | |
env: | |
DbConnect: "${{ secrets.DBCONNECT_TEST }}" | |
AZ_Storage_ContainerName: "${{ secrets.STORAGE_CONTAINER_NAME_TEST }}" | |
AZ_Storage_ConnectionString: "${{ secrets.STORAGE_CONNECTION_STRING }}" | |
Mailcow_API_Key: "${{ secrets.MAILCOW_API_KEY }}" | |
Mailcow_Status_Url: "${{ secrets.MAILCOW_STATUS_URL }}" | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Install dependencies | |
run: dotnet restore | |
- name: SonarQube begin scan dotnet | |
run: | | |
dotnet tool install --global dotnet-sonarscanner --version 5.15.0 | |
dotnet tool update dotnet-reportgenerator-globaltool -g | |
dotnet sonarscanner begin \ | |
/k:${{ secrets.SONARQUBE_PROJECT_KEY_BE }} \ | |
/d:sonar.login=${{ secrets.SONARQUBE_TOKEN_BE }} \ | |
/d:sonar.host.url=${{ secrets.SONARQUBE_HOST }} \ | |
/d:sonar.coverageReportPaths="${{ env.TARGET_DIRECTORY }}/${{ env.SONAR_REPORT }}" | |
- name: Build .NET | |
run: dotnet build | |
- name: Test with the dotnet CLI | |
run: | | |
dotnet test --no-build --collect:"XPlat Code Coverage" | |
mkdir "${{ env.TARGET_DIRECTORY }}" | |
reportgenerator "-reports:${{ env.COVERAGE_REPORT }}" "-targetdir:${{ env.TARGET_DIRECTORY }}" "-reporttypes:SonarQube" | |
env: | |
ASPNETCORE_ENVIRONMENT: Development | |
- name: SonarQube end scan dotnet | |
run: dotnet sonarscanner end /d:sonar.login=${{ secrets.SONARQUBE_TOKEN_BE }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |