Skip to content

Commit d1e7844

Browse files
authored
Merge pull request #156 from activatedkc/feat/sonarcloud-integration
feat: Integrate SonarCloud for code quality analysis
2 parents 5f89cc2 + d4c0da7 commit d1e7844

2 files changed

Lines changed: 54 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,14 @@ jobs:
9696
- name: Install dependencies
9797
run: npm ci --legacy-peer-deps
9898

99-
- name: Run tests
100-
run: npm test
99+
- name: Run tests with coverage
100+
run: npm run test:coverage
101+
102+
- name: Upload coverage report
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: coverage-report
106+
path: coverage/lcov.info
101107

102108
typescript-build:
103109
name: TypeScript Build
@@ -120,6 +126,29 @@ jobs:
120126
env:
121127
EXPO_NO_TELEMETRY: 1
122128

129+
sonarcloud:
130+
name: SonarCloud Analysis
131+
runs-on: ubuntu-latest
132+
needs: [typescript-tests]
133+
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
134+
steps:
135+
- name: Checkout code
136+
uses: actions/checkout@v4
137+
with:
138+
fetch-depth: 0
139+
140+
- name: Download coverage report
141+
uses: actions/download-artifact@v4
142+
with:
143+
name: coverage-report
144+
path: coverage
145+
146+
- name: SonarCloud Scan
147+
uses: SonarSource/sonarcloud-github-action@master
148+
env:
149+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
150+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
151+
123152
# ─────────────────────────────────────────────────────────
124153
# Rust / Soroban Smart Contract Checks
125154
# ─────────────────────────────────────────────────────────
@@ -217,6 +246,7 @@ jobs:
217246
typescript-typecheck,
218247
typescript-tests,
219248
typescript-build,
249+
sonarcloud,
220250
rust-format,
221251
rust-clippy,
222252
rust-tests,
@@ -240,6 +270,7 @@ jobs:
240270
typescript-typecheck,
241271
typescript-tests,
242272
typescript-build,
273+
sonarcloud,
243274
rust-format,
244275
rust-clippy,
245276
rust-tests,
@@ -256,6 +287,7 @@ jobs:
256287
[ "${{ needs.typescript-typecheck.result }}" != "success" ] || \
257288
[ "${{ needs.typescript-tests.result }}" != "success" ] || \
258289
[ "${{ needs.typescript-build.result }}" != "success" ] || \
290+
[ "${{ needs.sonarcloud.result }}" != "success" ] || \
259291
[ "${{ needs.rust-format.result }}" != "success" ] || \
260292
[ "${{ needs.rust-clippy.result }}" != "success" ] || \
261293
[ "${{ needs.rust-tests.result }}" != "success" ] || \

sonar-project.properties

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
sonar.projectKey=Smartdevs17_SubTrackr
2+
sonar.organization=smartdevs17
3+
4+
# This is the name and version displayed in the SonarCloud UI.
5+
sonar.projectName=SubTrackr
6+
sonar.projectVersion=1.0
7+
8+
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
9+
sonar.sources=src
10+
sonar.tests=src
11+
sonar.test.inclusions=**/*.test.tsx,**/*.test.ts
12+
13+
# Encoding of the source code. Default is default system encoding
14+
sonar.sourceEncoding=UTF-8
15+
16+
# Coverage report paths
17+
sonar.javascript.lcov.reportPaths=coverage/lcov.info
18+
19+
# Exclusions
20+
sonar.exclusions=**/node_modules/**,**/dist/**,**/build/**,**/contracts/**,**/stellarlend/**,assets/**

0 commit comments

Comments
 (0)