forked from nansencenter/django-geo-spaas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
84 lines (79 loc) · 2.54 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
language: python
python:
- '3.7'
services:
- docker
# Environment variables defined as part of the Travis CI repository configuration are:
# - DOCKER_ORG: the docker hub organization (or user) to which the image will be pushed
# - DOCKER_USER: the docker hub user used to log in to the docker hub
# - DOCKER_PASS: the password of this user
# - PYPI_TOKEN: the token associated to the pypi account for deployment. More information can be found here: https://pypi.org/help/#apitoken
# - COVERALLS_REPO_TOKEN: authentication token for coveralls.io
env:
global:
- IMAGE_NAME="${DOCKER_ORG}/geospaas"
jobs:
include:
- stage: 'Unit tests'
if: type = push
env:
- TEST_IMAGE="${IMAGE_NAME}:latest"
install:
- docker pull "${TEST_IMAGE}" || true
script:
- >
docker run --rm
-e COVERALLS_REPO_TOKEN
-e "TRAVIS=true"
-e TRAVIS_JOB_ID
-e TRAVIS_BRANCH
-e TRAVIS_PULL_REQUEST
-v "$(pwd):/src"
${TEST_IMAGE}
bash -c "source /opt/conda/bin/activate && coverage run --omit=geospaas/nansat_ingestor/tests/*,geospaas/catalog/tests/*,geospaas/vocabularies/tests/* runtests.py && coveralls"
deploy:
- provider: pypi
edge: true
user: "__token__"
password: "${PYPI_TOKEN}"
on:
tags: true
- stage: 'Build Docker images'
name: 'Build standard image'
if: type = push
env:
- TAG='latest'
install:
- docker pull "${IMAGE_NAME}:${TAG}" || true
script:
- >
docker build .
--cache-from "${IMAGE_NAME}:${TAG}"
--build-arg BASE_IMAGE="nansencenter/nansat:${TAG}"
-t "${IMAGE_NAME}:tmp"
before_deploy:
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
deploy:
- provider: script
on:
tags: true
script: /bin/bash scripts/docker_push.sh $TRAVIS_TAG latest
- name: 'Build slim image'
if: type = push
env:
- TAG='latest-slim'
install:
- docker pull "${IMAGE_NAME}:${TAG}" || true
script:
- >
docker build .
--cache-from "${IMAGE_NAME}:${TAG}"
--build-arg BASE_IMAGE="nansencenter/nansat:${TAG}"
-t "${IMAGE_NAME}:tmp"
before_deploy:
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
deploy:
- provider: script
on:
tags: true
script: /bin/bash scripts/docker_push.sh "${TRAVIS_TAG}-slim" 'latest-slim'