Skip to content

Commit d7511db

Browse files
committed
ci: add SonarQube GitHub Actions workflow
- Add automated SonarQube analysis on push to main - Add quality gate check for pull requests - Configure Node.js 20 environment for analysis
1 parent 6ca8e6a commit d7511db

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/sonarqube.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: SonarQube Analysis
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
10+
jobs:
11+
sonarqube:
12+
name: SonarQube Scan
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0 # Shallow clones should be disabled for better analysis
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20'
24+
cache: 'npm'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: SonarQube Scan
30+
uses: SonarSource/sonarqube-scan-action@master
31+
env:
32+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
33+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
34+
35+
- name: SonarQube Quality Gate check
36+
id: sonarqube-quality-gate-check
37+
uses: sonarsource/sonarqube-quality-gate-action@master
38+
timeout-minutes: 5
39+
env:
40+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
41+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

0 commit comments

Comments
 (0)