ci: Add SonarQube integration
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Failing after 1m37s
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Failing after 1m37s
This commit is contained in:
41
.gitea/workflows/sonarqube.yml
Normal file
41
.gitea/workflows/sonarqube.yml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
name: SonarQube Analysis
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main, master, develop ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main, master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sonarqube:
|
||||||
|
name: SonarQube Scan
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # Full history for better analysis
|
||||||
|
|
||||||
|
- name: Test SonarQube connection
|
||||||
|
run: |
|
||||||
|
echo "Testing connection to SonarQube..."
|
||||||
|
curl -f http://192.168.1.100:9000/api/system/ping || echo "External connection failed"
|
||||||
|
|
||||||
|
- name: Run SonarQube scan
|
||||||
|
env:
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||||
|
run: |
|
||||||
|
# Docker 네트워크 확인
|
||||||
|
docker network ls
|
||||||
|
|
||||||
|
# SonarScanner 실행
|
||||||
|
docker run \
|
||||||
|
--rm \
|
||||||
|
--network gitea_default \
|
||||||
|
-e SONAR_HOST_URL="${SONAR_HOST_URL}" \
|
||||||
|
-e SONAR_SCANNER_OPTS="-Dsonar.projectKey=TK-BOM-Project" \
|
||||||
|
-e SONAR_TOKEN="${SONAR_TOKEN}" \
|
||||||
|
-v "${{ github.workspace }}:/usr/src" \
|
||||||
|
sonarsource/sonar-scanner-cli
|
||||||
19
sonar-project.properties
Normal file
19
sonar-project.properties
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# 프로젝트 식별 정보
|
||||||
|
sonar.projectKey=my-project # SonarQube에서 만든 프로젝트 키와 동일하게!
|
||||||
|
sonar.projectName=My Project
|
||||||
|
sonar.projectVersion=1.0
|
||||||
|
|
||||||
|
# 소스 코드 위치
|
||||||
|
sonar.sources=.
|
||||||
|
sonar.exclusions=**/*.test.js,**/node_modules/**,**/.gitea/**
|
||||||
|
|
||||||
|
# 언어별 설정 (프로젝트에 맞게 수정)
|
||||||
|
# JavaScript/TypeScript
|
||||||
|
sonar.javascript.file.suffixes=.js,.jsx,.ts,.tsx
|
||||||
|
sonar.typescript.file.suffixes=.ts,.tsx
|
||||||
|
|
||||||
|
# Python
|
||||||
|
# sonar.python.file.suffixes=.py
|
||||||
|
|
||||||
|
# Java
|
||||||
|
# sonar.java.binaries=target/classes
|
||||||
Reference in New Issue
Block a user