Skip to content

Commit 9d6b4cc

Browse files
authored
Merge pull request #3496 from huangruiteng/codex/sonarcloud
ci(sonarcloud): add non-blocking SonarCloud analysis
2 parents fd408ee + d9e87f2 commit 9d6b4cc

2 files changed

Lines changed: 97 additions & 0 deletions

File tree

‎.github/workflows/sonarcloud.yml‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: SonarCloud
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/workflows/sonarcloud.yml"
7+
- "sonar-project.properties"
8+
- "loopx/**"
9+
- "apps/**"
10+
- "scripts/**"
11+
- "tests/**"
12+
- "package.json"
13+
- "package-lock.json"
14+
- "pyproject.toml"
15+
- "tsconfig.control-plane.json"
16+
push:
17+
branches:
18+
- main
19+
paths:
20+
- ".github/workflows/sonarcloud.yml"
21+
- "sonar-project.properties"
22+
- "loopx/**"
23+
- "apps/**"
24+
- "scripts/**"
25+
- "tests/**"
26+
- "package.json"
27+
- "package-lock.json"
28+
- "pyproject.toml"
29+
- "tsconfig.control-plane.json"
30+
31+
permissions:
32+
contents: read
33+
34+
concurrency:
35+
group: sonarcloud-${{ github.ref }}
36+
cancel-in-progress: true
37+
38+
jobs:
39+
sonar:
40+
name: SonarCloud analysis (non-blocking)
41+
runs-on: ubuntu-latest
42+
# Skip until maintainers provision SONAR_TOKEN so this is never a blocker.
43+
if: ${{ secrets.SONAR_TOKEN != '' }}
44+
steps:
45+
- name: Check out repository
46+
uses: actions/checkout@v7
47+
with:
48+
fetch-depth: 0
49+
50+
- name: Set up Python
51+
uses: actions/setup-python@v6
52+
with:
53+
python-version: "3.11"
54+
cache: pip
55+
56+
- name: Install test dependencies
57+
run: python -m pip install --disable-pip-version-check -e ".[test]"
58+
59+
- name: Run fast tests with coverage XML
60+
run: >-
61+
python -m pytest -q -n 2
62+
--cov=loopx
63+
--cov-report=term
64+
--cov-report=xml:coverage.xml
65+
66+
- name: SonarCloud scan
67+
# Analysis-only: findings are reported to the PR/dashboard but never
68+
# block merge. Remove this flag only if the quality gate becomes a
69+
# required check.
70+
continue-on-error: true
71+
uses: SonarSource/sonarqube-scan-action@v8.2.1
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

‎sonar-project.properties‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
sonar.organization=huangruiteng
2+
sonar.projectKey=huangruiteng_loopx
3+
sonar.projectName=LoopX
4+
5+
# Public project links
6+
sonar.links.homepage=https://github.com/huangruiteng/loopx
7+
sonar.links.scm=https://github.com/huangruiteng/loopx
8+
9+
sonar.sourceEncoding=UTF-8
10+
11+
# Analyzed surfaces: Python product core, TypeScript/JavaScript product
12+
# surfaces, and helper scripts. Generated frontend bundles, legacy
13+
# deprecate/, and non-analyzed runtimes (Rust/Tauri) are excluded.
14+
sonar.sources=loopx,apps,scripts
15+
sonar.tests=tests
16+
sonar.exclusions=**/node_modules/**,**/dist/**,**/build/**,**/src-tauri/**,loopx/web/chat/assets/**,**/*.min.js,deprecate/**
17+
18+
# Python
19+
sonar.python.version=3.11
20+
sonar.python.coverage.reportPaths=coverage.xml
21+
22+
# Non-blocking by default: report findings, never gate the workflow.
23+
sonar.qualitygate.wait=false

0 commit comments

Comments
 (0)