From 3acea17ff8b38ce523683b0d0a46d47d9dc1aaec Mon Sep 17 00:00:00 2001 From: swthewhite Date: Fri, 12 Dec 2025 18:29:26 +0900 Subject: [PATCH 1/3] =?UTF-8?q?chore/#26:=20CI=20Workflow=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/integrate.yml | 88 +++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/integrate.yml diff --git a/.github/workflows/integrate.yml b/.github/workflows/integrate.yml new file mode 100644 index 0000000..e62b40c --- /dev/null +++ b/.github/workflows/integrate.yml @@ -0,0 +1,88 @@ +# ============================================================================ +# Worker Integration Workflow +# ============================================================================ +# 역할: +# - 소스 코드 포맷 검사 (Spotless) +# - 소스 코드 정적 분석 (Checkstyle) +# - 테스트 수행 및 JaCoCo 커버리지 생성 +# - SonarCloud 코드 품질/커버리지/보안 분석 +# +# GitHub Secrets: +# - SONAR_TOKEN : SonarCloud Token +# +# GitHub Variables (Settings > Secrets and variables > Actions > Variables): +# - SONAR_ORGANIZATION : SonarCloud Organization Key +# - SONAR_PROJECT : SonarCloud Project Key +# - SONAR_HOST_URL : SonarCloud Host (https://sonarcloud.io) +# ============================================================================ + +name: Integrate Worker + +on: + pull_request: + branches: + - main + - develop + +env: + JAVA_VERSION: '17' + +jobs: + integrate: + name: Worker Integration Pipeline + runs-on: ubuntu-latest + + permissions: + contents: read + actions: write + checks: write + pull-requests: write + + steps: + - name: Checkout source + uses: actions/checkout@v4 + with: + fetch-depth: 0 # SonarCloud 분석을 위해 전체 히스토리 필요 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: temurin + cache: gradle + + - name: Grant execution to Gradle wrapper + run: chmod +x gradlew + + # - name: Run Spotless Check + # run: ./gradlew spotlessCheck + + # - name: Run Checkstyle + # run: ./gradlew checkstyleMain checkstyleTest + + - name: Run Tests with JaCoCo + run: ./gradlew test jacocoTestReport + + - name: SonarCloud Scan + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_ORGANIZATION: ${{ vars.SONAR_ORGANIZATION }} + SONAR_PROJECT: ${{ vars.SONAR_PROJECT }} + SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} + run: ./gradlew sonar -Dsonar.host.url=$SONAR_HOST_URL + + - name: Build Spring Boot JAR + run: ./gradlew bootJar + + - name: Upload Build Artifact + uses: actions/upload-artifact@v4 + with: + name: worker-app + path: build/libs/*.jar + + - name: Integration Summary + run: | + echo "## Worker Integration Summary" >> $GITHUB_STEP_SUMMARY + echo "- **Branch** : ${{ github.head_ref }}" >> $GITHUB_STEP_SUMMARY + echo "- **Commit** : ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY + echo "- **Status** : Build Successful" >> $GITHUB_STEP_SUMMARY From 8327297ccc140cbe948d9248a36be3d5558924cd Mon Sep 17 00:00:00 2001 From: swthewhite Date: Fri, 12 Dec 2025 20:17:24 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix/#26:=20gradlew=20=EB=B2=A0=EC=9D=B4?= =?UTF-8?q?=EC=8A=A4=20=EA=B2=BD=EB=A1=9C=20=EC=A7=80=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/integrate.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integrate.yml b/.github/workflows/integrate.yml index e62b40c..1682871 100644 --- a/.github/workflows/integrate.yml +++ b/.github/workflows/integrate.yml @@ -38,6 +38,10 @@ jobs: checks: write pull-requests: write + defaults: + run: + working-directory: slackjudge + steps: - name: Checkout source uses: actions/checkout@v4 @@ -50,6 +54,7 @@ jobs: java-version: ${{ env.JAVA_VERSION }} distribution: temurin cache: gradle + cache-dependency-path: slackjudge/*.gradle* - name: Grant execution to Gradle wrapper run: chmod +x gradlew @@ -78,7 +83,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: worker-app - path: build/libs/*.jar + path: slackjudge/build/libs/*.jar - name: Integration Summary run: | From e18b083b16181784f71792955a3ce8846c9ea852 Mon Sep 17 00:00:00 2001 From: swthewhite Date: Fri, 12 Dec 2025 20:59:14 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat/#26:=20build.gradle=EC=97=90=20jacoco/?= =?UTF-8?q?sonarqube=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- slackjudge/build.gradle | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/slackjudge/build.gradle b/slackjudge/build.gradle index 552c06f..675be27 100644 --- a/slackjudge/build.gradle +++ b/slackjudge/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java' id 'org.springframework.boot' version '3.4.0' id 'io.spring.dependency-management' version '1.1.6' + id 'jacoco' + id 'org.sonarqube' version '6.0.1.5171' } group = 'store.slackjudge' @@ -45,9 +47,34 @@ dependencies { testImplementation 'org.testcontainers:postgresql' // PostgreSQL 모듈 testImplementation "org.testcontainers:junit-jupiter" // JUnit 5 연동 testImplementation 'org.testcontainers:jdbc' - testImplementation 'de.flapdoodle.embed:de.flapdoodle.embed.mongo:4.11.0' + testImplementation 'org.testcontainers:mongodb' } tasks.named('test') { useJUnitPlatform() -} \ No newline at end of file + finalizedBy jacocoTestReport +} + +jacoco { + toolVersion = '0.8.12' +} + +jacocoTestReport { + dependsOn test + reports { + xml.required = true + html.required = true + } +} + +sonarqube { + properties { + property 'sonar.organization', System.getenv('SONAR_ORGANIZATION') ?: '' + property 'sonar.projectKey', System.getenv('SONAR_PROJECT') ?: '' + property 'sonar.projectName', 'slackjudge-worker' + property 'sonar.sources', 'src/main/java' + property 'sonar.tests', 'src/test/java' + property 'sonar.java.coveragePlugin', 'jacoco' + property 'sonar.coverage.jacoco.xmlReportPaths', 'build/reports/jacoco/test/jacocoTestReport.xml' + } +}