diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 7c6d983..535e8bc 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -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: diff --git a/README.rst b/README.rst index d949f58..f319cdc 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..ef18cfd --- /dev/null +++ b/sonar-project.properties @@ -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