chore(ci): koppla in SonarQube-analys mot självhostad sonar.siax.io #123

Merged
siax-ci merged 1 commits from chore/sonarqube-analysis into main 2026-09-28 09:35:32 +00:00
2 changed files with 31 additions and 0 deletions
+28
View File
@@ -237,3 +237,31 @@ jobs:
- name: Trivy scan (vuln + secrets -- BLOCKING, fails on HIGH/CRITICAL)
run: |
trivy fs --scanners vuln,secret --severity HIGH,CRITICAL --exit-code 1 .
sonar:
# SonarQube Community Build har inget separat PR-analysläge (en enda "main"-gren
# per projekt) — en analys från en PR-branch eller en tagg-push som inte pekar på
# main skulle skriva över kvalitetshistoriken. Kör därför bara
# vid push till main.
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: SonarQube analysis (self-hosted sonar.siax.io)
env:
SONAR_HOST_URL: https://sonar.siax.io
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
set -euo pipefail
test -n "$SONAR_TOKEN" || { echo "::error::SONAR_TOKEN repo secret missing"; exit 1; }
# Jobbet kör i en container på act_runner; "docker run -v \"\$PWD:...\""
# skulle montera VÄRDENS (tomma) sökväg. Kopiera in källträdet istället.
cid=$(docker create -e SONAR_HOST_URL -e SONAR_TOKEN -w /usr/src \
sonarsource/sonar-scanner-cli:latest \
sonar-scanner -Dsonar.projectKey=0pt -Dsonar.host.url="$SONAR_HOST_URL")
trap 'docker rm -f "$cid" >/dev/null 2>&1 || true' EXIT
docker cp . "$cid":/usr/src
docker start -a "$cid"
+3
View File
@@ -0,0 +1,3 @@
sonar.projectKey=0pt
sonar.host.url=https://sonar.siax.io
sonar.exclusions=**/node_modules/**,**/dist/**,**/build/**,**/.next/**,**/out/**,**/coverage/**,**/__pycache__/**,**/*.min.js,**/.venv/**,**/.pnpm-store/**,**/.opt-blobs/**,**/.data/**