Skip to content

Commit

Permalink
checks error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SVAdithya committed Jul 17, 2024
1 parent b790480 commit 9777145
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: SonarQube Scan
name: Build

on:
push:
Expand All @@ -9,32 +9,33 @@ on:
- '**'

jobs:
sonarQube:
build:
name: Build and analyze
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up JDK 22
uses: actions/setup-java@v2
with:
java-version: '22'

- name: Cache SonarQube packages
uses: actions/cache@v2
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar-cache
restore-keys: |
${{ runner.os }}-sonar-cache
- name: SonarQube Scan
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn clean verify sonar:sonar -Dsonar.projectKey=<your_project_key> -Dsonar.host.url=<your_sonarqube_server_url> -Dsonar.login=${{ secrets.SONAR_TOKEN }}

- name: Upload SonarQube results
if: always()
run: |
echo "Uploading SonarQube results"
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 22
uses: actions/setup-java@v2
with:
distribution: 'temurin' # or 'adopt', depending on your preference
java-version: '22'
- name: Cache SonarQube packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=com.kafka.learn:kafkaStudy -Dsonar.projectName='KafkaStudy'

0 comments on commit 9777145

Please sign in to comment.