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
|
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"
|
|
||||||
docker run --rm \
|
|
||||||
-e SONAR_HOST_URL="$HOST_URL" \
|
|
||||||
-e SONAR_TOKEN="$SONAR_TOKEN" \
|
|
||||||
-v "$WORKDIR:/project" \
|
|
||||||
-w /project \
|
|
||||||
sonarsource/sonar-scanner-cli \
|
|
||||||
sonar-scanner \
|
sonar-scanner \
|
||||||
-Dsonar.host.url="$HOST_URL" \
|
-Dsonar.host.url="$HOST_URL" \
|
||||||
|
-Dsonar.login="$SONAR_TOKEN" \
|
||||||
-Dsonar.projectKey="$PROJECT_KEY" \
|
-Dsonar.projectKey="$PROJECT_KEY" \
|
||||||
-Dsonar.sources=. \
|
-Dsonar.sources=. \
|
||||||
-Dsonar.scm.disabled=true \
|
-Dsonar.scm.disabled=true \
|
||||||
-Dsonar.projectBaseDir=/project
|
-Dsonar.projectBaseDir="$WORKDIR"
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
needs: [lint, sonar]
|
needs: [lint, sonar]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue