Skip to content

Configurar Sonar

Configurar Sonar #1

Workflow file for this run

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Java CI with Maven
on:
pull_request:
branches: [ "develop", "main" ]
jobs:
build_test_analyze:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@main
- name: Set up JDK 17
uses: actions/setup-java@main
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- uses: actions/cache@main
with:
path: |
target
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Run Tests with Maven
run: mvn -B test --file pom.xml
- name: Cache SonarCloud packages
uses: actions/cache@main
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Analyze with SonarCloud
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: >
mvn -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
-Dsonar.projectKey=entrevistador-inteligente-${{ github.event.repository.name }}
-Dsonar.organization=entrevistador-inteligente
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.qualitygate.wait=true