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 13, 2018
1 parent 143c857 commit 0d7362d
Showing 1 changed file with 17 additions and 28 deletions.
45 changes: 17 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
image: docker:latest
language: python

env:
global:
- DOCKER_DRIVER=overlay2
- DOCKER_HOST=tcp://localhost:2375

- BASE_IMAGE_REGISTRY=gcr.io/mycrocoin
- BACKEND_IMAGE=${BASE_IMAGE_REGISTRY}/mycro-backend
- FRONTEND_IMAGE=${BASE_IMAGE_REGISTRY}/mycro-frontend
- TEST_IMAGE=${BASE_IMAGE_REGISTRY}/test

stages:
- test


jobs:
include:
- stage: unit test
Expand All @@ -30,21 +13,27 @@ jobs:
script:
- npm run prettier-check
- stage: unit test
language: python
python:
- "3.6"
dist: xenial
services:
- docker
- postgresql
addons:
postgresql: "9.6"
before_install:
# - echo $PATH
# - return 1
# - sudo add-apt-repository -y ppa:ethereum/ethereum
# - sudo apt-get update -y
- sudo apt-get install -yq --no-install-recommends --no-install-suggests automake build-essential libffi-dev libgmp-dev libssl-dev libtool pkg-config python3-dev python3-pip software-properties-common
install:
- cd backend
- pip3 install -r requirements.txt
- python3 -m solc.install v0.4.24
- ln -s /home/travis/.py-solc/solc-v0.4.24/bin/solc /usr/bin/solc
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 0d7362d

Please sign in to comment.