diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8c6d923..12ff88e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,6 +8,22 @@ updates: open-pull-requests-limit: 15 labels: - "dependency-upgrade" + commit-message: + prefix: "3.0.x" + ignore: + - dependency-name: "*" + update-types: ["version-update:semver-major", "version-update:semver-minor"] + + - package-ecosystem: gradle + directory: "/" + target-branch: "2.3.x" + schedule: + interval: daily + open-pull-requests-limit: 15 + labels: + - "dependency-upgrade" + commit-message: + prefix: "2.3.x" ignore: - dependency-name: "*" update-types: ["version-update:semver-major", "version-update:semver-minor"] @@ -20,6 +36,8 @@ updates: open-pull-requests-limit: 15 labels: - "dependency-upgrade" + commit-message: + prefix: "2.2.x" ignore: - dependency-name: "*" update-types: ["version-update:semver-major", "version-update:semver-minor"] diff --git a/README.adoc b/README.adoc index 029fa2b..93995a9 100644 --- a/README.adoc +++ b/README.adoc @@ -12,14 +12,32 @@ A simple application that demonstrates the use of Spring CredHub is available in == Building -=== Basic Compile and Test +=== Basic Compile and Unit Tests To build the source you will need to install JDK 17. -Spring CredHub uses Gradle for most build-related activities, and you should be able to get off the ground quite quickly by cloning the project you are interested in and typing +Spring CredHub uses Gradle for most build-related activities, and you should be able to get off the ground quite quickly by cloning the project you are interested in and typing: +[source,bash] ---- -$ ./gradlew build +./gradlew build +---- + +=== Integration Tests + +Spring CredHub integration tests need a CredHub server. + +Refer to link:credhub-server/README.adoc[credhub-server] for information on how to start it up. + +Once running they can be executed with: + +[source,bash] +---- +./gradlew :spring-credhub-integration-tests:test -PintegrationTests +---- +[source,bash] +---- +./gradlew :spring-credhub-reactive-integration-tests:test -PintegrationTests ---- === Working with the code diff --git a/build.gradle b/build.gradle index 915ab1a..c123723 100644 --- a/build.gradle +++ b/build.gradle @@ -116,9 +116,46 @@ 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" + + // add jvm arg to resolve BlockHound issues, see https://github.com/reactor/BlockHound/issues/33 + jvmArgs += [ + "-XX:+AllowRedefinitionToAddDeleteMethods" + ] + + 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}" } + } + } + } } + } configure(rootProject) { diff --git a/ci/images/spring-credhub-ci/Dockerfile b/ci/images/spring-credhub-ci/Dockerfile index 5707e3a..5cabd5e 100644 --- a/ci/images/spring-credhub-ci/Dockerfile +++ b/ci/images/spring-credhub-ci/Dockerfile @@ -1,5 +1,8 @@ FROM harbor-repo.vmware.com/dockerhub-proxy-cache/library/ubuntu:bionic +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 RUN rm -rf /var/lib/apt/lists/* @@ -10,5 +13,5 @@ RUN mkdir -p /opt/openjdk && \ cd /opt/openjdk && \ curl -L https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.5%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.5_8.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 a8f8598..caf40cd 100644 --- a/spring-credhub-docs/build.gradle +++ b/spring-credhub-docs/build.gradle @@ -17,14 +17,14 @@ import org.springframework.boot.gradle.plugin.SpringBootPlugin plugins { - id 'org.asciidoctor.jvm.convert' + id 'org.asciidoctor.jvm.convert' version '3.3.2' id 'org.springframework.boot' apply false } description = "Spring CredHub Documentation" configurations { - docs + asciidoctorExtensions } dependencies { @@ -33,16 +33,15 @@ 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" +} + +javadoc { + enabled = false } 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" @@ -50,6 +49,10 @@ task prepareAsciidocBuild(type: Sync) { asciidoctor { baseDirFollowsSourceFile() + configurations "asciidoctorExtensions" + outputOptions { + backends "spring-html" + } sourceDir = file("$buildDir/asciidoc") sources { include '*.adoc' @@ -60,17 +63,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/", @@ -80,9 +80,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()