Skip to content

Commit 796c92d

Browse files
authored
Add SonarCloud CI workflow configuration
This workflow configures SonarCloud for continuous integration, including steps for frontend and backend dependency installation, testing, and scanning.
1 parent 2cdcd3a commit 796c92d

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/sonarcloud.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: SonarCloud
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
analyze:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Use Node 20
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
23+
# FRONTEND (adjust path if needed)
24+
- name: Install FE deps
25+
working-directory: frontend
26+
run: npm ci
27+
28+
- name: FE tests (coverage)
29+
working-directory: frontend
30+
run: npm test -- --coverage --watchAll=false || echo "no FE tests"
31+
32+
# BACKEND (adjust path if needed)
33+
- name: Install BE deps
34+
working-directory: backend
35+
run: npm ci
36+
37+
- name: BE tests (coverage)
38+
working-directory: backend
39+
run: npm test -- --coverage --watchAll=false || echo "no BE tests"
40+
41+
- name: SonarCloud scan
42+
uses: SonarSource/sonarcloud-github-action@v2
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)