Skip to content

Commit

Permalink
👷 Sonar Cloud 추가 (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
waterfogSW authored Sep 8, 2024
1 parent acce6b7 commit 7b743b0
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 1 deletion.
37 changes: 37 additions & 0 deletions .github/workflows/test_analyze.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test and Analyze
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
Test-And-Analyze:
name: Run unit test and static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: liberica
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build And analyze Http Server
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew test testCodeCoverageReport sonar --info
31 changes: 31 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,34 @@ subprojects {
useJUnitPlatform()
}
}

sonar {
properties {
property("sonar.projectKey", "Student-Center_3days-server")
property("sonar.organization", "student-center")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.java.coveragePlugin", "jacoco")
property("sonar.coverage.jacoco.xmlReportPaths", layout.projectDirectory.file("support/jacoco/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml"))
}
}


val allProjects = project.allprojects
.asSequence()
.filter { it.name != "3days-server" }
.filter { it.name != "support" }
.filter { it.name != "domain" }
.filter { it.name != "application" }
.filter { it.name != "infrastructure" }
.filter { it.name != "bootstrap" }
.toList()

project(":support:jacoco") {
apply(plugin = "jacoco-report-aggregation")

dependencies {
allProjects.forEach {
add("jacocoAggregation", project(it.path))
}
}
}
2 changes: 1 addition & 1 deletion openapi
Submodule openapi updated 1 files
+187 −119 openapi.yaml
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ rootProject.name = "3days-server"
include(":support:common")
project(":support:common").projectDir = file("support/common")

include(":support:jacoco")
project(":support:jacoco").projectDir = file("support/jacoco")

// domain
include(":domain")
project(":domain").projectDir = file("domain")
Expand Down
Empty file added support/jacoco/build.gradle.kts
Empty file.

0 comments on commit 7b743b0

Please sign in to comment.