Skip to content
Snippets Groups Projects
Commit 4860c0dd authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel :man_dancing:
Browse files

Add simple Travis CI validation

This makes sure that .patch files apply cleanly
parent ff334c6b
No related branches found
No related tags found
No related merge requests found
language: c
before_install:
- echo "$TRAVIS_COMMIT_RANGE"
- echo "$TRAVIS_EVENT_TYPE"
install:
- "true"
script:
- scripts/travis.sh
#!/bin/bash
set -e
case "X$TRAVIS_EVENT_TYPE" in
Xpull_request)
;;
Xpush)
;;
X*)
echo "INFO: not a PR; ignoring"
exit 0
;;
X)
echo "ERROR: TRAVIS_EVENT_TYPE not set"
exit 1
;;
esac
if [ -z "$TRAVIS_COMMIT_RANGE" ]; then
echo "ERROR: TRAVIS_COMMIT_RANGE not set"
exit 1
fi
CHANGED_FILES=($(git diff --name-only $TRAVIS_COMMIT_RANGE))
for FN in "${CHANGED_FILES[@]}"; do
if [ ! -f "$FN" ]; then
echo "ignoring $FN (not a file (anymore))"
continue
fi
if [[ "$FN" =~ ^patches/(.*)[.]patch$ ]]; then
echo "--------------------------------------------------------------------------------"
echo "detected patch file '$FN'"
if [[ "$FN" =~ ^patches/([A-Za-z0-9-]+)-([0-9.]+)[.]patch$ ]]; then
PKGN="${BASH_REMATCH[1]}"
PKGV="${BASH_REMATCH[2]}"
echo "Patch filename looks valid (name = '$PKGN', version = '$PKGV')"
rm -rf travis.tmp/
mkdir -p travis.tmp/
pushd travis.tmp/
echo "...downloading original tar-ball (w/o revised .cabal file)..."
wget --no-verbose "https://hackage.haskell.org/package/$PKGN-$PKGV.tar.gz"
echo "...unpacking..."
tar -xf "$PKGN-$PKGV.tar.gz"
cd "$PKGN-$PKGV/"
echo "...applying patch..."
patch -p1 -i "../../$FN"
echo "Patch could be applied succesfully!"
popd
else
echo "invalid package-id"
exit 1
fi
echo "================================================================================"
else
echo "ignoring $FN"
continue
fi
done
echo DONE
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment