Dotnet
Compilation
Single file​
Awesome Dotnet​
- Query Builder sqlkata
- OPEN API swashbuckle
- Mediator MediatR
- CQRS CQRS
- Sample Dotnet Project Best Practice
Github Actions to build Dotnet 7 project​
Operating System
This github actions runs on windows-latest OS.
name: SAST With Sonar Cloud
on:
push:
branches: ["feature/*"]
pull_request:
branches: ["main"]
workflow_dispatch:
jobs:
sast:
name: Static Application Security Testing
runs-on: windows-latest
steps:
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: "microsoft"
java-version: 11
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache SonarQube packages
uses: actions/cache@v3
with:
path: ~/sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarQube scanner
id: cache-sonar-scanner
uses: actions/cache@v3
with:
path: ./.sonar/scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarQube scanner
shell: powershell
run: dotnet tool update --global dotnet-sonarscanner --version 5.12.0
- name: Install Dotnet Coverage tool
shell: powershell
run: dotnet tool update --global dotnet-coverage --version 17.4.4
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
dotnet tool list -g
dotnet build --no-incremental
dotnet coverage collect "dotnet test" -f xml -o "coverage.xml"
dotnet sonarscanner begin /k:"<project-key>" /o:"<org-name>" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.host.url="https://sonarcloud.io"
dotnet build --no-incremental
dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"