Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: #1 sonarCloud 프로퍼티 설정 #2

Merged
merged 8 commits into from
Jul 9, 2023
Merged
36 changes: 14 additions & 22 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,33 @@ on:
branches:
- develop
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build and analyze
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: SetUp JDK 17
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: "17"
distribution: 'adopt'

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

java-version: 17
distribution: 'zulu'
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- 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
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew build sonar --info
13 changes: 13 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,24 @@ plugins {
id 'java'
id 'org.springframework.boot' version '3.1.1'
id 'io.spring.dependency-management' version '1.1.0'
id "org.sonarqube" version "4.2.1.3168"
}

group = 'everymeal'
version = '0.0.1-SNAPSHOT'

sonar {
properties {
property "sonar.projectKey", "everymeals_EveryMeal_Server"
property "sonar.organization", "everymeals"
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"
}
}

java {
sourceCompatibility = '17'
}
Expand Down