-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10a03b3
commit b16924a
Showing
76 changed files
with
1,887 additions
and
59 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: SonarCloud | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
jobs: | ||
build: | ||
name: Build and analyze | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 11 | ||
distribution: 'corretto' # Alternative distribution options are available | ||
- name: Cache SonarCloud packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.sonar/cache | ||
key: ${{ runner.os }}-sonar | ||
restore-keys: ${{ runner.os }}-sonar | ||
- 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 }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
run: ./gradlew build sonar --info -x :study:build |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
plugins { | ||
id "java" | ||
id "jacoco" | ||
id "org.sonarqube" version "4.2.1.3168" | ||
} | ||
|
||
subprojects { | ||
apply plugin: 'org.sonarqube' | ||
sonar { | ||
properties { | ||
property 'sonar.coverage.jacoco.xmlReportPaths', "$projectDir.parentFile.path/build/reports/jacoco/codeCoverageReport/codeCoverageReport.xml" | ||
} | ||
} | ||
|
||
tasks.withType(Test).configureEach { | ||
maxParallelForks 3 | ||
useJUnitPlatform() | ||
} | ||
} | ||
|
||
apply from: "$project.rootDir/sonar.gradle" | ||
|
||
// $ ./gradlew test codeCoverageReport | ||
tasks.register("codeCoverageReport", JacocoReport) { | ||
// If a subproject applies the 'jacoco' plugin, add the result it to the report | ||
subprojects { subproject -> | ||
subproject.plugins.withType(JacocoPlugin).configureEach { | ||
subproject.tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).configureEach { testTask -> | ||
//the jacoco extension may be disabled for some projects | ||
if (testTask.extensions.getByType(JacocoTaskExtension).isEnabled()) { | ||
sourceSets subproject.sourceSets.main | ||
executionData(testTask) | ||
} else { | ||
logger.warn('Jacoco extension is disabled for test task \'{}\' in project \'{}\'. this test task will be excluded from jacoco report.',testTask.getName(),subproject.getName()) | ||
} | ||
} | ||
|
||
subproject.tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).forEach { | ||
rootProject.tasks.codeCoverageReport.dependsOn(it) | ||
} | ||
} | ||
} | ||
|
||
// enable the different report types (html, xml, csv) | ||
reports { | ||
xml.required = true | ||
html.required = true | ||
html.outputLocation = layout.buildDirectory.dir('jacocoHtml') | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
rootProject.name = 'jwp-dashboard-mvc' | ||
|
||
include 'mvc' | ||
include 'app' | ||
include 'study' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apply plugin: "org.sonarqube" | ||
|
||
sonar { | ||
properties { | ||
property "sonar.projectKey", "woowacourse_jwp-dashboard-mvc" | ||
property "sonar.organization", "woowacourse" | ||
property "sonar.host.url", "https://sonarcloud.io" | ||
|
||
property "sonar.exclusions", "study/**" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
plugins { | ||
id "java" | ||
id "idea" | ||
} | ||
|
||
group "nextstep" | ||
version "1.0-SNAPSHOT" | ||
|
||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation "org.reflections:reflections:0.10.2" | ||
implementation "org.apache.tomcat.embed:tomcat-embed-core:10.1.13" | ||
implementation "org.apache.tomcat.embed:tomcat-embed-jasper:10.1.13" | ||
implementation "ch.qos.logback:logback-classic:1.2.12" | ||
implementation "org.apache.commons:commons-lang3:3.13.0" | ||
|
||
implementation "org.springframework:spring-context:5.3.29" | ||
|
||
testImplementation "org.assertj:assertj-core:3.24.2" | ||
testImplementation "org.mockito:mockito-core:5.4.0" | ||
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.7.2" | ||
testImplementation "org.junit.jupiter:junit-jupiter-api:5.7.2" | ||
testImplementation 'com.h2database:h2:2.2.220' | ||
} | ||
|
||
test { | ||
maxParallelForks 3 | ||
useJUnitPlatform() | ||
} | ||
|
||
idea { | ||
module { | ||
inheritOutputDirs = false | ||
outputDir file("src/main/webapp/WEB-INF/classes") | ||
} | ||
} | ||
|
||
sourceSets { | ||
main { | ||
java.outputDir = file('src/main/webapp/WEB-INF/classes') | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package ioc; | ||
|
||
import ioc.decoupled.ExchangeRateConfiguration; | ||
import ioc.decoupled.ExchangeRateRenderer; | ||
import ioc.decoupled.ExchangeRateSupportFactory; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.annotation.AnnotationConfigApplicationContext; | ||
import org.springframework.context.support.ClassPathXmlApplicationContext; | ||
|
||
public class IocApplication { | ||
public static void main(String[] args) { | ||
myIocContainer(); | ||
xmlApplicationContext(); | ||
annotationApplicationContext(); | ||
} | ||
|
||
private static void myIocContainer() { | ||
final ExchangeRateSupportFactory factory = ExchangeRateSupportFactory.getInstance(); | ||
final ExchangeRateRenderer renderer = factory.getExchangeRateRenderer(); | ||
renderer.render(); | ||
} | ||
|
||
private static void xmlApplicationContext() { | ||
final ApplicationContext context = new ClassPathXmlApplicationContext("exchange-rate-context.xml"); | ||
final ExchangeRateRenderer renderer = context.getBean("exchangeRateRenderer", ExchangeRateRenderer.class); | ||
renderer.render(); | ||
} | ||
|
||
private static void annotationApplicationContext() { | ||
final ApplicationContext context = new AnnotationConfigApplicationContext(ExchangeRateConfiguration.class); | ||
final ExchangeRateRenderer renderer = context.getBean("exchangeRateRenderer", ExchangeRateRenderer.class); | ||
renderer.render(); | ||
} | ||
} |
Oops, something went wrong.