Skip to content

Commit 7142ffd

Browse files
authored
Refactor CircleCI config for SonarQube scan
1 parent ffbc85e commit 7142ffd

File tree

1 file changed

+14
-31
lines changed

1 file changed

+14
-31
lines changed

.circleci/config.yml

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,35 @@
11
version: 2.1
22

33
orbs:
4-
node: circleci/node@5.1.0
4+
node: circleci/node@5.0
55

66
jobs:
7-
build-and-sonarqube:
7+
sonar_scan:
88
docker:
9-
- image: cimg/node:20.11 # Node.js image with npm and yarn
10-
- image: sonarsource/sonar-scanner-cli:latest # SonarQube scanner
11-
12-
working_directory: ~/repo
13-
9+
- image: circleci/node:20
1410
steps:
1511
- checkout
16-
17-
# Install dependencies for both frontend and backend
1812
- run:
19-
name: Install dependencies
13+
name: Install Dependencies
2014
command: |
21-
echo "Installing dependencies..."
22-
cd frontend && npm install
23-
cd ../backend && npm install
24-
cd ..
25-
26-
# Build React frontend
15+
cd payments-backend
16+
npm install
2717
- run:
28-
name: Build React app
18+
name: Install SonarScanner
2919
command: |
30-
echo "Building React frontend..."
31-
cd frontend && npm run build
32-
cd ..
33-
34-
35-
36-
# SonarQube Scan
20+
npm install -g sonar-scanner
3721
- run:
3822
name: Run SonarQube Scan
3923
command: |
4024
sonar-scanner \
41-
-Dsonar.projectKey=Gomo-star-creator_APDS7311_POE_PART3_ST10356945_ST10274003 \
42-
-Dsonar.organization=Gomo-star-creator \
25+
-Dsonar.organization=$SONAR_ORG \
26+
-Dsonar.projectKey=$SONAR_PROJECT_KEY \
4327
-Dsonar.sources=. \
44-
-Dsonar.host.url=${SONAR_HOST_URL} \
45-
-Dsonar.login=${SONAR_TOKEN}
28+
-Dsonar.host.url=https://sonarcloud.io \
29+
-Dsonar.login=$SONAR_TOKEN
4630
4731
workflows:
4832
version: 2
49-
build_and_scan:
33+
build_and_sonar:
5034
jobs:
51-
- build-and-sonarqube
52-
35+
- sonar_scan

0 commit comments

Comments
 (0)