Skip to content

Commit

Permalink
Travis / Better tagging and better unit tests /B
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalandy committed Apr 30, 2018
1 parent 553ee8a commit 6d976cf
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ install:

before_script:
- CONTAINER_NAME="ghostuat"
- DOCKER_USERNAME="devmtl"
- DOCKER_REPO_NAME="ghostfire"
- DOCKER_REPO_PREFIX="ghostfire"
- THIS_DATE=$(date -u +"%Y-%m-%d_%H-%M-%S")
- THIS_SHA_LONG=$(git log -1 | head -1 | awk '{print $2}')
- THIS_SHA_SHORT=$(git rev-parse --short HEAD)
Expand All @@ -37,9 +40,6 @@ before_script:
fi

script:
# Make sure that there is a useable ip address as "advertise address" because else the swarm creation fails maybe
# docker swarm init --advertise-addr `ip addr s | grep global | grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])' | head -n1`
# Building with 3 TAGS
- docker build -t "$IMAGE_SHA_LONG" .
- docker run -d --name "$CONTAINER_NAME" -p 2368:2368 -e url=http://localhost:2368 -e NODE_ENV=production "$IMAGE_SHA_LONG"
- echo "Ensure $CONTAINER_NAME is starting..."
Expand All @@ -48,30 +48,23 @@ script:
sleep 3;
done
- curl http://localhost:2368 | grep "The professional publishing platform"
- echo "Time to run official docker test on the container..."
- echo "Starting official docker unit test on the image..."
- ~/official-images/test/run.sh "$IMAGE_SHA_LONG"
- uname -a;

after_script:
- docker inspect "$CONTAINER_NAME";
- docker images;
- docker logs "$CONTAINER_NAME";
- echo "Starting unit tests "
- echo "Starting unit tests..."
- docker exec -it "$CONTAINER_NAME" uname -a;
- docker exec -it "$CONTAINER_NAME" node --version;
- docker exec -it "$CONTAINER_NAME" cat /var/lib/ghost/current/content/themes/casper/package.json | grep version;
- docker exec -it "$CONTAINER_NAME" cat /var/lib/ghost/current/package.json | grep version;
- docker exec -it "$CONTAINER_NAME" curl -Is --head "http://localhost:2368" | grep -F -o "HTTP/1.1 200 OK" || echo "Error --> http://localhost:2368"
- docker rm -f "$CONTAINER_NAME";
- echo
- echo "IMAGE_SHA_SHORT=$IMAGE_SHA_SHORT"
- echo "IMAGE_VERSION=$IMAGE_VERSION"
- echo "IMAGE_SHA_LONG=$IMAGE_SHA_LONG"
- echo "IMAGE_DATE=$IMAGE_DATE"
- echo "#IMAGE_SHA_SHORT=$IMAGE_SHA_SHORT"
- echo "#IMAGE_VERSION=$IMAGE_VERSION"
- echo "#IMAGE_SHA_LONG=$IMAGE_SHA_LONG"
- echo "#IMAGE_DATE=$IMAGE_DATE"
- echo "IMAGE_SHA_SHORT=$IMAGE_SHA_SHORT" && echo "IMAGE_VERSION=$IMAGE_VERSION" && echo "IMAGE_SHA_LONG=$IMAGE_SHA_LONG" && echo "IMAGE_DATE=$IMAGE_DATE"
- echo "#IMAGE_SHA_SHORT=$IMAGE_SHA_SHORT" && echo "#IMAGE_VERSION=$IMAGE_VERSION" && echo "#IMAGE_SHA_LONG=$IMAGE_SHA_LONG" && echo "#IMAGE_DATE=$IMAGE_DATE"

after_success:
#docker build -t "$IMAGE_SHA_LONG" (already built)
Expand All @@ -87,9 +80,5 @@ after_success:
fi

# See https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings

# Secret VARS managed by Travis:
# DOCKER_USERNAME=[secure]
# DOCKER_PASSWORD=[secure]
# DOCKER_REPO_PREFIX=[secure]
# DOCKER_REPO_NAME=[secure]
# - DOCKER_PASSWORD=[secure]

0 comments on commit 6d976cf

Please sign in to comment.