forked from hedgedoc/container
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
46 lines (39 loc) · 2.02 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
sudo: required
language: bash
services:
- docker
env:
global:
- CMD_VERSION=1.6.0
matrix:
- BASE=debian
- BASE=alpine
before_install:
- sudo apt-get -qq update
- sudo apt-get install -y parallel
install:
# Build images
- docker build --build-arg VERSION=${CMD_VERSION:-master} -f $BASE/Dockerfile -t codimd:testing .
before_script:
# Run a database container with default settings
- docker network create postgres
- docker run --name hackmd-database --network postgres -e POSTGRES_USER=hackmd -e POSTGRES_PASSWORD=hackmdpass -e POSTGRES_DB=hackmd --net-alias hackmdpostgres --net-alias hackmdPostgres -d postgres:9.5
script:
# Run all tests from test directory
- ./tests/chore/startContainer.sh
- ls tests/*.sh | parallel
- ./tests/chore/stopContainer.sh
after_success:
# Push successful builds of the master branch to Docker Hub
# You need to define $CONTAINER_REPO_PREFIX, $CONTAINER_REPO_NAME, $CONTAINER_USERNAME and $CONTAINER_PASSWORD in your Travis settings.
# $CONTAINER_REPO_PREFIX - Organisation of username who owns the repo on Docker Hub
# $CONTAINER_REPO_NAME - Repository name on Docker Hub
# $CONTAINER_USERNAME - Docker Hub username used to push the image
# $CONTAINER_PASSWORD - Password of the Docker Hub user used to push the image
# See https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings
- if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" == "master" ] && [ "$CONTAINER_REPO_PREFIX" != "" ] && [ "$CONTAINER_REPO_NAME" != "" ] && [ "$CONTAINER_USERNAME" != "" ] && [ "$CONTAINER_PASSWORD" != "" ]; then
tools/tagging.sh "${CONTAINER_REPO_PREFIX}/${CONTAINER_REPO_NAME}" "${CMD_VERSION:-latest}" "$BASE";
docker images "${CONTAINER_REPO_PREFIX}/${CONTAINER_REPO_NAME}";
docker login -u="$CONTAINER_USERNAME" -p="$CONTAINER_PASSWORD" ${CONTAINER_REGISTRY:-docker.io};
docker images --format "{{.Repository}}:{{.Tag}}" "${CONTAINER_REPO_PREFIX}/${CONTAINER_REPO_NAME}" | xargs -L 1 docker push ;
fi