Skip to content

Commit

Permalink
Add SonarCloud config
Browse files Browse the repository at this point in the history
  • Loading branch information
smithkm committed Jul 19, 2023
1 parent e87b723 commit 9117ce0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI with Maven
name: Java CI with Maven and SonarCloud

on: [pull_request]
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
Expand All @@ -23,5 +28,19 @@ jobs:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- 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 -B package
- name: Analyze with SonarCloud and run tests
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=bcgov_VDYP
3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<hamcrest.version>2.2</hamcrest.version>
<easymock.version>5.1.0</easymock.version>

<sonar.organization>bcgov-sonarcloud</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

</properties>

<modules>
Expand Down

0 comments on commit 9117ce0

Please sign in to comment.