Skip to content

Commit

Permalink
Merge pull request #223 from PLADI-ALM/hotfix/PDS-192-sonarCloud
Browse files Browse the repository at this point in the history
[PDS-192/hotfix] sonarCloud ci 수정
  • Loading branch information
chaerlo127 authored Nov 22, 2023
2 parents 157fa21 + c2e57b6 commit 523eca7
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 42 deletions.
83 changes: 41 additions & 42 deletions .github/workflows/sonarCloud.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
name: SonarCloud
on:
push:
branches:
- develop
pull_request:

jobs:
SonarCloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'zulu' # Alternative distribution options are available
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Make application-secret.yml
run: |
cd ./src/main/resources
touch ./application-secret.yml
echo "${{ secrets.PROPERTIES_SECRET }}" > ./application-secret.yml
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build and analyze
run: ./gradlew test sonar --info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
#name: SonarCloud
#on:
# pull_request:
# branches:
# - develop
#
#jobs:
# sonarCloud:
# name: SonarCloud
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
# - name: Set up JDK 11
# uses: actions/setup-java@v3
# with:
# java-version: 11
# distribution: 'zulu' # Alternative distribution options are available
# - name: Cache Gradle packages
# uses: actions/cache@v3
# with:
# path: ~/.gradle/caches
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
# restore-keys: ${{ runner.os }}-gradle
# - name: Make application-secret.yml
# run: |
# cd ./src/main/resources
# touch ./application-secret.yml
# echo "${{ secrets.PROPERTIES_SECRET }}" > ./application-secret.yml
# - name: Cache SonarCloud packages
# uses: actions/cache@v3
# with:
# path: ~/.sonar/cache
# key: ${{ runner.os }}-sonar
# restore-keys: ${{ runner.os }}-sonar
# - name: Build and analyze
# run: ./gradlew build sonar --info
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ sonar {
property "sonar.projectKey", "PLADI-ALM_PLADI-ALM-Server"
property "sonar.organization", "pladi-alm"
property "sonar.host.url", "https://sonarcloud.io"
property 'sonar.sources', 'src'
property 'sonar.language', 'java'
property 'sonar.sourceEncoding', 'UTF-8'
property "sonar.exclusions", "**/*Application*.java" // Application 파일은 분석 대상에서 제외
property "sonar.java.coveragePlugin", "jacoco"
property 'sonar.coverage.jacoco.xmlReportPaths', 'build/reports/jacoco/test/jacocoTestReport.xml'
}
Expand Down

0 comments on commit 523eca7

Please sign in to comment.