-
-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
travis: extract functionality to scripts
It's very advantageous to be able to run the Travis scripts locally. So we extract them into separate scripts. They are explained in the README. Closes #398.
- Loading branch information
1 parent
0a37a4d
commit cb04038
Showing
5 changed files
with
98 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
if [ $# -eq 0 ]; then | ||
echo "usage: $0 /path/to/exercise" | ||
exit 1 | ||
fi | ||
|
||
exercisedir=$1 | ||
|
||
if ! stat -t ${exercisedir}/examples/*/ > /dev/null 2>&1; then | ||
echo "No examples for ${exercisedir}!" | ||
exit 1 | ||
else | ||
mydir=$(dirname $0) | ||
for example in ${exercisedir}/examples/*/ ; do | ||
$mydir/test-example $example | ||
done | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/sh | ||
|
||
if [ $# -eq 0 ]; then | ||
echo "usage: $0 /path/to/exercise/example" | ||
exit 1 | ||
fi | ||
|
||
exampledir=$(cd "$1" && pwd) | ||
|
||
examplename=$(basename "$exampledir") | ||
exercisedir=$(cd "$exampledir/../.." && pwd) | ||
exercisename=$(basename "$exercisedir") | ||
xhaskell=$(cd "$(dirname "$0")/.." && pwd) | ||
|
||
buildfolder="${TRAVIS_BUILD_DIR:-$xhaskell}/build/${exercisename}/${examplename}" | ||
mkdir -p "${buildfolder}" | ||
cp -rL ${exercisedir}/stack.yaml ${exercisedir}/test ${exampledir}/* "${buildfolder}" | ||
|
||
cd $buildfolder | ||
|
||
if [ -n "$TRAVIS" ]; then | ||
cachedir="$HOME" | ||
else | ||
cachedir="$xhaskell" | ||
fi | ||
examplecache="${cachedir}/.foldercache/${exercisename}/${examplename}/.stack-work" | ||
mkdir -p "$examplecache" | ||
ln -f -s "$examplecache" | ||
|
||
echo "testing ${exampledir}" | ||
# SET_RESOLVER passed by .travis.yml - sets --resolver if not current. | ||
stack test ${SET_RESOLVER} `# Select the correct resolver. `\ | ||
--install-ghc `# Download GHC if not in cache.`\ | ||
--no-terminal `# Terminal detection is broken.`\ | ||
--pedantic `# Enable -Wall and -Werror. ` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/sh | ||
|
||
if [ $# -eq 0 ]; then | ||
echo "usage: $0 /path/to/exercise" | ||
exit 1 | ||
fi | ||
|
||
exercisedir=$(cd "$1" && pwd) | ||
exercisename=$(basename "$exercisedir") | ||
examplename="stub" | ||
xhaskell=$(cd "$(dirname "$0")/.." && pwd) | ||
|
||
buildfolder="${TRAVIS_BUILD_DIR:-$xhaskell}/build/${exercisename}/${examplename}" | ||
mkdir -p "${buildfolder}" | ||
cp -rL ${exercisedir}/stack.yaml ${exercisedir}/package.yaml ${exercisedir}/src ${exercisedir}/test "${buildfolder}" | ||
|
||
cd $buildfolder | ||
|
||
if [ -n "$TRAVIS" ]; then | ||
cachedir="$HOME" | ||
else | ||
cachedir="$xhaskell" | ||
fi | ||
examplecache="${cachedir}/.foldercache/${exercisename}/${examplename}/.stack-work" | ||
mkdir -p "$examplecache" | ||
ln -f -s "$examplecache" | ||
|
||
# SET_RESOLVER passed by .travis.yml - sets --resolver if not current. | ||
if [ -f "${exercisedir}/.meta/DONT-TEST-STUB" ]; then | ||
echo "only building stub" | ||
stack build ${SET_RESOLVER} --install-ghc --no-terminal | ||
else | ||
echo "testing stub" | ||
stack test ${SET_RESOLVER} --install-ghc --no-terminal --no-run-tests | ||
fi |