Skip to content

Commit e07b921

Browse files
committed
Merge branch 'chore/add-sonarcloud' into fix/sonarcloud-all-issues
2 parents 2537f67 + 5fb3787 commit e07b921

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

.github/workflows/sonarcloud.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: SonarCloud Analysis
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
sonarcloud:
14+
name: SonarCloud Scan
15+
runs-on: ubuntu-latest
16+
if: github.event.pull_request.head.repo.fork == false
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: 22
25+
cache: npm
26+
27+
- name: Install dependencies
28+
run: npm install
29+
30+
- name: Run unit tests with coverage
31+
run: npx jest --coverage --coverageReporters=lcov
32+
33+
- name: SonarCloud Scan
34+
uses: SonarSource/sonarqube-scan-action@v6
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

sonar-project.properties

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sonar.projectKey=hasadna_open-bus-map-search
2+
sonar.organization=hasadna
3+
sonar.projectName=open-bus-map-search
4+
5+
sonar.sources=src
6+
sonar.tests=src
7+
sonar.test.inclusions=**/*.test.ts,**/*.test.tsx,**/*.spec.ts
8+
sonar.exclusions=**/node_modules/**,**/*.spec.ts,**/*.stories.tsx
9+
sonar.coverage.exclusions=**/*.test.ts,**/*.test.tsx,**/*.spec.ts,**/*.stories.tsx
10+
11+
sonar.javascript.lcov.reportPaths=coverage/lcov.info
12+
sonar.typescript.lcov.reportPaths=coverage/lcov.info
13+
14+
sonar.sourceEncoding=UTF-8

0 commit comments

Comments
 (0)