Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# ============================================================================
# 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

defaults:
run:
working-directory: slackjudge

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
cache-dependency-path: slackjudge/*.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: slackjudge/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
29 changes: 28 additions & 1 deletion slackjudge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -55,4 +57,29 @@ dependencies {

tasks.named('test') {
useJUnitPlatform()
}
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'
}
}
Loading