Skip to content

feat: 코드 정적 분석을 위한 Jacoco 및 SonarCloud 도입 #471

feat: 코드 정적 분석을 위한 Jacoco 및 SonarCloud 도입

feat: 코드 정적 분석을 위한 Jacoco 및 SonarCloud 도입 #471

Workflow file for this run

name: Java CI with Gradle
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
env:
COVERAGE_PERCENT: 70
jobs:
test:
name: Code Quality Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Grant execute permisson 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
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: check
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
- 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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonar --info --stacktrace
- name: Upload Test Result
uses: EnricoMi/publish-unit-test-result-action@v2
if: ${{ always() }}
with:
files: build/test-results/**/*.xml
- name: Upload Test Coverage Result to PR
id: jacoco
uses: madrapps/[email protected]
with:
paths: ${{ github.workspace }}/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: ${{ env.COVERAGE_PERCENT }}
debug-mode: false
title: Code Coverage
update-comment: true