Skip to content
This repository was archived by the owner on Apr 10, 2024. It is now read-only.

Commit 600ef8d

Browse files
authored
feat: add sonar plugin (#34)
1 parent a876a55 commit 600ef8d

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.github/workflows/sonar.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Sonar
2+
3+
env:
4+
MAVEN_ARGS: -V -ntp -e
5+
6+
concurrency:
7+
group: ${{ github.ref }}-${{ github.workflow }}
8+
cancel-in-progress: true
9+
on:
10+
push:
11+
branches: [ main ]
12+
pull_request:
13+
types: [ opened, synchronize, reopened ]
14+
15+
jobs:
16+
test:
17+
runs-on: ubuntu-latest
18+
if: ${{ ( github.event_name == 'push' || github.event_name == 'pull_request' ) }}
19+
steps:
20+
- uses: actions/checkout@v3
21+
- name: Set up Java and Maven
22+
uses: actions/setup-java@v3
23+
with:
24+
distribution: temurin
25+
java-version: 17
26+
cache: 'maven'
27+
- name: Cache SonarCloud packages
28+
uses: actions/cache@v3
29+
with:
30+
path: ~/.sonar/cache
31+
key: ${{ runner.os }}-sonar
32+
restore-keys: ${{ runner.os }}-sonar
33+
- name: Build and analyze
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
36+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
37+
run: mvn -B org.jacoco:jacoco-maven-plugin:prepare-agent verify org.jacoco:jacoco-maven-plugin:report org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=java-operator-sdk_jenvtest
38+

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
<kubernetes.webhooks.framework.version>1.0.0</kubernetes.webhooks.framework.version>
5858
<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
5959
<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
60+
<sonar.organization>java-operator-sdk</sonar.organization>
61+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
6062
</properties>
6163

6264
<modules>

0 commit comments

Comments
 (0)