Skip to content

Commit 71445f6

Browse files
authored
Sonar (#7)
* fix: sonar issue * fix: naming sonar
1 parent d51016f commit 71445f6

File tree

2 files changed

+48
-8
lines changed

2 files changed

+48
-8
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ jobs:
1919
matrix:
2020
java: [ 11, 17 ]
2121
distribution: [ temurin ]
22-
kubernetes: [ 'v1.17.13','v1.18.20','v1.19.14','v1.20.10','v1.21.4', 'v1.22.1' ]
2322
steps:
2423
- uses: actions/checkout@v2
2524
- name: Set up Java and Maven
@@ -28,12 +27,6 @@ jobs:
2827
distribution: ${{ matrix.distribution }}
2928
java-version: ${{ matrix.java }}
3029
cache: 'maven'
31-
- name: Cache SonarCloud packages
32-
uses: actions/cache@v1
33-
with:
34-
path: ~/.sonar/cache
35-
key: ${{ runner.os }}-sonar
36-
restore-keys: ${{ runner.os }}-sonar
3730
- name: Cache Maven packages
3831
uses: actions/cache@v1
3932
with:
@@ -44,5 +37,5 @@ jobs:
4437
env:
4538
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
4639
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
47-
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=java-operator-sdk_admission-controller-framework
40+
run: ./mvnw ${MAVEN_ARGS} -B test --file pom.xml
4841

.github/workflows/sonar.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
strategy:
19+
matrix:
20+
java: [ 17 ]
21+
distribution: [ temurin ]
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Set up Java and Maven
25+
uses: actions/setup-java@v2
26+
with:
27+
distribution: ${{ matrix.distribution }}
28+
java-version: ${{ matrix.java }}
29+
cache: 'maven'
30+
- name: Cache SonarCloud packages
31+
uses: actions/cache@v1
32+
with:
33+
path: ~/.sonar/cache
34+
key: ${{ runner.os }}-sonar
35+
restore-keys: ${{ runner.os }}-sonar
36+
- name: Cache Maven packages
37+
uses: actions/cache@v1
38+
with:
39+
path: ~/.m2
40+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
41+
restore-keys: ${{ runner.os }}-m2
42+
- name: Build and analyze
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
45+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
46+
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=java-operator-sdk_admission-controller-framework
47+

0 commit comments

Comments
 (0)