Update sonar.yml #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 소나클라우드 분석 | |
on: | |
push: | |
branches: [ dev ] | |
pull_request: | |
branches: [ dev ] | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
name: 빌드 및 분석 | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis:7.4.2 | |
ports: | |
- 6379:6379 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: JDK 17 설정 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
- name: SonarCloud 패키지 캐시 | |
uses: actions/cache@v3 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Gradle 패키지 캐시 | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: ${{ runner.os }}-gradle | |
- name: 빌드 및 분석 실행 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./gradlew build jacocoTestReport sonar --info --stacktrace | |
# 테스트 결과 저장 (테스트 실패해도 실행) | |
- name: 테스트 결과 저장 | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: | | |
build/reports/tests/test/ | |
build/reports/jacoco/test/html/ |