diff --git a/.coveragerc b/.coveragerc index 8d7c45d..9a3145c 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,3 +1,4 @@ [run] branch = True source = . +data_file = .coverage diff --git a/.travis-docker-compose.yml b/.travis-docker-compose.yml new file mode 100644 index 0000000..7314b05 --- /dev/null +++ b/.travis-docker-compose.yml @@ -0,0 +1,13 @@ +version: '2' + +services: + edxops-notifier: + image: edxops/notifier:latest + container_name: notifier_testing + volumes: + - .:/edx/app/notifier/notifier + # The docker container produced from configuration.git does not currently + # run and expose a port for notifier. This means that we need to run some + # command that keeps the notifier container alive while we run tests on it. + # We have not yet standardized on an init replacement which could be used instead. + command: tail -f /dev/null diff --git a/.travis.yml b/.travis.yml index 0326278..083be39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,23 @@ language: python python: - "2.7" + +sudo: required +services: + - docker + +cache: + - pip + +before_install: + - docker-compose -f ./.travis-docker-compose.yml up -d + install: - - pip install -r requirements.txt - - pip install coveralls + - docker exec -t notifier_testing bash -c 'pip install -r /edx/app/notifier/notifier/requirements.txt' script: - - python manage.py test notifier + - docker exec -t notifier_testing bash -c 'cd /edx/app/notifier/notifier && coverage run /edx/app/notifier/notifier/manage.py test notifier' + after_success: - - coveralls + - pip install -U codecov + - docker exec notifier_testing /edx/app/notifier/notifier/run_coverage.sh + - codecov diff --git a/run_coverage.sh b/run_coverage.sh new file mode 100755 index 0000000..bceb51f --- /dev/null +++ b/run_coverage.sh @@ -0,0 +1,4 @@ +#!/bin/bash -xe +. /edx/app/notifier/virtualenvs/notifier/bin/activate +cd /edx/app/notifier/notifier +coverage xml