Merge pull request #3 from dave-shawley/add-sonar

Add sonarqube analysis
This commit is contained in:
dave-shawley 2021-04-07 07:50:16 -04:00 committed by GitHub
commit a28f984c84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 3 deletions

View file

@ -8,6 +8,7 @@ on:
jobs:
test:
name: Tests and style checks
runs-on: ubuntu-latest
strategy:
matrix:
@ -34,21 +35,33 @@ jobs:
coverage run -m unittest
coverage report
coverage xml -o ./coverage.xml
- name: Upload coverage
- name: Send coverage to codecov.io
uses: codecov/codecov-action@v1.3.2
with:
token: ${{secrets.CODECOV_TOKEN}}
file: ./coverage.xml
flags: unittests
fail_ci_if_error: true
verbose: true
- name: Save coverage report
if: ${{ matrix.python-version == '3.9' }}
uses: actions/upload-artifact@v2
with:
name: coverage.xml
path: ./coverage.xml
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
if: ${{ github.event == 'push' && github.ref == 'refs/heads/main' }}
needs: test
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Download coverage report
uses: actions/download-artifact@v2
with:
name: coverage.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:

View file

@ -1,6 +1,6 @@
Asynchronously send metrics to a statsd_ instance.
|build| |coverage| |source|
|build| |coverage| |sonar| |docs| |source|
.. COMMENTED OUT FOR THE TIME BEING
|docs| |download| |license|
@ -131,5 +131,7 @@ not connected to the server and will be sent in the order received when the task
:target: https://pypi.org/project/sprockets-statsd/
.. |license| image:: https://img.shields.io/pypi/l/sprockets-statsd.svg?style=social
:target: https://github.com/sprockets/sprockets-statsd/blob/master/LICENSE.txt
.. |sonar| image:: https://img.shields.io/sonar/quality_gate/sprockets_sprockets-statsd?server=https%3A%2F%2Fsonarcloud.io&style=social
:target: https://sonarcloud.io/dashboard?id=sprockets_sprockets-statsd
.. |source| image:: https://img.shields.io/badge/source-github.com-green.svg?style=social
:target: https://github.com/sprockets/sprockets-statsd

10
sonar-project.properties Normal file
View file

@ -0,0 +1,10 @@
sonar.organization=sprockets
sonar.projectKey=sprockets_sprockets-statsd
sonar.projectName=sprockets-statsd
sonar.links.ci=https://github.com/sprockets/sprockets-statsd/actions/workflows/run-tests.yml
sonar.links.homepage=https://sprockets-statsd.readthedocs.io/en/latest/
sonar.links.issue=https://github.com/sprockets/sprockets-statsd/issues
sonar.links.scm=https://github.com/sprockets/sprockets-statsd
sonar.inclusions=sprockets_statsd/**/*.py
sonar.test.inclusions=tests/**/*.py
sonar.python.coverage.reportPaths=coverage.xml