Files
PyRIGS/wercker.yml
Tom Price 8cfda69717 Set wercker up to use postgres for tests again.
Modify the tests to be postgres compatible by using more pointers to things rather than getting them everytime.
2016-03-31 16:03:07 +01:00

104 lines
3.5 KiB
YAML

# This references the default Python container from
# the Docker Hub with the 2.7 tag:
# https://registry.hub.docker.com/_/python/
# If you want to use a slim Python container with
# version 3.4.3 you would use: python:3.4-slim
# If you want Google's container you would reference google/python
# Read more about containers on our dev center
# http://devcenter.wercker.com/docs/containers/index.html
box: heroku/python
# You can also use services such as databases. Read more on our dev center:
# http://devcenter.wercker.com/docs/services/index.html
services:
- id: postgres
env:
POSTGRES_PASSWORD: pyrigstesting
POSTGRES_USER: pyrigs
# http://devcenter.wercker.com/docs/services/postgresql.html
# - mongodb
# http://devcenter.wercker.com/docs/services/mongodb.html
# This is the build pipeline. Pipelines are the core of wercker
# Read more about pipelines on our dev center
# http://devcenter.wercker.com/docs/pipelines/index.html
build:
# The steps that will be executed on build
# Steps make up the actions in your pipeline
# Read more about steps on our dev center:
# http://devcenter.wercker.com/docs/steps/index.html
steps:
- install-packages:
packages: firefox xvfb
- script:
name: Enable virtual display
code: |-
# Start xvfb which gives the context an virtual display
# which is required for tests that require an GUI
export DISPLAY=:99.0
start-stop-daemon --start --quiet --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
# Give xvfb time to start. 3 seconds is the default for all xvfb-run commands.
# sleep 3
- script:
name: virtualenv install
code: |
pip install virtualenv
# A step that sets up the python virtual environment
- virtualenv:
name: setup virtual environment
install_wheel: false # Enable wheel to speed up builds (experimental)
# # Use this virtualenv step for python 3.2
# - virtualenv
# name: setup virtual environment
# python_location: /usr/bin/python3.2
# # This pip-install clears the local wheel cache
# - pip-install:
# clean_wheel_dir: true
# A custom script step, name value is used in the UI
# and the code value contains the command that get executed
- script:
name: Python Version
code: |
echo "python version $(python --version) running"
echo "pip version $(pip --version) running"
# Django uses this to connect to the database
- script:
name: set environment
code: |
export DEBUG=0
export DATABASE_URL="postgres://pyrigs:pyrigstesting@$POSTGRES_PORT_5432_TCP_ADDR:$POSTGRES_PORT_5432_TCP_PORT$POSTGRES_NAME"
# A step that executes `pip install` command.
- pip-install
# Install coverage
- script:
name: install coverage
code: |
pip install coverage
# Collect static files so the manifest storage knows where to look
- script:
name: collect static
code: |
python manage.py collectstatic --noinput
# Run python tests
- script:
name: run tests
code: |
coverage run manage.py test RIGS
- script:
name: collect coverage data
code: |
coverage report -m --include=PyRIGS/*.*,RIGS/*.* --omit=*/migrations/* | tee coverage.txt
coverage html --include=PyRIGS/*.*,RIGS/*.* --omit=*/migrations/*