Skip to content

Instantly share code, notes, and snippets.

@Andras-Csanyi
Created August 17, 2021 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Andras-Csanyi/08a8458aff8b67723cd38a4c2db58860 to your computer and use it in GitHub Desktop.
Save Andras-Csanyi/08a8458aff8b67723cd38a4c2db58860 to your computer and use it in GitHub Desktop.
- stage: Feature_branch
condition: ne(variables['System.PullRequest.SourceBranch'], '')
jobs:
- job: sonar_scan
displayName: Sonar scan
steps:
- script: |
dotnet sonarscanner begin \
/k:"Guards" \
/d:sonar.host.url=$(sonar.host.url) \
/d:sonar.login=$SONAR_LOGIN_NAME \
/o:$(sonar.organization) \
/s:../s/sonar.xml \
/d:sonar.pullrequest.key=$(System.PullRequest.PullRequestNumber) \
/d:sonar.pullrequest.branch=$(System.PullRequest.SourceBranch) \
/d:sonar.pullrequest.base=main \
/d:sonar.pullrequest.provider=GitHub \
/d:sonar.pullrequest.github.repository=EncyclopediaGalactica/Guards
env:
SONAR_LOGIN_NAME: $(sonar.login)
- job: restore_solution
displayName: Restore solution
dependsOn: sonar_scan
steps:
- script: dotnet restore $solutionName
- job: build_solution
displayName: Build solution
dependsOn: restore_solution
steps:
- script: dotnet build $solutionName $debugBuild
- job: test_solution
displayName: Test and Coverage
dependsOn: build_solution
steps:
- script: |
dotnet dotcover test \
--no-build \
--dotCoverReportType=html
- job: sonar_end
dependsOn: test_solution
displayName: Sonar End
steps:
- script: |
dotnet sonarscanner end /d:sonar.login=$(sonar.login)
env:
SONAR_LOGIN_NAME: $(sonar.login)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment