test sonar #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SonarCloud Code Analysis | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
sonarcloud: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the code | |
- uses: actions/checkout@v3 | |
# Set up Node.js 18 (ou a versão que seu projeto usa) | |
- name: Set up Node.js 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
# Install dependencies using npm (ou outro gerenciador de pacotes) | |
- name: Install dependencies | |
run: npm install | |
# Instalar SonarScanner globalmente | |
- name: Install SonarScanner | |
run: npm install -g sonarqube-scanner | |
# Build the project (se necessário) | |
- name: Build project | |
run: npm run build | |
# Run SonarCloud scan | |
- name: Run SonarCloud scan | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_PROJECT_KEY: ${{ vars.SONAR_PROJECT_KEY }} | |
SONAR_ORGANIZATION: ${{ vars.SONAR_ORGANIZATION }} | |
# run: npx sonar-scanner \ | |
# -Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }} \ | |
# -Dsonar.organization=${{ env.SONAR_ORGANIZATION }} \ | |
# -Dsonar.host.url=https://sonarcloud.io \ | |
# -Dsonar.login=${{ secrets.SONAR_TOKEN }} | |
run: sonar-scanner |