ci: run sonar-scanner locally instead of docker
This commit is contained in:
parent
b5e9111039
commit
f82c158a6b
1 changed files with 14 additions and 14 deletions
|
|
@ -28,6 +28,12 @@ jobs:
|
|||
uses: actions/checkout@v4
|
||||
with:
|
||||
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
|
||||
env:
|
||||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||
|
|
@ -49,20 +55,14 @@ jobs:
|
|||
ls -la
|
||||
echo "Sample files:"
|
||||
find . -maxdepth 2 -type f | head -n 20
|
||||
echo "Check files inside scanner container:"
|
||||
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"
|
||||
docker run --rm \
|
||||
-e SONAR_HOST_URL="$HOST_URL" \
|
||||
-e SONAR_TOKEN="$SONAR_TOKEN" \
|
||||
-v "$WORKDIR:/project" \
|
||||
-w /project \
|
||||
sonarsource/sonar-scanner-cli \
|
||||
echo "Running local sonar-scanner..."
|
||||
sonar-scanner \
|
||||
-Dsonar.host.url="$HOST_URL" \
|
||||
-Dsonar.login="$SONAR_TOKEN" \
|
||||
-Dsonar.projectKey="$PROJECT_KEY" \
|
||||
-Dsonar.sources=. \
|
||||
-Dsonar.scm.disabled=true \
|
||||
-Dsonar.projectBaseDir=/project
|
||||
-Dsonar.projectBaseDir="$WORKDIR"
|
||||
|
||||
docker:
|
||||
needs: [lint, sonar]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue