Skip to content

Commit 50d3e10

Browse files
authored
Merge pull request #2 from wisarootl/dev
ci: add sonarcloud and codecov
2 parents c128864 + 97ad6de commit 50d3e10

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

.github/workflows/ci-test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,15 @@ jobs:
3838

3939
- name: Run tests
4040
run: make test
41+
42+
- name: SonarQube Scan
43+
uses: SonarSource/sonarqube-scan-action@8c71dc039c2dd71d3821e89a2b58ecc7fee6ced9 # v5.3.0
44+
env:
45+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
46+
47+
- name: Upload coverage reports to Codecov
48+
uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0
49+
with:
50+
fail_ci_if_error: true
51+
token: ${{ secrets.CODECOV_TOKEN }}
52+
verbose: true

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ test:
3232
poetry run pytest leetcode/ \
3333
-v --cov=leetcode --cov=leetcode_py \
3434
--cov-report=term-missing \
35+
--cov-report=xml \
3536
--ignore=leetcode/_template \
3637
--ignore=leetcode/__pycache__
3738

sonar-project.properties

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# SonarQube Configuration
2+
sonar.organization=wisaroot
3+
sonar.projectKey=wisarootl_leetcode-py
4+
sonar.projectName=LeetCode Python Solutions
5+
sonar.projectVersion=1.0
6+
7+
# Source code settings
8+
sonar.sources=leetcode,leetcode_py
9+
sonar.tests=leetcode
10+
sonar.test.inclusions=**/tests.py
11+
sonar.exclusions=**/conftest.py,**/_template/**,**/__pycache__/**,**/.venv/**
12+
13+
# Python specific settings
14+
sonar.python.version=3.13
15+
16+
# Coverage settings (if you generate coverage reports)
17+
sonar.python.coverage.reportPaths=coverage.xml
18+
19+
# Code quality settings
20+
sonar.qualitygate.wait=true

0 commit comments

Comments
 (0)