Skip to content

Commit

Permalink
Add sonarcloud support
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-shawley committed Jul 8, 2022
1 parent 2e28741 commit 2ad150e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .circleci/config.yml
Expand Up @@ -28,13 +28,16 @@ jobs:
mkdir build
pip install --user '.[test]' coveralls
coverage run -m unittest discover
coverage report
coverage xml
./tmp/cc-test-reporter format-coverage -t coverage.py -o tmp/python3-coverage.json
coveralls
cp coverage.xml tmp/
- persist_to_workspace:
root: tmp
paths:
- python3-coverage.json
- coverage.xml

upload-coverage:
working_directory: ~/ietfparse
Expand All @@ -47,6 +50,18 @@ jobs:
./tmp/cc-test-reporter sum-coverage tmp/*-coverage.json -p 1 -o tmp/codeclimate-total.json
./tmp/cc-test-reporter upload-coverage -i tmp/codeclimate-total.json
update-sonarcloud:
working_directory: ~/ietfparse
docker:
- image: cimg/openjdk:18.0
steps:
- checkout
- attach_workspace:
at: ~/ietfparse/tmp
- run: |
cp tmp/coverage.xml coverage.xml
- sonarcloud/scan

distribute-tag:
working_directory: ~/ietfparse
docker:
Expand All @@ -60,6 +75,9 @@ jobs:
twine upload --skip-existing dist/*
curl -XPOST -d "token=$READTHEDOCS_TOKEN" https://readthedocs.org/api/v2/webhook/ietfparse/28564/
orbs:
sonarcloud: sonarsource/sonarcloud@1.1.1

workflows:
version: 2
build-workflow:
Expand All @@ -71,6 +89,9 @@ workflows:
- upload-coverage:
requires:
- python-3-test
- update-sonarcloud:
requires:
- python-3-test
- distribute-tag:
context: org-global
filters:
Expand Down
9 changes: 9 additions & 0 deletions sonar-project.properties
@@ -0,0 +1,9 @@
sonar.organization=dave-shawley-github
sonar.projectKey=dave-shawley_ietfparse
sonar.projectName=ietfparse
sonar.links.ci=https://circleci.com/gh/dave-shawley/ietfparse/tree/master
sonar.links.homepage=https://ietfparse.readthedocs.io/en/latest/index.html
sonar.links.scm=https://github.com/dave-shawley/ietfparse
sonar.inclusions=ietfparse/**/*.py
sonar.test.inclusions=tests/**/*.py
sonar.python.coverage.reportPaths=coverage.xml

0 comments on commit 2ad150e

Please sign in to comment.