♻️ refactor(Project):Add logger to validate acronym.aiccra-mar… #459
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 | |
on: | |
push: | |
branches: | |
- aiccra-marlo-java-11-version2 | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
name: Build and analyze | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Clonar repositorio completamente para el análisis | |
- name: Set up JDK 11 for build | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 11 | |
distribution: 'temurin' | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache Maven packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Update maven-war-plugin version | |
run: sed -i 's/<version>2.3<\/version>/<version>3.3.2<\/version>/' pom.xml | |
- name: Build with Maven (Java 11) | |
run: mvn -B clean install | |
- name: Set up JDK 17 for SonarQube analysis | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Verify SONAR_TOKEN | |
run: | | |
if [ -z "${{ secrets.SONAR_TOKEN }}" ]; then | |
echo "SONAR_TOKEN is not set or empty" | |
exit 1 | |
else | |
echo "SONAR_TOKEN is set" | |
fi | |
- name: Build and analyze with SonarCloud | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=CCAFS_MARLO |