diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4a1a394..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: java - -jdk: - - oraclejdk8 - -addons: - apt: - packages: - - oracle-java8-installer - -env: - matrix: - - PROFILE=non-existant - - PROFILE=spring5-next - -cache: - directories: - - $HOME/.m2 - -sudo: false -install: true -script: "./mvnw clean dependency:list test -Dsort" diff --git a/ci/README.adoc b/ci/README.adoc new file mode 100644 index 0000000..bd69997 --- /dev/null +++ b/ci/README.adoc @@ -0,0 +1,5 @@ +== Concourse CI + +Spring HATEOAS Examples is built using Concourse as it's CI tool of choice. + +The pipeline is defined on https://github.com/spring-projects/spring-hateoas[Spring HATEOAS], it's parent project. \ No newline at end of file diff --git a/ci/build.sh b/ci/build.sh new file mode 100755 index 0000000..620db19 --- /dev/null +++ b/ci/build.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -euo pipefail + +[[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2 + +spring_hateoas-examples_artifactory=$(pwd)/spring-hateoas-examples-artifactory + +rm -rf $HOME/.m2/repository/org/springframework/hateoas-examples 2> /dev/null || : + +cd spring-hateoas-examples-github + +./mvnw -Pdistribute -Dmaven.test.skip=true clean deploy \ + -DaltDeploymentRepository=distribution::default::file://${spring_hateoas-examples_artifactory} diff --git a/ci/build.yml b/ci/build.yml new file mode 100644 index 0000000..12bb495 --- /dev/null +++ b/ci/build.yml @@ -0,0 +1,19 @@ +--- +platform: linux + +image_resource: + type: docker-image + source: + repository: springci/spring-hateoas-examples-8-jdk-with-graphviz + +inputs: +- name: spring-hateoas-examples-github + +outputs: +- name: spring-hateoas-examples-artifactory + +caches: +- path: maven + +run: + path: spring-hateoas-examples-github/ci/build.sh diff --git a/ci/create-release.sh b/ci/create-release.sh new file mode 100755 index 0000000..b6d899f --- /dev/null +++ b/ci/create-release.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -euo pipefail + +RELEASE=$1 +SNAPSHOT=$2 + +# Bump up the version in pom.xml to the desired version and commit the change +./mvnw versions:set -DnewVersion=$RELEASE -DgenerateBackupPoms=false +git add . +git commit --message "Releasing Spring HATEOAS Examples v$RELEASE" + +# Tag the release +git tag -s v$RELEASE -m "v$RELEASE" + +# Bump up the version in pom.xml to the next snapshot +./mvnw versions:set -DnewVersion=$SNAPSHOT -DgenerateBackupPoms=false +git add . +git commit --message "Continue development on v$SNAPSHOT" + + diff --git a/ci/promote-to-bintray.sh b/ci/promote-to-bintray.sh new file mode 100755 index 0000000..2d72b6e --- /dev/null +++ b/ci/promote-to-bintray.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -e -u + +apt-get update +apt-get install -y jq + +buildName=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.name' ) +buildNumber=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.number' ) +groupId=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/\(.*\):.*:.*/\1/' ) +version=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' ) +targetRepo="libs-release-local" + +echo "Promoting ${buildName}/${buildNumber} to ${targetRepo}" + +curl \ + -s \ + --connect-timeout 240 \ + --max-time 2700 \ + -u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} \ + -H "Content-type:application/json" \ + -d "{\"sourceRepos\": [\"libs-release-local\"], \"targetRepo\" : \"spring-distributions\", \"async\":\"true\"}" \ + -f \ + -X \ + POST "https://repo.spring.io/api/build/distribute/${buildName}/${buildNumber}" > /dev/null || { echo "Failed to distribute" >&2; exit 1; } + +echo "Waiting for artifacts to be published" + +ARTIFACTS_PUBLISHED=false +WAIT_TIME=10 +COUNTER=0 + +while [ $ARTIFACTS_PUBLISHED == "false" ] && [ $COUNTER -lt 120 ]; do + + result=$( curl -s https://api.bintray.com/packages/spring/jars/"${groupId}" ) + versions=$( echo "$result" | jq -r '.versions' ) + exists=$( echo "$versions" | grep "$version" -o || true ) + + if [ "$exists" = "$version" ]; then + ARTIFACTS_PUBLISHED=true + fi + + COUNTER=$(( COUNTER + 1 )) + sleep $WAIT_TIME + +done diff --git a/ci/promote-to-bintray.yml b/ci/promote-to-bintray.yml new file mode 100644 index 0000000..09208c8 --- /dev/null +++ b/ci/promote-to-bintray.yml @@ -0,0 +1,19 @@ +--- +platform: linux + +image_resource: + type: docker-image + source: + repository: openjdk + tag: 8-jdk + +inputs: +- name: spring-hateoas-examples-artifactory +- name: spring-hateoas-examples-github + +run: + path: spring-hateoas-examples-github/ci/promote-to-bintray.sh + +params: + ARTIFACTORY_USERNAME: + ARTIFACTORY_PASSWORD: diff --git a/ci/sync-to-maven-central.sh b/ci/sync-to-maven-central.sh new file mode 100755 index 0000000..f2b97cb --- /dev/null +++ b/ci/sync-to-maven-central.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e -u + +apt-get update +apt-get install -y jq + +buildName=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.name' ) +buildNumber=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.number' ) +groupId=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/\(.*\):.*:.*/\1/' ) +version=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' ) + +echo "Syncing ${buildName}/${buildNumber} to Maven Central" + curl \ + -s \ + --connect-timeout 240 \ + --max-time 2700 \ + -u ${BINTRAY_USERNAME}:${BINTRAY_API_KEY} \ + -H "Content-Type: application/json" -d "{ \"username\": \"${SONATYPE_USER_TOKEN}\", \"password\": \"${SONATYPE_PASSWORD_TOKEN}\"}" \ + -f \ + -X \ + POST "https://api.bintray.com/maven_central_sync/spring/jars/${groupId}/versions/${version}" > /dev/null || { echo "Failed to sync" >&2; exit 1; } + +echo "Sync complete" diff --git a/ci/sync-to-maven-central.yml b/ci/sync-to-maven-central.yml new file mode 100644 index 0000000..cbec386 --- /dev/null +++ b/ci/sync-to-maven-central.yml @@ -0,0 +1,21 @@ +--- +platform: linux + +image_resource: + type: docker-image + source: + repository: openjdk + tag: 8-jdk + +inputs: +- name: spring-hateoas-examples-artifactory +- name: spring-hateoas-examples-github + +run: + path: spring-hateoas-examples-github/ci/sync-to-maven-central.sh + +params: + BINTRAY_USERNAME: + BINTRAY_API_KEY: + SONATYPE_USER_TOKEN: + SONATYPE_PASSWORD_TOKEN: diff --git a/ci/test.sh b/ci/test.sh new file mode 100755 index 0000000..bf76ae2 --- /dev/null +++ b/ci/test.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -euo pipefail + +[[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2 + +rm -rf $HOME/.m2/repository/org/springframework/hateoas 2> /dev/null || : + +cd spring-hateoas-examples-github + +./mvnw clean dependency:list test -P${PROFILE} -Dsort diff --git a/ci/test.yml b/ci/test.yml new file mode 100644 index 0000000..d35fec0 --- /dev/null +++ b/ci/test.yml @@ -0,0 +1,17 @@ +--- +platform: linux + +image_resource: + type: docker-image + source: + repository: openjdk + tag: 8-jdk + +inputs: +- name: spring-hateoas-examples-github + +caches: +- path: maven + +run: + path: spring-hateoas-examples-github/ci/test.sh diff --git a/pom.xml b/pom.xml index ffe6e77..c81018f 100644 --- a/pom.xml +++ b/pom.xml @@ -63,13 +63,31 @@ - + - spring5-next + spring51-next - 5.0.2.BUILD-SNAPSHOT - 2.9.2 + 5.1.6.BUILD-SNAPSHOT + + + spring-libs-snapshot + http://repo.spring.io/libs-snapshot + + + + + + spring52-next + + 5.2.0.BUILD-SNAPSHOT + + + + spring-libs-snapshot + http://repo.spring.io/libs-snapshot + +