From 0747545fcd3b644f87dafb5ba1d43b71d31d58ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20C=2E=20R=C3=ADos?= Date: Thu, 7 Sep 2023 12:58:30 +0200 Subject: [PATCH] (2.3.x): Updating docs plugin and base image --- build.gradle | 35 ++++++++++++++++++++++++-- ci/images/spring-credhub-ci/Dockerfile | 9 ++++--- spring-credhub-docs/build.gradle | 33 +++++++++++------------- 3 files changed, 53 insertions(+), 24 deletions(-) diff --git a/build.gradle b/build.gradle index 6c60d4e..3019111 100644 --- a/build.gradle +++ b/build.gradle @@ -149,8 +149,39 @@ subprojects { testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") } - test { - useJUnitPlatform() + tasks.withType(Test).forEach { Test task -> + task.with { + // enable JUnit 5 + useJUnitPlatform() + scanForTestClasses = true + group = "verification" + + testLogging { + exceptionFormat = "full" + events = ["passed", "skipped", "failed"] + } + + // print failed tests after the execution + def failedTests = [] + afterTest { test, result -> + if (result.resultType == TestResult.ResultType.FAILURE) { + failedTests << test + } + } + + // create a summary after the execution + afterSuite { desc, result -> + if (!desc.parent) { + println "\nTest result: ${result.resultType}" + println "Test summary: ${result.testCount} tests, " + + "${result.successfulTestCount} succeeded, " + + "${result.failedTestCount} failed, " + + "${result.skippedTestCount} skipped" + + failedTests.each { test -> println "FAILED test: ${test.className} > ${test.name}" } + } + } + } } } diff --git a/ci/images/spring-credhub-ci/Dockerfile b/ci/images/spring-credhub-ci/Dockerfile index a6e7310..64ee2b6 100644 --- a/ci/images/spring-credhub-ci/Dockerfile +++ b/ci/images/spring-credhub-ci/Dockerfile @@ -1,4 +1,7 @@ -FROM harbor-repo.vmware.com/dockerhub-proxy-cache/library/ubuntu:bionic +FROM harbor-repo.vmware.com/dockerhub-proxy-cache/library/ubuntu:jammy + +ARG CONCOURSE_JAVA_SCRIPTS_VERSION=0.0.4 +ARG CONCOURSE_RELEASE_SCRIPTS_VERSION=0.3.4 RUN apt-get update && apt-get install --no-install-recommends -y ca-certificates net-tools git curl jq gnupg @@ -10,5 +13,5 @@ RUN mkdir -p /opt/openjdk && \ cd /opt/openjdk && \ curl -L https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u292b10.tar.gz | tar xz --strip-components=1 -ADD https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v0.0.4/concourse-java.sh /opt/ -ADD https://repo.spring.io/libs-snapshot/io/spring/concourse/releasescripts/concourse-release-scripts/0.3.4-SNAPSHOT/concourse-release-scripts-0.3.4-SNAPSHOT.jar /opt/ +ADD "https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v$CONCOURSE_JAVA_SCRIPTS_VERSION/concourse-java.sh" /opt/ +ADD "https://repo.spring.io/ui/native/snapshot/io/spring/concourse/releasescripts/concourse-release-scripts/$CONCOURSE_RELEASE_SCRIPTS_VERSION/concourse-release-scripts-$CONCOURSE_RELEASE_SCRIPTS_VERSION.jar" /opt/ diff --git a/spring-credhub-docs/build.gradle b/spring-credhub-docs/build.gradle index 0cfb6ac..2472699 100644 --- a/spring-credhub-docs/build.gradle +++ b/spring-credhub-docs/build.gradle @@ -15,7 +15,7 @@ */ plugins { - id 'org.asciidoctor.jvm.convert' version '3.2.0' + id 'org.asciidoctor.jvm.convert' version '3.3.2' } dependencyManagement { @@ -28,7 +28,7 @@ dependencyManagement { description = "Spring CredHub Documentation" configurations { - docs + asciidoctorExtensions } dependencies { @@ -36,16 +36,11 @@ dependencies { implementation("io.projectreactor:reactor-core") implementation("org.springframework.boot:spring-boot-autoconfigure") - docs("io.spring.docresources:spring-doc-resources:0.2.5@zip") + asciidoctorExtensions "io.spring.asciidoctor.backends:spring-asciidoctor-backends:0.0.7" } task prepareAsciidocBuild(type: Sync) { - dependsOn configurations.docs - // copy doc resources - from { - configurations.docs.collect { zipTree(it) } - } - // and doc sources + // Copy doc sources from "src/docs/asciidoc" // to a temporary build directory into "$buildDir/asciidoc" @@ -53,6 +48,10 @@ task prepareAsciidocBuild(type: Sync) { asciidoctor { baseDirFollowsSourceFile() + configurations "asciidoctorExtensions" + outputOptions { + backends "spring-html" + } sourceDir = file("$buildDir/asciidoc") sources { include '*.adoc' @@ -63,17 +62,14 @@ asciidoctor { } } logDocuments = true -// backends = ["html5"] options doctype: 'book', eruby: 'erubis' - attributes 'icons': 'font', + attributes 'revnumber': project.version, + 'spring-version': project.version, + 'branch-or-tag': project.version.endsWith('SNAPSHOT') ? 'main' : "v${project.version}", + 'icons': 'font', 'idprefix': '', 'idseparator': '-', docinfo: 'shared', - revnumber: project.version, - 'spring-version': "${springVersion}", - 'spring-boot-version': "${springBootVersion}", - 'spring-security-version': "${springSecurityVersion}", - 'branch-or-tag': project.version.endsWith('SNAPSHOT') ? 'main' : "v${project.version}", sectanchors: '', sectnums: '', stylesdir: "css/", @@ -83,9 +79,8 @@ asciidoctor { 'allow-uri-read': '', 'source-highlighter': 'highlight.js', 'highlightjsdir': 'js/highlight', - 'highlightjs-theme': 'github' + 'highlightjs-theme': 'github', + 'project-version': project.version } -asciidoctor.dependsOn prepareAsciidocBuild - configurations.archives.artifacts.clear()