Add a "predeploy" Travis build for PRs and master

This commit is contained in:
Michael Walker 2018-07-08 11:21:10 +01:00
parent 63b3838a72
commit f48b8301e3
2 changed files with 61 additions and 0 deletions

View File

@ -38,3 +38,7 @@ jobs:
- env: MODE=test RESOLVER=lts-10.0 # GHC 8.2
- env: MODE=test RESOLVER=nightly-2018-03-23 # GHC 8.4
- env: MODE=test RESOLVER=nightly
- stage: predeploy
if: branch=master
env: MODE=predeploy

57
.travis/predeploy Executable file
View File

@ -0,0 +1,57 @@
#!/usr/bin/env bash
function msg {
pkg=$1
file=$2
note=$3
if [[ -z "$note" ]]; then
echo "${pkg}: package version mismatch in ${file}" >&2
else
echo "${pkg}: package version mismatch in ${file} (${note})" >&2
fi
}
fail=false
for pkg in concurrency dejafu hunit-dejafu tasty-dejafu; do
ver=`grep '^version:' ${pkg}/${pkg}.cabal | sed 's/^version: *//'`
if ! grep -q -E "tag: *${pkg}-${ver}" $pkg/$pkg.cabal; then
msg $pkg $pkg/$pkg.cabal
fail=true
fi
if ! grep -q "^${ver}" $pkg/CHANGELOG.rst; then
msg $pkg $pkg/CHANGELOG.rst "missing header"
fail=true
fi
if ! grep -q -E "Git.*${pkg}-${ver}" $pkg/CHANGELOG.rst; then
msg $pkg $pkg/CHANGELOG.rst "missing git tag"
fail=true
fi
if ! grep -q -E "Hackage.*${pkg}-${ver}" $pkg/CHANGELOG.rst; then
msg $pkg $pkg/CHANGELOG.rst "missing hackage link"
fail=true
fi
if ! grep -q -E "${pkg}.*${ver}" README.markdown; then
msg $pkg README.markdown
fail=true
fi
if ! grep -q -E "${pkg}.*${ver}" doc/getting_started.rst; then
msg $pkg doc/getting_started.rst
fail=true
fi
if git grep -q unreleased $pkg; then
echo "${pkg}: 'unreleased' appears in source" >&2
fail=true
fi
done
if $fail; then
exit 1
fi