Skip to content

Commit 50974b6

Browse files
5 fixes, according to SonarQube
Co-authored-by: Annie Nguyen Ly <[email protected]>
1 parent f1c909d commit 50974b6

File tree

8 files changed

+239
-220
lines changed

8 files changed

+239
-220
lines changed
Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,50 @@
11
on:
2-
# Elements that trigger the workflow
32
push:
43
branches:
5-
- '*' # Runs on all branches
4+
- "*" # Runs on all branches
65
pull_request:
76
branches:
8-
- '*' # Runs on all branches
7+
- "*" # Runs on all branches
98

109
jobs:
11-
# Define a job "build"
1210
build:
1311
runs-on: ubuntu-latest
1412

15-
1613
steps:
17-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
1814
- name: Checkout code
1915
uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0 # Required for SonarQube analysis
2018

21-
# set up express server
2219
- name: Set up Node.js
2320
uses: actions/setup-node@v2
2421
with:
25-
node-version: '18'
22+
node-version: "18"
2623

27-
# Inject environment variables (MongoDB Atlas & Firebase connections)
2824
- name: Create .env file
2925
run: |
3026
echo "DB_CONN_STRING=${{ secrets.DB_CONN_STRING }}" >> chathaven/.env
3127
echo "DB_NAME=chatHavenDB" >> chathaven/.env
3228
echo "PORT=3000" >> chathaven/.env
3329
echo "FIREBASE_API_KEY=${{ secrets.FIREBASE_API_KEY }}" >> chathaven/.env
34-
echo "GEMINI_API_KEY=${{ secrets.GEMINI_API_KEY }}" >> chathaven/.env # Add this line
30+
echo "GEMINI_API_KEY=${{ secrets.GEMINI_API_KEY }}" >> chathaven/.env
3531
36-
# Install backend dependencies
3732
- name: Install backend dependencies
3833
working-directory: ./chathaven/backend
3934
run: npm ci
4035

41-
# Install frontend dependencies
4236
- name: Install frontend dependencies
4337
working-directory: ./chathaven/frontend
4438
run: npm ci
4539

46-
# # Run backend tests
4740
- name: Run Jest Unit Tests
4841
working-directory: ./chathaven/backend
4942
run: npm test
43+
44+
- name: SonarQube Scan
45+
uses: SonarSource/sonarqube-scan-action@v5
46+
with:
47+
projectBaseDir: ./chathaven/backend
48+
env:
49+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
50+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ node_modules
4242

4343
# Environment variables
4444
/chathaven/.env
45+
46+
# SonarQube
47+
chathaven/sonar-project.properties
48+
/chathaven/backend/.scannerwork

0 commit comments

Comments
 (0)