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
|
||||
Reference in New Issue
Block a user