-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
58 lines (50 loc) · 1.73 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
47
48
49
50
51
52
53
54
55
56
57
58
dist: xenial
language: generic
services:
- mongodb
jdk:
- openjdk11
env:
- PRIVATE_IMAGE="$PRIVATE_DOCKER_REGISTRY/admin-panel-server" \
IMAGE="fairdata/admin-panel-server" \
IMAGE_TAG="$PRIVATE_IMAGE:$TRAVIS_COMMIT" \
IMAGE_TAG_BRANCH="$PRIVATE_IMAGE:"`echo $TRAVIS_BRANCH | sed 's#/#-#g'` \
IMAGE_TAG_DEVELOP="$IMAGE:develop" \
IMAGE_TAG_LATEST="$IMAGE:latest"
before_install:
# 1. Log to public Docker Hub
- docker login -u "$PUBLIC_DOCKER_USER" -p "$PUBLIC_DOCKER_PASSWORD"
# 2. Log in to private Docker Registry
- docker login -u "$PRIVATE_DOCKER_USER" -p "$PRIVATE_DOCKER_PASSWORD" "$PRIVATE_DOCKER_REGISTRY"
jobs:
include:
- stage: build
script:
- mvn --quiet org.jacoco:jacoco-maven-plugin:prepare-agent test
- mvn --quiet --fail-fast -DskipTests package
- docker pull $IMAGE_TAG_DEVELOP
- docker build --cache-from $IMAGE_TAG_DEVELOP -t $IMAGE_TAG .
- docker push $IMAGE_TAG
after_success:
- mvn --quiet org.jacoco:jacoco-maven-plugin:report coveralls:report
- stage: tag
if: (branch = develop) AND (NOT (type IN (pull_request)))
install: skip
script:
- docker pull $IMAGE_TAG
- docker image tag $IMAGE_TAG $IMAGE_TAG_DEVELOP
- docker push $IMAGE_TAG_DEVELOP
- stage: tag
if: (branch = master) AND (NOT (type IN (pull_request)))
install: skip
script:
- docker pull $IMAGE_TAG
- docker image tag $IMAGE_TAG $IMAGE_TAG_LATEST
- docker push $IMAGE_TAG_LATEST
- stage: tag
if: (type = push)
install: skip
script:
- docker pull $IMAGE_TAG
- docker image tag $IMAGE_TAG $IMAGE_TAG_BRANCH
- docker push $IMAGE_TAG_BRANCH