Skip to content

Commit

Permalink
Update Travis config to do TF and PyTorch builds in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
lewfish committed Aug 30, 2019
1 parent de76bbc commit 5234606
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 27 deletions.
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ services:
- docker

env:
global:
- CLEAN_TRAVIS_TAG=${TRAVIS_TAG/[[:space:]]/}
- COMMIT=${CLEAN_TRAVIS_TAG:-${TRAVIS_COMMIT:0:7}}
global:
- CLEAN_TRAVIS_TAG=${TRAVIS_TAG/[[:space:]]/}
- COMMIT=${CLEAN_TRAVIS_TAG:-${TRAVIS_COMMIT:0:7}}
matrix:
- IMAGE_TYPE=pytorch
- IMAGE_TYPE=tf

if: (type = pull_request) OR (tag IS present) OR (branch = master) OR (branch =~ /^feature.*/)

Expand Down
12 changes: 9 additions & 3 deletions .travis/build
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ set -e

source .travis/env

docker build -t raster-vision-base -f Dockerfile .;
docker build -t ${GPU_IMAGE} -f Dockerfile-gpu .;
docker build -t ${CPU_IMAGE} -f Dockerfile-cpu .;
if [ "$IMAGE_TYPE" = "pytorch" ]; then
docker build --build-arg CUDA_VERSION="10.0" -t raster-vision-cuda-10.0 -f Dockerfile .;
docker build -t ${PYTORCH_IMAGE} -f Dockerfile-pytorch .;
else
docker build --build-arg CUDA_VERSION="9.0" -t raster-vision-cuda-9.0 -f Dockerfile .;
docker build -t raster-vision-tf -f Dockerfile-tf .;
docker build -t ${TF_CPU_IMAGE} -f Dockerfile-tf-cpu .;
docker build -t ${TF_GPU_IMAGE} -f Dockerfile-tf-gpu .;
fi
8 changes: 6 additions & 2 deletions .travis/codecov
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash

docker run -w $(pwd) -v $(pwd):$(pwd) --rm raster-vision-cpu coverage xml
docker run -e CODECOV_TOKEN=$CODECOV_TOKEN -v $(pwd):$(pwd) --rm raster-vision-cpu codecov --root=$(pwd) --commit=$TRAVIS_COMMIT
source .travis/env

if [ "$IMAGE_TYPE" = "tf" ]; then
docker run -w $(pwd) -v $(pwd):$(pwd) --rm ${TF_CPU_IMAGE} coverage xml
docker run -e CODECOV_TOKEN=$CODECOV_TOKEN -v $(pwd):$(pwd) --rm ${TF_CPU_IMAGE} codecov --root=$(pwd) --commit=$TRAVIS_COMMIT
fi
10 changes: 6 additions & 4 deletions .travis/env
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ set -e

FAMILY=quay.io/azavea

CPU_IMAGE=raster-vision-cpu
GPU_IMAGE=raster-vision-gpu
TF_CPU_IMAGE=raster-vision-tf-cpu
TF_GPU_IMAGE=raster-vision-tf-gpu
TF_CPU_TAG=${FAMILY}/raster-vision:tf-cpu
TF_GPU_TAG=${FAMILY}/raster-vision:tf-gpu

CPU_TAG=${FAMILY}/raster-vision:cpu
GPU_TAG=${FAMILY}/raster-vision:gpu
PYTORCH_IMAGE=raster-vision-pytorch
PYTORCH_TAG=${FAMILY}/raster-vision:pytorch
14 changes: 9 additions & 5 deletions .travis/publish
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ IS_LATEST=${2}
docker login -u="$QUAY_USERNAME" -p="$QUAY_PASSWORD" quay.io

function tag_and_push() {
docker tag ${CPU_IMAGE} "${CPU_TAG}-${1}";
docker tag ${GPU_IMAGE} "${GPU_TAG}-${1}";

docker push "${CPU_TAG}-${1}";
docker push "${GPU_TAG}-${1}";
if [ "$IMAGE_TYPE" = "pytorch" ]; then
docker tag ${PYTORCH_IMAGE} "${PYTORCH_TAG}-${1}";
docker push "${PYTORCH_TAG}-${1}";
else
docker tag ${TF_CPU_IMAGE} "${TF_CPU_TAG}-${1}";
docker tag ${TF_GPU_IMAGE} "${TF_GPU_TAG}-${1}";
docker push "${TF_CPU_TAG}-${1}";
docker push "${TF_GPU_TAG}-${1}";
fi
}

tag_and_push ${TAG_SUFFIX}
Expand Down
24 changes: 14 additions & 10 deletions .travis/test
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#!/bin/bash

# Check no uncompiled protobufs
docker run -w $(pwd) -v $(pwd):$(pwd) --rm -it raster-vision-cpu $(pwd)/scripts/compile
if [ ! -z "$(git status --porcelain)" ]; then
echo "Protobuf files need to be compiled. Run scripts/compile."
exit 1
fi
source .travis/env

if [ "$IMAGE_TYPE" = "tf" ]; then
# Check no uncompiled protobufs
docker run -w $(pwd) -v $(pwd):$(pwd) --rm -it ${TF_CPU_IMAGE} $(pwd)/scripts/compile
if [ ! -z "$(git status --porcelain)" ]; then
echo "Protobuf files need to be compiled. Run scripts/compile."
exit 1
fi

docker run -w $(pwd) -v $(pwd):$(pwd) --rm -it raster-vision-cpu rm -f $(pwd)/.coverage $(pwd)/coverage.xml
docker run -w $(pwd) -v $(pwd):$(pwd) --rm -it raster-vision-cpu $(pwd)/scripts/style_tests && \
docker run -w $(pwd) -v $(pwd):$(pwd) --rm -it raster-vision-cpu $(pwd)/scripts/unit_tests && \
docker run -w $(pwd) -v $(pwd):$(pwd) --rm -it raster-vision-cpu $(pwd)/scripts/integration_tests
docker run -w $(pwd) -v $(pwd):$(pwd) --rm -it ${TF_CPU_IMAGE} rm -f $(pwd)/.coverage $(pwd)/coverage.xml
docker run -w $(pwd) -v $(pwd):$(pwd) --rm -it ${TF_CPU_IMAGE} $(pwd)/scripts/style_tests
docker run -w $(pwd) -v $(pwd):$(pwd) --rm -it ${TF_CPU_IMAGE} $(pwd)/scripts/unit_tests
docker run -w $(pwd) -v $(pwd):$(pwd) --rm -it ${TF_CPU_IMAGE} $(pwd)/scripts/integration_tests
fi

0 comments on commit 5234606

Please sign in to comment.