diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..06638ca --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,19 @@ +image: python:2.7.12-slim + +before_script: + - bash ci-scripts/before.sh + +variables: + COVERAGE_FILE: .coverage + ONE_AUTH: "/tmp/test-one-auth" + ONE_XMLRPC: "http://localhost:2633/RPC2" + +pytest: + stage: test + script: + - python setup.py test + tags: + - docker + +after_script: + - bash ci-scripts/after.sh diff --git a/README.md b/README.md index 8ec6a4e..b4b7f45 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ # OneDNS + +[![build status](https://gitlab-int.rc.fas.harvard.edu/ops/one-dns/badges/master/build.svg)](https://gitlab-int.rc.fas.harvard.edu/ops/one-dns/commits/master) +[![coverage report](https://gitlab-int.rc.fas.harvard.edu/ops/one-dns/badges/master/coverage.svg)](https://gitlab-int.rc.fas.harvard.edu/ops/one-dns/commits/master) + Dyanmic DNS for OpenNebula ## Usage diff --git a/ci-scripts/after.sh b/ci-scripts/after.sh new file mode 100644 index 0000000..e31426f --- /dev/null +++ b/ci-scripts/after.sh @@ -0,0 +1,2 @@ +#!/bin/bash +coverage report diff --git a/ci-scripts/before.sh b/ci-scripts/before.sh new file mode 100644 index 0000000..6b73091 --- /dev/null +++ b/ci-scripts/before.sh @@ -0,0 +1,5 @@ +#!/bin/bash +echo 'someuser:sometoken' > ${ONE_AUTH} +pip install -r requirements.txt +pip install -r test-requirements.txt +coverage erase diff --git a/setup.py b/setup.py index 593ea91..43f0290 100644 --- a/setup.py +++ b/setup.py @@ -29,9 +29,9 @@ setup( 'pytest-runner>=2.9' ], tests_require=[ - "pytest>=2.9.2", - "pytest-cov>=2.3.0", - "pytest-flake8>=0.6", + "pytest>=3.0.3", + "pytest-cov>=2.4.0", + "pytest-flake8>=0.7", "testfixtures>=4.10.0", "vcrpy>=1.9.0", "mock>=2.0.0", diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..316cc80 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,8 @@ +pytest==3.0.3 +pytest-cov==2.4.0 +pytest-flake8==0.7 +testfixtures==4.10.0 +vcrpy==1.9.0 +mock==2.0.0 +Flask==0.11.1 +Flask-RESTful==0.3.5