From 8b2d47327d3a448e7eebdad150932082ba338957 Mon Sep 17 00:00:00 2001 From: can019 Date: Sat, 5 Oct 2024 19:52:37 +0900 Subject: [PATCH 01/18] =?UTF-8?q?feat:=20Github=20metadata=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=EB=A5=BC=20ext=EC=97=90=20=EC=A0=80=EC=9E=A5=ED=95=98?= =?UTF-8?q?=EB=8A=94=20gradle=20task=20-=20Release=20version,=20commit=20i?= =?UTF-8?q?d=EB=A5=BC=20=EC=9E=85=EB=A0=A5=EB=B0=9B=EC=9D=8C=20-=20?= =?UTF-8?q?=EB=91=98=20=EC=A4=91=20=ED=95=98=EB=82=98=EB=9D=BC=EB=8F=84=20?= =?UTF-8?q?=EC=A0=9C=EA=B3=B5=EB=B0=9B=EC=A7=80=20=EB=AA=BB=ED=95=98?= =?UTF-8?q?=EB=A9=B4=20GradleException=20=EB=B0=9C=EC=83=9D=20-=20Test=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 3 + build.gradle | 1 + buildSrc/build.gradle | 31 ++++++++ .../GitHubPageResourceGeneratorTask.java | 20 +++++ .../base/gradle/github/GitHubPagesPlugin.java | 12 +++ .../github/RegisterGitHubMetadataTask.java | 23 ++++++ .../RegisterGithubMetadataTaskTest.java | 73 +++++++++++++++++++ 7 files changed, 163 insertions(+) create mode 100644 buildSrc/build.gradle create mode 100644 buildSrc/src/main/java/com/github/can019/base/gradle/github/GitHubPageResourceGeneratorTask.java create mode 100644 buildSrc/src/main/java/com/github/can019/base/gradle/github/GitHubPagesPlugin.java create mode 100644 buildSrc/src/main/java/com/github/can019/base/gradle/github/RegisterGitHubMetadataTask.java create mode 100644 buildSrc/src/test/java/com/github/can019/base/gradle/github/RegisterGithubMetadataTaskTest.java diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1ab168..20a4059 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,9 @@ jobs: cache-read-only: false cache-encryption-key: ${{ secrets.GradleEncryptionKey }} + - name: Test gradle buildSrc srcipts + run: gradle :buildSrc:test --configuration-cache --info + - name: Build run: gradle build -x check --configuration-cache --info diff --git a/build.gradle b/build.gradle index f79f320..d4b860b 100644 --- a/build.gradle +++ b/build.gradle @@ -5,6 +5,7 @@ plugins { id 'org.sonarqube' id "org.asciidoctor.jvm.convert" id 'com.epages.restdocs-api-spec' + id 'com.github.can019.base.github-pages' } //apply from: 'gradle/jacoco.gradle' diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 0000000..f3ec13c --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,31 @@ +plugins { + id 'java' + id 'java-gradle-plugin' +} + +group = 'com.github.can019.base' +version = '0.3.0-SNAPSHOT' + +repositories { + mavenCentral() +} + +dependencies { + testImplementation platform('org.junit:junit-bom:5.10.0') + testImplementation 'org.junit.jupiter:junit-jupiter' + implementation 'net.datafaker:datafaker:2.3.1' + testImplementation "org.assertj:assertj-core:3.26.3" +} + +gradlePlugin { + plugins { + githubPagesPlugin { + id = 'com.github.can019.base.github-pages' + implementationClass = 'com.github.can019.base.gradle.github.GitHubPagesPlugin' + } + } +} + +test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/buildSrc/src/main/java/com/github/can019/base/gradle/github/GitHubPageResourceGeneratorTask.java b/buildSrc/src/main/java/com/github/can019/base/gradle/github/GitHubPageResourceGeneratorTask.java new file mode 100644 index 0000000..bebdc93 --- /dev/null +++ b/buildSrc/src/main/java/com/github/can019/base/gradle/github/GitHubPageResourceGeneratorTask.java @@ -0,0 +1,20 @@ +package com.github.can019.base.gradle.github; + +import org.gradle.api.DefaultTask; +import org.gradle.api.tasks.TaskAction; + +public class GitHubPageResourceGeneratorTask extends DefaultTask { + + public GitHubPageResourceGeneratorTask() { + setDescription("Generates all resources for GitHub Pages"); + setGroup("GitHub Pages"); + + // 의존성 설정 + dependsOn("registerGitHubMetadata"); + } + + @TaskAction + public void generateResources() { + getLogger().lifecycle("Generating all resources for GitHub Pages..."); + } +} \ No newline at end of file diff --git a/buildSrc/src/main/java/com/github/can019/base/gradle/github/GitHubPagesPlugin.java b/buildSrc/src/main/java/com/github/can019/base/gradle/github/GitHubPagesPlugin.java new file mode 100644 index 0000000..22adf27 --- /dev/null +++ b/buildSrc/src/main/java/com/github/can019/base/gradle/github/GitHubPagesPlugin.java @@ -0,0 +1,12 @@ +package com.github.can019.base.gradle.github; + +import org.gradle.api.Plugin; +import org.gradle.api.Project; + +public class GitHubPagesPlugin implements Plugin{ + @Override + public void apply(Project target) { + target.getTasks().register("generateGitHubPageResources", GitHubPageResourceGeneratorTask.class); + target.getTasks().register("registerGitHubMetadata", RegisterGitHubMetadataTask.class); + } +} diff --git a/buildSrc/src/main/java/com/github/can019/base/gradle/github/RegisterGitHubMetadataTask.java b/buildSrc/src/main/java/com/github/can019/base/gradle/github/RegisterGitHubMetadataTask.java new file mode 100644 index 0000000..4311ac6 --- /dev/null +++ b/buildSrc/src/main/java/com/github/can019/base/gradle/github/RegisterGitHubMetadataTask.java @@ -0,0 +1,23 @@ +package com.github.can019.base.gradle.github; + +import org.gradle.api.DefaultTask; +import org.gradle.api.GradleException; +import org.gradle.api.tasks.TaskAction; + +public class RegisterGitHubMetadataTask extends DefaultTask{ + @TaskAction + public void registerMetadata() { + String commitId = (String) getProject().findProperty("commitId"); + String releaseVersion = (String) getProject().findProperty("releaseVersion"); + + if (commitId == null || releaseVersion == null) { + throw new GradleException("Commit id 또는 release version이 없습니다"); + } + + getProject().getExtensions().getExtraProperties().set("commitId", commitId); + getProject().getExtensions().getExtraProperties().set("releaseVersion", releaseVersion); + + getLogger().lifecycle("Commit id stored: " + commitId); + getLogger().lifecycle("Release version stored: " + releaseVersion); + } +} diff --git a/buildSrc/src/test/java/com/github/can019/base/gradle/github/RegisterGithubMetadataTaskTest.java b/buildSrc/src/test/java/com/github/can019/base/gradle/github/RegisterGithubMetadataTaskTest.java new file mode 100644 index 0000000..7fb80ed --- /dev/null +++ b/buildSrc/src/test/java/com/github/can019/base/gradle/github/RegisterGithubMetadataTaskTest.java @@ -0,0 +1,73 @@ +package com.github.can019.base.gradle.github; + +import org.gradle.api.GradleException; +import org.gradle.api.Project; +import org.gradle.testfixtures.ProjectBuilder; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import net.datafaker.Faker; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +class RegisterGitHubMetadataTaskTest { + private Project project; + private RegisterGitHubMetadataTask task; + + private Faker faker = new Faker(); + + @BeforeEach + public void setUp() { + project = ProjectBuilder.builder().build(); + + project.getExtensions().getExtraProperties().set("commitId", null); + project.getExtensions().getExtraProperties().set("releaseVersion", null); + + task = project.getTasks().create("registerGitHubMetadata", RegisterGitHubMetadataTask.class); + } + + @Test + @DisplayName("Commit id와 release version이 정상적으로 등록되어야 한다") + public void testRegisterMetadata() { + String commitId = faker.code().ean8(); + project.getExtensions().getExtraProperties().set("commitId", commitId); + + String releaseVersion = faker.app().version(); + project.getExtensions().getExtraProperties().set("releaseVersion", releaseVersion); + + task.registerMetadata(); + + System.out.println(commitId); + System.out.println(releaseVersion); + + + assertThat(commitId).isEqualTo( project.getExtensions().getExtraProperties().get("commitId")); + assertThat(releaseVersion).isEqualTo(project.getExtensions().getExtraProperties().get("releaseVersion")); + } + + @Test + @DisplayName("Commit id가 null인 경우 오류가 발생해야한다") + public void testRegisterMetadataWithoutCommitId() { + String releaseVersion = faker.app().version(); + project.getExtensions().getExtraProperties().set("releaseVersion", releaseVersion); + + project.getExtensions().getExtraProperties().set("commitId", null); + + assertThatThrownBy(()-> task.registerMetadata()) + .isInstanceOf(GradleException.class) + .hasMessage("Commit id 또는 release version이 없습니다"); + } + + @Test + @DisplayName("Release version이 null인 경우 오류가 발생해야한다") + public void testRegisterMetadataWithoutReleaseVersion() { + String commitId = faker.code().ean8(); + project.getExtensions().getExtraProperties().set("commitId", commitId); + project.getExtensions().getExtraProperties().set("releaseVersion", null); + + assertThatThrownBy(()-> task.registerMetadata()) + .isInstanceOf(GradleException.class) + .hasMessage("Commit id 또는 release version이 없습니다"); + } +} From 7f946fe8a25783df8d81b6deb0908bfe4bd47a81 Mon Sep 17 00:00:00 2001 From: can019 Date: Sun, 6 Oct 2024 01:45:59 +0900 Subject: [PATCH 02/18] =?UTF-8?q?refactor:=20JunitReport=20copy=20task?= =?UTF-8?q?=EB=A5=BC=20aggregateJunitTestReports=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20-=20=EA=B8=B0=EC=A1=B4=20copy=20task=EB=8A=94=20dep?= =?UTF-8?q?recate=20-=20rootDir/build/reports/tests=EC=97=90=20index.html?= =?UTF-8?q?=EA=B3=BC=20xml/**.xml=20=EC=9C=84=EC=B9=98=20-=20xml=EC=9D=98?= =?UTF-8?q?=20=EA=B2=BD=EC=9A=B0=20module=EC=9D=98=20dir=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=EC=9D=84=20=EB=B6=99=EC=97=AC=20=EC=A4=91=EB=B3=B5=20?= =?UTF-8?q?=EB=B0=A9=EC=A7=80=20-=20github=20workflow=EB=8A=94=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9=EB=90=98=EC=A7=80=20=EC=95=8A=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 54 ++++++++++++++++++++++++---------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/build.gradle b/build.gradle index d4b860b..5a2dba1 100644 --- a/build.gradle +++ b/build.gradle @@ -146,7 +146,6 @@ subprojects { property 'sonar.java.binaries', "${buildDir}/classes" } } - } sonar { @@ -163,49 +162,46 @@ sonar { } } -tasks.register('copyJunitXmlResults', Copy) { +tasks.register('copyOpenApi3Results',Copy) { subprojects.each { subproject -> - def xmlTestResultsDir = file("${subproject.buildDir}/test-results/test") + def openApi3ResultsDir = file("${subproject.buildDir}/api-spec/") - if (xmlTestResultsDir.exists()) { - from(xmlTestResultsDir) { + if (openApi3ResultsDir.exists()) { + from(openApi3ResultsDir) { into "${subproject.name}" } } else { - logger.info("No test result xml in submodule [${subproject.name}]") + logger.info("No openapi3 file in submodule [${subproject.name}]") } } - into "$buildDir/test-results" // 병합된 결과를 저장할 위치 + into "$buildDir/api-spec" // 병합된 결과를 저장할 +} +tasks.register('aggregateJunitHtmlReports', TestReport){ + destinationDirectory = file("$buildDir/reports/tests") + reportOn subprojects*.test } -tasks.register('copyJunitHtmlResults', Copy) { - subprojects.each { subproject -> - def htmlTestResultsDir = file("${subproject.buildDir}/reports/tests") +tasks.register('aggregateJunitXmlReports', TestReport){ + def xmlReportDir = file("$buildDir/reports/tests/xml") + xmlReportDir.mkdirs() - if (htmlTestResultsDir.exists()) { - from(htmlTestResultsDir) { - into "${subproject.name}" + subprojects.each { subproject -> + copy { + from subproject.test.reports.junitXml.outputLocation + into xmlReportDir + include "**/*.xml" + // Rename files to avoid conflicts + rename { String fileName -> + def projectPath = subproject.path.substring(1).replace(':', '-') + "${projectPath}-${fileName}" } - } else { - logger.info("No test result xml in submodule [${subproject.name}]") } } - into "$buildDir/reports/submodule/tests" // 병합된 결과를 저장할 위치 } -tasks.register('copyOpenApi3Results',Copy) { - subprojects.each { subproject -> - def openApi3ResultsDir = file("${subproject.buildDir}/api-spec/") - - if (openApi3ResultsDir.exists()) { - from(openApi3ResultsDir) { - into "${subproject.name}" - } - } else { - logger.info("No openapi3 file in submodule [${subproject.name}]") - } - } - into "$buildDir/api-spec" // 병합된 결과를 저장할 +tasks.register('aggregateJunitTestReports', TestReport) { + dependsOn(aggregateJunitHtmlReports) + dependsOn(aggregateJunitXmlReports) } bootJar.enabled = false \ No newline at end of file From 54c0282fd2382cd2093bacee5e02a3dbe783d626 Mon Sep 17 00:00:00 2001 From: can019 Date: Sun, 6 Oct 2024 01:52:42 +0900 Subject: [PATCH 03/18] =?UTF-8?q?chore:=20Copy=20junit=20reports=20->=20ag?= =?UTF-8?q?gregate=20junit=20reports=EB=A5=BC=20workflow=EC=97=90=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20a4059..390148b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,9 +61,7 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: Collect test reports - run: | - gradle copyJunitHtmlResults --configuration-cache - gradle copyJunitXmlResults --configuration-cache + run: gradle aggregateJunitTestReports --configuration-cache - name: Save test reports uses: actions/upload-artifact@v4 @@ -71,7 +69,6 @@ jobs: name: reports path: | build/reports - build/test-results build/api-spec build/docs support/jacoco/reports @@ -105,19 +102,19 @@ jobs: - name: publish core test results uses: EnricoMi/publish-unit-test-result-action@v2 with: - files: './build/test-results/core/TEST-*.xml' + files: './build/reports/tests/xml/core-*.xml' check_name: 'Core' - name: publish api test results uses: EnricoMi/publish-unit-test-result-action@v2 with: - files: './build/test-results/api/TEST-*.xml' + files: './build/reports/tests/xml/api-*.xml' check_name: 'Api' - name: publish admin test results uses: EnricoMi/publish-unit-test-result-action@v2 with: - files: './build/test-results/admin/TEST-*.xml' + files: './build/reports/tests/xml/admin-*.xml' check_name: 'Admin' set-github-pages-resource: From 5226aae47ecc807c33ba6df43e9f51dd51e5ef85 Mon Sep 17 00:00:00 2001 From: can019 Date: Sun, 6 Oct 2024 02:05:18 +0900 Subject: [PATCH 04/18] =?UTF-8?q?fix:=20Reports=20upload=EC=8B=9C=20config?= =?UTF-8?q?uration-cache=20=EC=A0=9C=EC=99=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 390148b..176c051 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,6 +70,7 @@ jobs: path: | build/reports build/api-spec + !build/reports/configuration-cache build/docs support/jacoco/reports From dcb74a2a85673081ad128382deaa44c0c0d1b5d2 Mon Sep 17 00:00:00 2001 From: can019 Date: Sun, 6 Oct 2024 02:12:37 +0900 Subject: [PATCH 05/18] =?UTF-8?q?chore:=20Collect=20test=20reports=20?= =?UTF-8?q?=ED=9B=84=20dir=20=ED=99=95=EC=9D=B8=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EC=9E=84=EC=8B=9C=20=EC=BD=94=EB=93=9C=20ci=EC=97=90=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 176c051..109442f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,9 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: Collect test reports - run: gradle aggregateJunitTestReports --configuration-cache + run: | + gradle aggregateJunitTestReports --configuration-cache + ls build/reports/tests - name: Save test reports uses: actions/upload-artifact@v4 From 6ff791e62bc3ff12a49ed42ee6106ac860297248 Mon Sep 17 00:00:00 2001 From: can019 Date: Sun, 6 Oct 2024 02:24:30 +0900 Subject: [PATCH 06/18] =?UTF-8?q?refactor:=20Collect=20test=20report?= =?UTF-8?q?=EB=A5=BC=20test=20=EC=9D=B4=20=ED=9B=84=20=EB=B0=94=EB=A1=9C?= =?UTF-8?q?=20=EC=A7=84=ED=96=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 109442f..737328a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,11 @@ jobs: run: gradle test --configuration-cache --info continue-on-error: true + - name: Collect test reports + run: | + gradle aggregateJunitTestReports --configuration-cache + ls build/reports/tests + - name: Generate jacoco report run: gradle testCodeCoverageReport -x check --info --configuration-cache @@ -60,11 +65,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - name: Collect test reports - run: | - gradle aggregateJunitTestReports --configuration-cache - ls build/reports/tests - - name: Save test reports uses: actions/upload-artifact@v4 with: From 0503ef7c4495630a610c932cd246b9826442c56d Mon Sep 17 00:00:00 2001 From: can019 Date: Sun, 6 Oct 2024 02:30:42 +0900 Subject: [PATCH 07/18] =?UTF-8?q?chore:=20Aggregate=20xml,=20html=20task?= =?UTF-8?q?=EB=A5=BC=20=EA=B0=81=EA=B0=81=20=EC=8B=A4=ED=96=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 737328a..7774778 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,8 @@ jobs: - name: Collect test reports run: | - gradle aggregateJunitTestReports --configuration-cache + gradle aggregateJunitXmlReports --configuration-cache --info + gradle aggregateJunitHtmlReports --configuration-cache --info ls build/reports/tests - name: Generate jacoco report From 9e7aab71290b9a3b5f2f71883112108f6a33a5b4 Mon Sep 17 00:00:00 2001 From: can019 Date: Sun, 6 Oct 2024 02:47:10 +0900 Subject: [PATCH 08/18] =?UTF-8?q?fix:=20Xml=20report=20aggregate=20?= =?UTF-8?q?=EC=8B=9C=20NO-SOURCE=EA=B0=80=20=EB=B0=9C=EC=83=9D=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8F=84=EB=A1=9D=20=EC=A1=B0=EC=A0=95=20?= =?UTF-8?q?-=20test-reports=EA=B0=80=20=EC=97=86=EB=8A=94=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=EA=B0=80=20=ED=95=98=EB=82=98=EB=9D=BC=EB=8F=84=20?= =?UTF-8?q?=EC=9E=88=EB=8A=94=20=EA=B2=BD=EC=9A=B0=20gradle=EC=9D=B4=20?= =?UTF-8?q?=ED=95=B4=EB=8B=B9=20test=EB=A5=BC=20=EC=88=98=ED=96=89?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EC=95=8A=EA=B2=A0=EB=8B=A4=EA=B3=A0=20?= =?UTF-8?q?=ED=8C=90=EB=8B=A8=20-=20exists=20=EC=97=AC=EB=B6=80=EC=97=90?= =?UTF-8?q?=20=EB=94=B0=EB=9D=BC=20=EC=88=98=ED=96=89=EB=90=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 3 +-- build.gradle | 39 +++++++++++++++++++++++++++++++-------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7774778..eeef4a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,8 +45,7 @@ jobs: - name: Collect test reports run: | - gradle aggregateJunitXmlReports --configuration-cache --info - gradle aggregateJunitHtmlReports --configuration-cache --info + gradle aggregateJunitTestReports --configuration-cache --info ls build/reports/tests - name: Generate jacoco report diff --git a/build.gradle b/build.gradle index 5a2dba1..c8bf1b0 100644 --- a/build.gradle +++ b/build.gradle @@ -186,17 +186,40 @@ tasks.register('aggregateJunitXmlReports', TestReport){ xmlReportDir.mkdirs() subprojects.each { subproject -> - copy { - from subproject.test.reports.junitXml.outputLocation - into xmlReportDir - include "**/*.xml" - // Rename files to avoid conflicts - rename { String fileName -> - def projectPath = subproject.path.substring(1).replace(':', '-') - "${projectPath}-${fileName}" + def testResultDir = subproject.file("${subproject.buildDir}/test-results/test") + + if (testResultDir.exists()) { + copy { + from subproject.test.reports.junitXml.outputLocation + into xmlReportDir + include "**/*.xml" + // Rename files to avoid conflicts + rename { String fileName -> + def projectPath = subproject.path.substring(1).replace(':', '-') + "${projectPath}-${fileName}" + } } + } else { + logger.lifecycle("Skipping ${subproject.path}: No test results found.") } } + + +// def xmlReportDir = file("$buildDir/reports/tests/xml") +// xmlReportDir.mkdirs() +// +// subprojects.each { subproject -> +// copy { +// from subproject.test.reports.junitXml.outputLocation +// into xmlReportDir +// include "**/*.xml" +// // Rename files to avoid conflicts +// rename { String fileName -> +// def projectPath = subproject.path.substring(1).replace(':', '-') +// "${projectPath}-${fileName}" +// } +// } +// } } tasks.register('aggregateJunitTestReports', TestReport) { From 80a4af6d90e1c8527047211c776e9c75384acbb9 Mon Sep 17 00:00:00 2001 From: can019 Date: Sun, 6 Oct 2024 02:55:36 +0900 Subject: [PATCH 09/18] =?UTF-8?q?chore:=20Xml=20report=20test=EB=A7=8C=20?= =?UTF-8?q?=EC=9E=84=EC=8B=9C=EB=A1=9C=20=EB=AA=85=EC=8B=9C=ED=95=98?= =?UTF-8?q?=EC=97=AC=20workflow=EC=97=90=EC=84=9C=20=EC=8B=A4=ED=96=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eeef4a3..6d2de2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: - name: Collect test reports run: | - gradle aggregateJunitTestReports --configuration-cache --info + gradle aggregateJunitXmlReports --configuration-cache ls build/reports/tests - name: Generate jacoco report From d1ad311924980d77b064330b07353021c370358d Mon Sep 17 00:00:00 2001 From: can019 Date: Sun, 6 Oct 2024 02:59:04 +0900 Subject: [PATCH 10/18] chore: Debug aggregateReport workflow --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d2de2c..ffbcf18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,6 +47,8 @@ jobs: run: | gradle aggregateJunitXmlReports --configuration-cache ls build/reports/tests + gradle aggregateJunitHtmlReports --configuration-cache + ls build/reports/tests - name: Generate jacoco report run: gradle testCodeCoverageReport -x check --info --configuration-cache From 3646daa654878739672605e075fc36c41319f822 Mon Sep 17 00:00:00 2001 From: can019 Date: Sun, 6 Oct 2024 03:03:57 +0900 Subject: [PATCH 11/18] =?UTF-8?q?chore:=20Aggregate=20junit=20report?= =?UTF-8?q?=EC=97=90=20configure=20cache=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffbcf18..d01168f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,9 +45,9 @@ jobs: - name: Collect test reports run: | - gradle aggregateJunitXmlReports --configuration-cache + gradle aggregateJunitXmlReports ls build/reports/tests - gradle aggregateJunitHtmlReports --configuration-cache + gradle aggregateJunitHtmlReports ls build/reports/tests - name: Generate jacoco report From 7fc28769ae80cd8259397ae962b97271122df282 Mon Sep 17 00:00:00 2001 From: can019 Date: Sun, 6 Oct 2024 03:07:29 +0900 Subject: [PATCH 12/18] =?UTF-8?q?test:=20XmlReport=EA=B0=80=20htmlReport?= =?UTF-8?q?=EB=B3=B4=EB=8B=A4=20=EB=8A=A6=EA=B2=8C=20=EC=8B=A4=ED=96=89?= =?UTF-8?q?=EB=90=98=EA=B2=8C=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d01168f..ba6fa0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,10 +45,10 @@ jobs: - name: Collect test reports run: | - gradle aggregateJunitXmlReports - ls build/reports/tests gradle aggregateJunitHtmlReports ls build/reports/tests + gradle aggregateJunitXmlReports + ls build/reports/tests - name: Generate jacoco report run: gradle testCodeCoverageReport -x check --info --configuration-cache From be61bbee36f0768e68112ba0b259cd93d4326128 Mon Sep 17 00:00:00 2001 From: can019 Date: Sun, 6 Oct 2024 03:12:37 +0900 Subject: [PATCH 13/18] =?UTF-8?q?refactor:=20AggregateJunitXmlReport?= =?UTF-8?q?=EB=A5=BC=20copy=20task=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20-=20Tes?= =?UTF-8?q?tReport=20type=EC=9D=80=20configure=20cache=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9=20=EC=8B=9C=20=ED=95=B4=EB=8B=B9=20task=EA=B0=80=20?= =?UTF-8?q?=EC=88=98=ED=96=89=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=EA=B0=80=20=EC=83=9D=EA=B8=B8=20=EC=88=98=20?= =?UTF-8?q?=EC=9E=88=EA=B8=B0=20=EB=95=8C=EB=AC=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index c8bf1b0..652dc87 100644 --- a/build.gradle +++ b/build.gradle @@ -181,7 +181,7 @@ tasks.register('aggregateJunitHtmlReports', TestReport){ reportOn subprojects*.test } -tasks.register('aggregateJunitXmlReports', TestReport){ +tasks.register('aggregateJunitXmlReports', Copy){ def xmlReportDir = file("$buildDir/reports/tests/xml") xmlReportDir.mkdirs() @@ -203,23 +203,6 @@ tasks.register('aggregateJunitXmlReports', TestReport){ logger.lifecycle("Skipping ${subproject.path}: No test results found.") } } - - -// def xmlReportDir = file("$buildDir/reports/tests/xml") -// xmlReportDir.mkdirs() -// -// subprojects.each { subproject -> -// copy { -// from subproject.test.reports.junitXml.outputLocation -// into xmlReportDir -// include "**/*.xml" -// // Rename files to avoid conflicts -// rename { String fileName -> -// def projectPath = subproject.path.substring(1).replace(':', '-') -// "${projectPath}-${fileName}" -// } -// } -// } } tasks.register('aggregateJunitTestReports', TestReport) { From ebbff765dfedd722f2698b97953a73b231524d52 Mon Sep 17 00:00:00 2001 From: can019 Date: Sun, 6 Oct 2024 03:18:03 +0900 Subject: [PATCH 14/18] =?UTF-8?q?fix:=20Junit=20xml=20report=20aggregation?= =?UTF-8?q?=EC=9D=B4=20html=20aggregation=EB=B3=B4=EB=8B=A4=20=EB=A8=BC?= =?UTF-8?q?=EC=A0=80=20=EC=9E=91=EB=8F=99=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EB=AA=85=EC=8B=9C=20-=20Junit=20html=20report=EA=B0=80=20?= =?UTF-8?q?=EB=82=98=EC=A4=91=EC=97=90=20=EC=8B=A4=ED=96=89=EB=90=98?= =?UTF-8?q?=EB=A9=B4=20xml=20dir=EA=B0=80=20=EC=82=AD=EC=A0=9C=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=EB=AC=B8=EC=A0=9C=EA=B0=80=20=EB=B0=9C=EC=83=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 4 +--- build.gradle | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba6fa0f..f30aadd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,9 +45,7 @@ jobs: - name: Collect test reports run: | - gradle aggregateJunitHtmlReports - ls build/reports/tests - gradle aggregateJunitXmlReports + gradle aggregateJunitTestReports ls build/reports/tests - name: Generate jacoco report diff --git a/build.gradle b/build.gradle index 652dc87..b377757 100644 --- a/build.gradle +++ b/build.gradle @@ -206,6 +206,7 @@ tasks.register('aggregateJunitXmlReports', Copy){ } tasks.register('aggregateJunitTestReports', TestReport) { + aggregateJunitXmlReports.mustRunAfter(aggregateJunitHtmlReports) dependsOn(aggregateJunitHtmlReports) dependsOn(aggregateJunitXmlReports) } From 0533e761d46ead1f0d32d4e5c76073a68266850f Mon Sep 17 00:00:00 2001 From: can019 Date: Sun, 6 Oct 2024 03:29:38 +0900 Subject: [PATCH 15/18] =?UTF-8?q?fix:=20=EC=9E=84=EC=8B=9C=EB=A1=9C=20aggr?= =?UTF-8?q?egateJunitXmlReport=EA=B0=80=20=EA=B0=95=EC=A0=9C=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=ED=96=89=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index b377757..7b935b7 100644 --- a/build.gradle +++ b/build.gradle @@ -182,6 +182,7 @@ tasks.register('aggregateJunitHtmlReports', TestReport){ } tasks.register('aggregateJunitXmlReports', Copy){ + onlyIf { true } def xmlReportDir = file("$buildDir/reports/tests/xml") xmlReportDir.mkdirs() From 0522aa9fa6b51070020fe96c0a96486ab81a951a Mon Sep 17 00:00:00 2001 From: can019 Date: Sun, 6 Oct 2024 03:35:25 +0900 Subject: [PATCH 16/18] =?UTF-8?q?chore:=20Junit=20xml,=20html=20aggregate?= =?UTF-8?q?=20task=EB=A5=BC=20=EA=B0=81=EA=B0=81=20=EC=8B=A4=ED=96=89?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=ED=95=A8=20-=20aggregateJunitTes?= =?UTF-8?q?tReports=EB=A1=9C=20=EB=AC=B6=EC=96=B4=20=EC=8B=A4=ED=96=89=20?= =?UTF-8?q?=EC=8B=9C=20=EC=A7=80=EC=86=8D=EC=A0=81=EC=9C=BC=EB=A1=9C=20NO-?= =?UTF-8?q?SOURCE=20=EB=B0=9C=EC=83=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 3 ++- build.gradle | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f30aadd..d89d5e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,8 @@ jobs: - name: Collect test reports run: | - gradle aggregateJunitTestReports + gradle aggregateJunitHtmlReports + gradle aggregateJunitXmlReports ls build/reports/tests - name: Generate jacoco report diff --git a/build.gradle b/build.gradle index 7b935b7..dca15e7 100644 --- a/build.gradle +++ b/build.gradle @@ -207,6 +207,7 @@ tasks.register('aggregateJunitXmlReports', Copy){ } tasks.register('aggregateJunitTestReports', TestReport) { + // aggregateJunitXmlReports가 계속 no source로 됨 aggregateJunitXmlReports.mustRunAfter(aggregateJunitHtmlReports) dependsOn(aggregateJunitHtmlReports) dependsOn(aggregateJunitXmlReports) From c093d2032eca1076062d7639187c91a711494ead Mon Sep 17 00:00:00 2001 From: can019 Date: Thu, 10 Oct 2024 22:40:49 +0900 Subject: [PATCH 17/18] =?UTF-8?q?chore:=20buildSrc=20gradle=EC=97=90=20lom?= =?UTF-8?q?bok,=20java=20version=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/build.gradle | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index f3ec13c..c0874f9 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -10,11 +10,18 @@ repositories { mavenCentral() } +java{ + sourceCompatibility = '21' +} + dependencies { testImplementation platform('org.junit:junit-bom:5.10.0') testImplementation 'org.junit.jupiter:junit-jupiter' implementation 'net.datafaker:datafaker:2.3.1' testImplementation "org.assertj:assertj-core:3.26.3" + + compileOnly 'org.projectlombok:lombok:1.18.32' + annotationProcessor 'org.projectlombok:lombok:1.18.32' } gradlePlugin { From cba1e76aa7d224f3812561561e3c551f578899c1 Mon Sep 17 00:00:00 2001 From: can019 Date: Fri, 11 Oct 2024 12:55:19 +0900 Subject: [PATCH 18/18] =?UTF-8?q?chore:=20Github=20pages=20configure=20str?= =?UTF-8?q?ucture=20=EC=A0=95=EC=9D=98=20-=20File=20tree=20=EA=B5=AC?= =?UTF-8?q?=EC=84=B1=20=EC=A4=91=20-=20MetaData=EB=A5=BC=20field=EB=A1=9C?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../github/configure/GitHubPageConfigure.java | 24 +++++++++++++++++++ .../gradle/github/structure/FileTree.java | 4 ++++ 2 files changed, 28 insertions(+) create mode 100644 buildSrc/src/main/java/com/github/can019/base/gradle/github/configure/GitHubPageConfigure.java create mode 100644 buildSrc/src/main/java/com/github/can019/base/gradle/github/structure/FileTree.java diff --git a/buildSrc/src/main/java/com/github/can019/base/gradle/github/configure/GitHubPageConfigure.java b/buildSrc/src/main/java/com/github/can019/base/gradle/github/configure/GitHubPageConfigure.java new file mode 100644 index 0000000..3cd4fc5 --- /dev/null +++ b/buildSrc/src/main/java/com/github/can019/base/gradle/github/configure/GitHubPageConfigure.java @@ -0,0 +1,24 @@ +package com.github.can019.base.gradle.github.configure; + +import lombok.Getter; + +@Getter +public class GitHubPageConfigure { + private MetaData metaData; + private GithubPageFileTree githubPageFileTree; +} + +@Getter +class MetaData { + private String releaseVersion; + private String commitId; +} + +class GithubPageFileTree{ + private String markUpFileName; + private String rootDirPath; + + public String getRootMarkUpFilePath() { + return String.join("/", rootDirPath, markUpFileName); + } +} \ No newline at end of file diff --git a/buildSrc/src/main/java/com/github/can019/base/gradle/github/structure/FileTree.java b/buildSrc/src/main/java/com/github/can019/base/gradle/github/structure/FileTree.java new file mode 100644 index 0000000..282dd22 --- /dev/null +++ b/buildSrc/src/main/java/com/github/can019/base/gradle/github/structure/FileTree.java @@ -0,0 +1,4 @@ +package com.github.can019.base.gradle.github.structure; + +public interface FileTree { +}