diff --git a/.travis.yml b/.travis.yml index a9e18cd6..2bdc7cb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,17 @@ language: go go: - "1.13.x" +env: + global: + - GOFLAGS=-mod=vendor GO111MODULE=on + - RABBITMQ_ENDPOINT="http://127.0.0.1:15672" + - RABBITMQ_USERNAME="guest" + - RABBITMQ_PASSWORD="guest" + jobs: + - RABBITMQ_VERSION=3.8 + - RABBITMQ_VERSION=3.7 + - RABBITMQ_VERSION=3.6 + install: # This script is used by the Travis build to install a cookie for # go.googlesource.com so rate limits are higher when using `go get` to fetch @@ -17,13 +28,18 @@ script: - make test - make vet - make website-test +- docker-compose -f $(pwd)/scripts/docker-compose.yml up -d +- $(pwd)/scripts/wait-rabbitmq-docker.sh +- make testacc +- docker-compose -f $(pwd)/scripts/docker-compose.yml down + branches: only: - master + - travis + matrix: fast_finish: true allow_failures: - go: tip -env: - - GOFLAGS=-mod=vendor GO111MODULE=on diff --git a/scripts/docker-compose.yml b/scripts/docker-compose.yml new file mode 100644 index 00000000..7504a17d --- /dev/null +++ b/scripts/docker-compose.yml @@ -0,0 +1,10 @@ +version: "3" + +services: + rabbitmq: + image: rabbitmq:${RABBITMQ_VERSION:-3.8}-management-alpine + environment: + RABBITMQ_DEFAULT_USER: ${RABBITMQ_USERNAME:-guest} + RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD:-guest} + ports: + - 15672:15672 diff --git a/scripts/wait-rabbitmq-docker.sh b/scripts/wait-rabbitmq-docker.sh new file mode 100755 index 00000000..e6bac682 --- /dev/null +++ b/scripts/wait-rabbitmq-docker.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +TIMEOUT=30 + +echo "Waiting for RabbitMQ to be up" +i=0 +until curl -s "${RABBITMQ_ENDPOINT}/api" > /dev/null; do + i=$((i + 1)) + if [ $i -eq $TIMEOUT ]; then + echo + echo "Timeout while waiting for RabbitMQ to be up" + exit 1 + fi + printf "." + sleep 2 +done