Skip to content

Commit d51016f

Browse files
authored
feature: sonar and refactored build ci (#6)
1 parent 768bd6d commit d51016f

File tree

4 files changed

+50
-63
lines changed

4 files changed

+50
-63
lines changed

.github/workflows/build.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Test & Release Snapshot to Maven Central
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: [ 11, 17 ]
21+
distribution: [ temurin ]
22+
kubernetes: [ 'v1.17.13','v1.18.20','v1.19.14','v1.20.10','v1.21.4', 'v1.22.1' ]
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Set up Java and Maven
26+
uses: actions/setup-java@v2
27+
with:
28+
distribution: ${{ matrix.distribution }}
29+
java-version: ${{ matrix.java }}
30+
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
37+
- name: Cache Maven packages
38+
uses: actions/cache@v1
39+
with:
40+
path: ~/.m2
41+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
42+
restore-keys: ${{ runner.os }}-m2
43+
- name: Build and analyze
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
46+
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
48+

.github/workflows/main-build.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/pr.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
<java.version>11</java.version>
3030
<maven.compiler.source>${java.version}</maven.compiler.source>
3131
<maven.compiler.target>${java.version}</maven.compiler.target>
32+
<sonar.organization>java-operator-sdk</sonar.organization>
33+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
3234

3335
<junit.version>5.8.2</junit.version>
3436
<fabric8-client.version>5.10.1</fabric8-client.version>

0 commit comments

Comments
 (0)