Skip to content

Commit

Permalink
CI: add reverse-dependency testing for pubtools-pulp (release-enginee…
Browse files Browse the repository at this point in the history
…ring#45)

Don't allow incoming changes to pubtools-pulplib unless
pubtools-pulp tests also pass with the changes. This gives added
protection against regressions and backwards-incompatible changes.
  • Loading branch information
rohanpm authored Sep 3, 2019
1 parent 501f424 commit f6b0018
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ matrix:
env: TOX_ENV=cov-travis DEPLOY=1
- python: "3.6"
env: TOX_ENV=docs
- python: "3.6"
env: TOX_ENV=revdep-pubtools-pulp
script: tox -e $TOX_ENV
after_success:
- test $TOX_ENV = docs && scripts/push-docs
Expand Down
34 changes: 34 additions & 0 deletions scripts/revdep-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh
# Reverse dependency tester.
#
# Usage: revdep-test <git-url>
#
# This script is intended to be run within a virtualenv with latest
# version of this project installed. It'll run autotests from
# some *other* project which depends on this one.
#
# The project must satisfy requirements:
# - is itself pip-installable
# - must support py.test for test running
# - if tests need extra reqs, they must be in test-requirements.txt
#
URL="$1"

CLONE_DIR=$(mktemp -d -t --suffix=revdep)

clean(){
rm -rf $CLONE_DIR
}
trap clean EXIT

set -xe

git clone "$URL" "$CLONE_DIR"
cd "$CLONE_DIR"

pip install --editable .
if test -e test-requirements.txt; then
pip install -rtest-requirements.txt
fi

py.test -v
7 changes: 6 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27,py36,static,pidiff,docs
envlist = py27,py36,static,pidiff,docs,revdep-pubtools-pulp

[testenv]
deps=-rtest-requirements.txt
Expand Down Expand Up @@ -47,6 +47,11 @@ commands=
pytest --cov=pubtools {posargs}
coveralls

[testenv:revdep-pubtools-pulp]
usedevelop=true
whitelist_externals=sh
commands=sh -c 'scripts/revdep-test https://github.com/release-engineering/pubtools-pulp.git'

[testenv:docs]
deps=
sphinx
Expand Down

0 comments on commit f6b0018

Please sign in to comment.