forked from commercialhaskell/stackage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
verify-package
executable file
·49 lines (37 loc) · 853 Bytes
/
verify-package
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
#!/usr/bin/env bash
# Script to verify a package to build successfully
# Provide package name by the first argument
#
# Example:
# ./verify-package mtl
# or
# ./verify-package mtl-2.2.2
# or
# ./verify-package mtl lts
set -eu
die() {
>&2 echo "$1"
exit 1
}
package="${1:-}"
if [[ -z $package ]]; then
die "Package name is not given"
fi
resolver="${2:-nightly}"
here="$(cd "$(dirname "$0")" > /dev/null; pwd)"
dir="$(mktemp -d tmp.XXXX)"
exit() {
cd "$here"
rm -rf "$dir"
}
trap exit EXIT
# When updating these commands, make sure to update .github/PULL_REQUEST_TEMPLATE.md as well.
cd "$dir"
stack unpack "$package"
cd "$(ls | head -n 1)"
rm -f stack.yaml
stack init --resolver $resolver --ignore-subdirs
stack build --resolver $resolver --haddock --test --bench --no-run-benchmarks
cat <<EOF
🎉 It looks good!
EOF