41 lines
1.1 KiB
YAML
41 lines
1.1 KiB
YAML
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 |