From 59280d45d85edc9c356dfffec8124728d9a6dcf4 Mon Sep 17 00:00:00 2001 From: tomaytotomato <971697+tomaytotomato@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:44:34 +0100 Subject: [PATCH] Adding SonarCloud analysis/linting --- .github/workflows/build.yml | 26 +++++++++++++++++--------- pom.xml | 2 ++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 54285ee..bfc6f8b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,19 +23,27 @@ jobs: distribution: 'temurin' java-version: '21' - - name: Cache Maven packages + - name: Cache SonarCloud packages uses: actions/cache@v3 with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar - - name: Install Maven dependencies - run: mvn install -DskipTests + - name: Cache Maven packages + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 - - name: Build with Maven - run: mvn compile + - name: Build and analyze + 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=tomaytotomato_location4j - name: Run tests run: mvn test + + diff --git a/pom.xml b/pom.xml index 6070d0e..5664096 100644 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,8 @@ 2.17.2 3.3.1 0.8.12 + tomaytotomato + https://sonarcloud.io