forked from purescript/purescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·77 lines (67 loc) · 1.63 KB
/
build.sh
File metadata and controls
executable file
·77 lines (67 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
set -e
STACK="stack --no-terminal --jobs=1"
# Setup & install dependencies or abort
ret=0
$TIMEOUT 40m $STACK --install-ghc build \
--only-dependencies --test --haddock \
|| ret=$?
case "$ret" in
0) # continue
;;
124)
echo "Timed out while installing dependencies."
echo "Try pushing a new commit to build again."
exit 1
;;
*)
echo "Failed to install dependencies."
exit 1
;;
esac
# Set up configuration
STACK_EXTRA_FLAGS=""
if [ -z "$TRAVIS_TAG" ]
then
# On non-release builds, disable optimizations.
STACK_EXTRA_FLAGS="--fast"
fi
if [ "$STACKAGE_NIGHTLY" = "true" ]
then
STACK_EXTRA_FLAGS="$STACK_EXTRA_FLAGS --resolver=nightly"
fi
if [ "$COVERAGE" = "true" ]
then
STACK_EXTRA_FLAGS="$STACK_EXTRA_FLAGS --coverage"
fi
echo "STACK_EXTRA_FLAGS=\"$STACK_EXTRA_FLAGS\""
BUILD_COMMAND="$STACK build --pedantic --test $STACK_EXTRA_FLAGS"
if [ "$BUILD_TYPE" = "normal" ]
then
echo ">>> Building & testing..."
echo "> $BUILD_COMMAND"
$BUILD_COMMAND
elif [ "$BUILD_TYPE" = "sdist" ]
then
echo ">>> Testing the source distribution..."
$STACK sdist
mkdir sdist-test
tar -xzf $(stack path --dist-dir)/purescript-*.tar.gz -C sdist-test --strip-components=1
pushd sdist-test
echo "> $BUILD_COMMAND"
$BUILD_COMMAND
popd
elif [ "$BUILD_TYPE" = "haddock" ]
then
echo ">>> Checking haddock documentation..."
$STACK haddock --fast
else
echo "Unrecognised BUILD_TYPE: $BUILD_TYPE"
exit 1
fi
if [ "$COVERAGE" = "true" ]
then
echo ">>> Uploading test coverage report..."
which shc || $STACK install stack-hpc-coveralls
shc purescript tests || echo "Failed to upload coverage"
fi