Skip to content

Commit

Permalink
Adding SonarCloud analysis/linting
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaytotomato committed Jul 26, 2024
1 parent d03f9a5 commit 59280d4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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


2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<jackson-core.version>2.17.2</jackson-core.version>
<maven-surefire-plugin.version>3.3.1</maven-surefire-plugin.version>
<jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
<sonar.organization>tomaytotomato</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>

<distributionManagement>
Expand Down

0 comments on commit 59280d4

Please sign in to comment.