ci: run sonar-scanner locally instead of docker
All checks were successful
build-and-push / lint (push) Successful in 5s
build-and-push / sonar (push) Successful in 16s
build-and-push / docker (push) Successful in 1m10s

This commit is contained in:
nocci 2025-12-30 14:27:12 +00:00
parent b5e9111039
commit f82c158a6b

View file

@ -28,6 +28,12 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Sonar Scanner (npm)
run: npm install -g sonarqube-scanner
- name: SonarQube Scan - name: SonarQube Scan
env: env:
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
@ -49,20 +55,14 @@ jobs:
ls -la ls -la
echo "Sample files:" echo "Sample files:"
find . -maxdepth 2 -type f | head -n 20 find . -maxdepth 2 -type f | head -n 20
echo "Check files inside scanner container:" echo "Running local sonar-scanner..."
docker run --rm -v "$WORKDIR:/project" -w /project alpine sh -c "pwd; ls -la . | head && find . -maxdepth 2 -type f -name '*.js' | head -n 20" sonar-scanner \
docker run --rm \ -Dsonar.host.url="$HOST_URL" \
-e SONAR_HOST_URL="$HOST_URL" \ -Dsonar.login="$SONAR_TOKEN" \
-e SONAR_TOKEN="$SONAR_TOKEN" \ -Dsonar.projectKey="$PROJECT_KEY" \
-v "$WORKDIR:/project" \ -Dsonar.sources=. \
-w /project \ -Dsonar.scm.disabled=true \
sonarsource/sonar-scanner-cli \ -Dsonar.projectBaseDir="$WORKDIR"
sonar-scanner \
-Dsonar.host.url="$HOST_URL" \
-Dsonar.projectKey="$PROJECT_KEY" \
-Dsonar.sources=. \
-Dsonar.scm.disabled=true \
-Dsonar.projectBaseDir=/project
docker: docker:
needs: [lint, sonar] needs: [lint, sonar]