Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 9777145

Browse files
committed
checks error fix
1 parent b790480 commit 9777145

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

.github/workflows/main.yml

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: SonarQube Scan
1+
name: Build
22

33
on:
44
push:
@@ -9,32 +9,33 @@ on:
99
- '**'
1010

1111
jobs:
12-
sonarQube:
12+
build:
13+
name: Build and analyze
1314
runs-on: ubuntu-latest
1415

1516
steps:
16-
- name: Checkout repository
17-
uses: actions/checkout@v2
18-
19-
- name: Set up JDK 22
20-
uses: actions/setup-java@v2
21-
with:
22-
java-version: '22'
23-
24-
- name: Cache SonarQube packages
25-
uses: actions/cache@v2
26-
with:
27-
path: ~/.sonar/cache
28-
key: ${{ runner.os }}-sonar-cache
29-
restore-keys: |
30-
${{ runner.os }}-sonar-cache
31-
32-
- name: SonarQube Scan
33-
env:
34-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
35-
run: mvn clean verify sonar:sonar -Dsonar.projectKey=<your_project_key> -Dsonar.host.url=<your_sonarqube_server_url> -Dsonar.login=${{ secrets.SONAR_TOKEN }}
36-
37-
- name: Upload SonarQube results
38-
if: always()
39-
run: |
40-
echo "Uploading SonarQube results"
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
20+
- name: Set up JDK 22
21+
uses: actions/setup-java@v2
22+
with:
23+
distribution: 'temurin' # or 'adopt', depending on your preference
24+
java-version: '22'
25+
- name: Cache SonarQube packages
26+
uses: actions/cache@v1
27+
with:
28+
path: ~/.sonar/cache
29+
key: ${{ runner.os }}-sonar
30+
restore-keys: ${{ runner.os }}-sonar
31+
- name: Cache Maven packages
32+
uses: actions/cache@v1
33+
with:
34+
path: ~/.m2
35+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
36+
restore-keys: ${{ runner.os }}-m2
37+
- name: Build and analyze
38+
env:
39+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
40+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
41+
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=com.kafka.learn:kafkaStudy -Dsonar.projectName='KafkaStudy'

0 commit comments

Comments
 (0)