https://github.com/nazmialtun/dotnet-parallel-sonar-scan
Github action that runs dotnet sonar scanner in parallel with the tests jobs
https://github.com/nazmialtun/dotnet-parallel-sonar-scan
github-actions sonar-scanner sonarcloud sonarqube
Last synced: about 2 months ago
JSON representation
Github action that runs dotnet sonar scanner in parallel with the tests jobs
- Host: GitHub
- URL: https://github.com/nazmialtun/dotnet-parallel-sonar-scan
- Owner: NazmiAltun
- License: mit
- Created: 2022-02-19T19:04:09.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-09-03T20:09:39.000Z (almost 2 years ago)
- Last Synced: 2026-05-10T15:08:58.639Z (about 2 months ago)
- Topics: github-actions, sonar-scanner, sonarcloud, sonarqube
- Language: JavaScript
- Homepage:
- Size: 3.34 MB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Dotnet Parallel Sonar Scanner Github Action
It works like regular dotnet sonar scanner , except that it can run in parallel with test jobs (unit,integration, functional ...etc if there're any).
If there're test jobs in your github actions workflow and want to use [Regular dotnet sonar scanner](https://github.com/marketplace/actions/dotnet-sonarscanner) , you need to either
pass test command and repeat the tests twice or you can pass code coverage results to the sonar scanning job after the tests are completed. However, either way adds up extra time to your CI workflow , which is not ideal.
If you want to use this action, you need to upload code coverage result as artifact to and pass the name of the artifacts and solution root path to the action. It will first build the solution then it will pool uploaded artifacts and once the artifacts are uploaded by test jobs , the scanning result will be posted to sonarcloud/sonarqube server.
It also caches the sonar plugins.
## Usage
See [action.yml](action.yml) and [Sample Repo](https://github.com/NazmiAltun/dotnet-sonar-sample)
```yml
....
- name: Scan
uses: NazmiAltun/dotnet-parallel-sonar-scan@v1
with:
sonar-token: ${{ secrets.SONAR_TOKEN }} #SONAR_TOKEN needs to be set in the secrets
test-result-artifacts: unit-test-results,integration-test-results
coverage-solution-root-path: /app # e.g; WORKDIR in dockerfile is set to /app.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
....
```
## TODO
- Detect coverage-solution-root-path rather than getting it via parameters.
# License
The scripts and documentation in this project are released under the [MIT License](LICENSE)
# Contributions
Contributions are welcome!