-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
83 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,79 @@ | ||
language: shell | ||
|
||
env: | ||
- IMAGE_NAME="${DOCKER_ORG}/geospaas" | ||
|
||
services: | ||
- docker | ||
|
||
if: type != pull_request | ||
# 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 | ||
|
||
install: | ||
- docker pull $IMAGE_NAME || true | ||
- docker build --cache-from $IMAGE_NAME . -t $IMAGE_NAME | ||
env: | ||
global: | ||
- IMAGE_NAME="${DOCKER_ORG}/geospaas" | ||
|
||
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" | ||
$IMAGE_NAME | ||
bash -c "source /opt/conda/bin/activate && coverage run --omit=geospaas/nansat_ingestor/tests/*,geospaas/catalog/tests/*,geospaas/vocabularies/tests/* runtests.py && coveralls" | ||
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 | ||
user: "__token__" | ||
password: "${PYPI_TOKEN}" | ||
on: | ||
tags: true | ||
|
||
before_deploy: | ||
- docker login -u $DOCKER_USER -p $DOCKER_PASS | ||
- stage: 'Build Docker images' | ||
name: 'Build standard image' | ||
if: type = push | ||
env: | ||
- TAG='latest' | ||
install: | ||
- docker pull "${IMAGE_NAME}:${TAG}" || true | ||
- > | ||
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 | ||
|
||
deploy: | ||
- provider: script | ||
on: | ||
tags: true | ||
script: /bin/bash scripts/docker_push.sh $TRAVIS_TAG latest | ||
- provider: pypi | ||
user: "__token__" | ||
password: "${PYPI_TOKEN}" | ||
on: | ||
tags: true | ||
- name: 'Build slim image' | ||
if: type = push | ||
env: | ||
- TAG='latest-slim' | ||
install: | ||
- docker pull "${IMAGE_NAME}:${TAG}" || true | ||
- > | ||
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
for tag in $*;do | ||
docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:${tag}" | ||
docker tag "${IMAGE_NAME}:tmp" "${IMAGE_NAME}:${tag}" | ||
docker push "${IMAGE_NAME}:${tag}" | ||
done |