Update .gitea/workflows/sonar.yml
All checks were successful
SonarQube Analysis / SonarQube Scan (push) Successful in 50s
All checks were successful
SonarQube Analysis / SonarQube Scan (push) Successful in 50s
This commit is contained in:
@@ -1,23 +1,18 @@
|
||||
name: SonarQube Analysis
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
sonarqube:
|
||||
name: SonarQube Scan
|
||||
runs-on: ubuntu-latest
|
||||
# This runs the whole job INSIDE the sonar-scanner container
|
||||
container:
|
||||
image: sonarsource/sonar-scanner-cli:12.0.0.3214_8.0.1
|
||||
options: --user root
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -25,40 +20,17 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# - name: Run SonarScanner (Docker v12)
|
||||
# run: |
|
||||
# # Safely get repository name from current directory
|
||||
# PROJECT_KEY=$(basename "$PWD")
|
||||
#
|
||||
# echo "Using project key: $PROJECT_KEY"
|
||||
#
|
||||
# docker run --rm \
|
||||
# -v "$PWD:/usr/src" \
|
||||
# -w /usr/src \
|
||||
# -e SONAR_HOST_URL=${{ secrets.SONARQUBE_HOST }} \
|
||||
# -e SONAR_TOKEN=${{ secrets.SONARQUBE_TOKEN }} \
|
||||
# sonarsource/sonar-scanner-cli:12.0.0.3214_8.0.1 \
|
||||
# -Dsonar.projectKey=$PROJECT_KEY \
|
||||
# -Dsonar.projectName=$PROJECT_KEY \
|
||||
# -Dsonar.sources=. \
|
||||
# -Dsonar.exclusions=node_modules/**,dist/**,coverage/** \
|
||||
# -Dsonar.qualitygate.wait=true
|
||||
|
||||
- name: Run SonarScanner (Fixed for Gitea)
|
||||
- name: Run Scan
|
||||
run: |
|
||||
# Use Gitea-native repo name
|
||||
# Gitea repo name
|
||||
REPO_NAME=${{ gitea.event.repository.name }}
|
||||
|
||||
docker run --rm \
|
||||
--user root \
|
||||
-v "${{ gitea.workspace }}:/usr/src" \
|
||||
-w /usr/src \
|
||||
-e SONAR_HOST_URL=${{ secrets.SONARQUBE_HOST }} \
|
||||
-e SONAR_TOKEN=${{ secrets.SONARQUBE_TOKEN }} \
|
||||
sonarsource/sonar-scanner-cli:12.0.0.3214_8.0.1 \
|
||||
# We call the scanner directly since we are already inside its container
|
||||
sonar-scanner \
|
||||
-Dsonar.projectKey=$REPO_NAME \
|
||||
-Dsonar.projectName=$REPO_NAME \
|
||||
-Dsonar.sources=. \
|
||||
-Dsonar.scm.disabled=true \
|
||||
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} \
|
||||
-Dsonar.token=${{ secrets.SONARQUBE_TOKEN }} \
|
||||
-Dsonar.exclusions=node_modules/**,dist/**,coverage/** \
|
||||
-Dsonar.qualitygate.wait=true
|
||||
-Dsonar.qualitygate.wait=true
|
||||
Reference in New Issue
Block a user