Skip to content

Commit 6e1e811

Browse files
authored
Add sonarcloud integration (#587)
* Added sonarcloud coverage * Added fetch-depth for sonarcloud analysis * WIP * Updated test job name * Fixed name dependency issue * changed the test name back
1 parent e5c0f74 commit 6e1e811

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.github/workflows/test-and-deploy.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
steps:
2222
- name: Checkout twilio-python
2323
uses: actions/checkout@v2
24+
with:
25+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
2426

2527
- name: Set up Python
2628
uses: actions/setup-python@v2
@@ -34,7 +36,15 @@ jobs:
3436
make test-install
3537
3638
- name: Run the tests
37-
run: make test
39+
run: make test-with-coverage
40+
41+
# only send coverage for PRs and branch updates
42+
- name: SonarCloud Scan
43+
if: ${{ github.event_name == 'pull_request' || github.ref_type == 'branch' }}
44+
uses: SonarSource/sonarcloud-github-action@master
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
47+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3848

3949
deploy:
4050
name: Deploy

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test: analysis
2222
. venv/bin/activate; \
2323
find tests -type d | xargs nosetests
2424

25-
cover:
25+
test-with-coverage:
2626
. venv/bin/activate; \
2727
find tests -type d | xargs nosetests --with-coverage --cover-inclusive --cover-erase --cover-package=twilio; \
2828
coverage xml --omit 'twilio/rest/*' -o coverage.xml

0 commit comments

Comments
 (0)