Skip to content

Commit

Permalink
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
  • Loading branch information
paymog committed Dec 12, 2018
1 parent 143c857 commit 1346c2d
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,18 @@ jobs:
script:
- npm run prettier-check
- stage: unit test
language: python
python:
- "3.6"
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

- cd ..
- python manage.py test -v 2

0 comments on commit 1346c2d

Please sign in to comment.