feat: 코드 정적 분석을 위한 Jacoco 및 SonarCloud 도입 #470
Workflow file for this run
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: 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() }) | ||
Check failure on line 61 in .github/workflows/ci-backend.yml GitHub Actions / Java CI with GradleInvalid workflow file
|
||
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 |