Skip to content

Commit 63ea880

Browse files
committed
added sonar coverage collection
1 parent 3b3b26c commit 63ea880

2 files changed

Lines changed: 29 additions & 28 deletions

File tree

.github/workflows/fe_e2e.yml

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ jobs:
3838

3939
# Wait for services
4040
- name: Wait for services
41-
run: sleep
41+
run: sleep 5000
4242

43-
# install dependencies
43+
# install backend dependencies
4444
- name: Install dependencies
4545
run: pip install -r requirements.txt
4646
working-directory: backend
@@ -58,31 +58,23 @@ jobs:
5858
python backend/notes_crud_service/app.py &
5959
wait
6060
61-
62-
test-and-coverage:
63-
timeout-minutes: 60
64-
runs-on: ubuntu-latest
65-
steps:
66-
# 1. Checkout code
67-
- uses: actions/checkout@v4
68-
69-
# 2. Set up Node
61+
# Set up Node
7062
- name: Set up Node.js
7163
uses: actions/setup-node@v4
7264
with:
7365
node-version: lts/*
7466

75-
# 3. Install dependencies
67+
# Install frontend dependencies
7668
- name: Install dependencies
7769
run: npm ci
7870
working-directory: frontend
7971

80-
# 4. Build app (with coverage instrumentation)
72+
# Build app (with coverage instrumentation)
8173
- name: Build React app with coverage
8274
run: npm run build
8375
working-directory: frontend
8476

85-
# 5. Start the app in background
77+
# Start the app in background
8678
- name: Start React app
8779
run: npm run start &
8880
working-directory: frontend
@@ -91,26 +83,20 @@ jobs:
9183
run: npx wait-on http://localhost:5173
9284
working-directory: frontend
9385

94-
# 6. Run Playwright tests
86+
# Run Playwright tests
9587
- name: Run Playwright tests
9688
run: npm run test:e2e-coverage
9789
working-directory: frontend
9890

99-
# 7. Upload coverage as artifact (optional)
91+
# Upload coverage as artifact
10092
- name: Upload coverage artifact
101-
uses: actions/upload-artifact@v3
93+
uses: actions/upload-artifact@v4
10294
with:
10395
name: coverage
10496
path: frontend/coverage/
10597

106-
107-
# 8. SonarQube Analysis
108-
- name: Run SonarQube Scanner
109-
uses: sonarsource/sonarcloud-github-action@v2
110-
with:
111-
projectKey: NavodPeiris_NoteMaker
112-
organization: navodpeiris
113-
token: ${{ secrets.SONAR_TOKEN }}
114-
extraProperties: |
115-
sonar.javascript.lcov.reportPaths=frontend/coverage/lcov.info
116-
sonar.sources=frontend/src
98+
# SonarQube Analysis
99+
- name: SonarQube Scan
100+
uses: SonarSource/sonarqube-scan-action@v5
101+
env:
102+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

sonar-project.properties

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
sonar.projectKey=NavodPeiris_NoteMaker
2+
sonar.organization=navodpeiris
3+
4+
5+
# This is the name and version displayed in the SonarCloud UI.
6+
#sonar.projectName=NoteMaker
7+
#sonar.projectVersion=1.0
8+
9+
10+
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
11+
sonar.sources=./frontend/src
12+
sonar.javascript.lcov.reportPaths=./frontend/coverage/lcov.info
13+
14+
# Encoding of the source code. Default is default system encoding
15+
#sonar.sourceEncoding=UTF-8

0 commit comments

Comments
 (0)