Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build and test backend without docker
Browse files Browse the repository at this point in the history
Build and test the backend without docker so that tests can be run
against pull requests from forks. Fixes #17
paymog committed Dec 12, 2018
1 parent 143c857 commit 796e336
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -30,21 +30,15 @@ jobs:
script:
- npm run prettier-check
- stage: unit test
language: python
services:
- docker
- postgresql
addons:
postgresql: "9.6"
before_install:
- cd backend
before_script:
- docker login -u _json_key -p "$(echo $GCR_REGSITRY_SERVICE_ACCOUNT | base64 -d)" https://gcr.io
- psql -c 'create database travis_ci_test;' -U postgres
script:
# need to support branches with / in the their name. Do this by replacing / with -
- IMAGE_WITH_TAG=$TEST_IMAGE:${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}

- docker pull $IMAGE_WITH_TAG || docker pull $TEST_IMAGE:latest || true
- docker build --cache-from $IMAGE_WITH_TAG --cache-from $TEST_IMAGE:latest -t $IMAGE_WITH_TAG -t $TEST_IMAGE:latest -f server.Dockerfile .
- docker push $IMAGE_WITH_TAG # push this first so we don't have to rebuild if tests fail
- docker run --net=host $IMAGE_WITH_TAG python manage.py test -v 2
- docker push $TEST_IMAGE:latest

- python manage.py test -v 2

0 comments on commit 796e336

Please sign in to comment.