From 0e3f9aba3c7929819c2ef9dba9337a4cd3a59e57 Mon Sep 17 00:00:00 2001 From: Wisaroot Lertthaweedech Date: Thu, 28 Aug 2025 19:38:51 +0700 Subject: [PATCH 1/6] ci: add sonarcloud and codecov --- .github/workflows/ci-test.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index c661d13..3489ba0 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -38,3 +38,17 @@ jobs: - name: Run tests run: make test + + - name: SonarQube Scan + if: matrix.os == 'ubuntu-latest' + uses: SonarSource/sonarqube-scan-action@8c71dc039c2dd71d3821e89a2b58ecc7fee6ced9 # v5.3.0 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + - name: Upload coverage reports to Codecov + if: matrix.os == 'ubuntu-latest' + uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true From e1fd92c9a1ac4e787a2b151707e2205dbd76d23c Mon Sep 17 00:00:00 2001 From: Wisaroot Lertthaweedech Date: Thu, 28 Aug 2025 19:41:04 +0700 Subject: [PATCH 2/6] ci: dev --- .github/workflows/ci-test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 3489ba0..5d3ac37 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -40,13 +40,11 @@ jobs: run: make test - name: SonarQube Scan - if: matrix.os == 'ubuntu-latest' uses: SonarSource/sonarqube-scan-action@8c71dc039c2dd71d3821e89a2b58ecc7fee6ced9 # v5.3.0 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: Upload coverage reports to Codecov - if: matrix.os == 'ubuntu-latest' uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0 with: fail_ci_if_error: true From e19f90458adbffcad097cdbb00afb0c044d08397 Mon Sep 17 00:00:00 2001 From: Wisaroot Lertthaweedech Date: Thu, 28 Aug 2025 19:47:29 +0700 Subject: [PATCH 3/6] ci: dev --- .github/workflows/ci-test.yml | 5 ----- Makefile | 1 + sonar-project.properties | 19 +++++++++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 sonar-project.properties diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 5d3ac37..2e3d24c 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -39,11 +39,6 @@ jobs: - name: Run tests run: make test - - name: SonarQube Scan - uses: SonarSource/sonarqube-scan-action@8c71dc039c2dd71d3821e89a2b58ecc7fee6ced9 # v5.3.0 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - name: Upload coverage reports to Codecov uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0 with: diff --git a/Makefile b/Makefile index 7707f9c..b195a3d 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,7 @@ test: poetry run pytest leetcode/ \ -v --cov=leetcode --cov=leetcode_py \ --cov-report=term-missing \ + --cov-report=xml \ --ignore=leetcode/_template \ --ignore=leetcode/__pycache__ diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..377a9ba --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,19 @@ +# SonarQube Configuration +sonar.projectKey=leetcode-py +sonar.projectName=LeetCode Python Solutions +sonar.projectVersion=1.0 + +# Source code settings +sonar.sources=leetcode,leetcode_py +sonar.tests=leetcode +sonar.test.inclusions=**/tests.py +sonar.exclusions=**/conftest.py,**/_template/**,**/__pycache__/**,**/.venv/** + +# Python specific settings +sonar.python.version=3.13 + +# Coverage settings (if you generate coverage reports) +sonar.python.coverage.reportPaths=coverage.xml + +# Code quality settings +sonar.qualitygate.wait=true From a860e2d2f86c8148e7458da7930d4d0c67867de0 Mon Sep 17 00:00:00 2001 From: Wisaroot Lertthaweedech Date: Thu, 28 Aug 2025 19:52:11 +0700 Subject: [PATCH 4/6] ci: dev --- .github/workflows/ci-test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 2e3d24c..5d3ac37 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -39,6 +39,11 @@ jobs: - name: Run tests run: make test + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@8c71dc039c2dd71d3821e89a2b58ecc7fee6ced9 # v5.3.0 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Upload coverage reports to Codecov uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0 with: From 8510ff605ae8c76d0fd223a98aa4067512c9a240 Mon Sep 17 00:00:00 2001 From: Wisaroot Lertthaweedech Date: Thu, 28 Aug 2025 19:54:45 +0700 Subject: [PATCH 5/6] ci: dev --- sonar-project.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 377a9ba..071e15b 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,5 +1,6 @@ # SonarQube Configuration -sonar.projectKey=leetcode-py +sonar.organization=wisarootl +sonar.projectKey=wisarootl_leetcode-py sonar.projectName=LeetCode Python Solutions sonar.projectVersion=1.0 From 97ad6ded15242c6da8590083927281b80fe955e2 Mon Sep 17 00:00:00 2001 From: Wisaroot Lertthaweedech Date: Thu, 28 Aug 2025 19:57:52 +0700 Subject: [PATCH 6/6] ci: dev --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 071e15b..02993f7 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,5 +1,5 @@ # SonarQube Configuration -sonar.organization=wisarootl +sonar.organization=wisaroot sonar.projectKey=wisarootl_leetcode-py sonar.projectName=LeetCode Python Solutions sonar.projectVersion=1.0