5# TODO: (1) Detect if nix is available otherwise run with plain cabal,
6# (2) Detect the platform and run tests applicable to the platform, (3)
7# add a test for windows/msys
9# TODO: tee the output to a log file
11SCRIPT_DIR=$(cd "$(dirname "$0")" || exit; pwd)
12SCRIPT_NAME=$(basename "$0")
14CABAL_BUILD_OPTIONS="--flag limit-build-mem"
16#------------------------------------------------------------------------------
17# Prime version (GHC 8.10)
18#------------------------------------------------------------------------------
20# XXX take these from command line
25# Without cabal project file, it will not run any tests
26# XXX Added DISABLE_SDIST_BUILD because of a cabal issue, need to remove it
29 --argstr compiler "$GHC_PRIME_NIX" \
31 packcheck.sh cabal-v2 \
32 GHCVER=$GHC_PRIME_VER \
33 CABAL_BUILD_OPTIONS=\"$CABAL_BUILD_OPTIONS --jobs=$JOBS\" \
34 CABAL_DISABLE_DEPS=y \
35 DISABLE_SDIST_BUILD=y \
39# With cabal.project file, it will run the tests
40# XXX Added DISABLE_SDIST_BUILD because of a cabal issue, need to remove it
41ghc_prime_dist_tests () {
43 --argstr compiler "$GHC_PRIME_NIX" \
45 packcheck.sh cabal-v2 \
46 GHCVER=$GHC_PRIME_VER \
47 CABAL_BUILD_OPTIONS=\"$CABAL_BUILD_OPTIONS --jobs=$JOBS\" \
48 CABAL_PROJECT=cabal.project \
49 CABAL_DISABLE_DEPS=y \
50 DISABLE_SDIST_BUILD=y \
54# With stack.yaml file, it will run the tests
55ghc_prime_dist_tests_stack () {
57 --argstr compiler "$GHC_PRIME_NIX" \
60 GHCVER=$GHC_PRIME_VER \
61 STACK_BUILD_OPTIONS=\"--jobs $JOBS --system-ghc\" \
62 STACK_YAML=stack.yaml"
65# build-all, Werror, test, inspection, fusion-plugin. Note, inspection
66# requires fusion-plugin.
68PERF_FLAGS="--flag inspection --flag fusion-plugin"
72 --argstr compiler "$GHC_PRIME_NIX" \
73 --argstr c2nix "--flag inspection" \
75 bin/test-runner --cabal-build-options \
76 \"--jobs=$JOBS --project-file cabal.project.Werror $PERF_FLAGS\";\
77 bin/bench-runner --cabal-build-options \
78 \"--jobs=$JOBS --project-file cabal.project.Werror $PERF_FLAGS\" \
84 --argstr compiler "$GHC_PRIME_NIX" \
86 bin/test-runner --cabal-build-options \
87 \"--jobs=$JOBS --project-file cabal.project.O0\""
90#------------------------------------------------------------------------------
92#------------------------------------------------------------------------------
94# XXX avoid rebuilding if nothing has changed in the source
95# XXX run hlint only on changed files
98 HLINT_OPTIONS="lint --cpp-include=src --cpp-include=test" \
99 HLINT_TARGETS="src test benchmark"
104 --argstr compiler "$GHC_PRIME_NIX" \
105 --run "cabal build --project-file cabal.project.Werror-nocode all"
110 --argstr compiler "$GHC_PRIME_NIX" \
111 --run "cabal build $CABAL_BUILD_OPTIONS --jobs=$JOBS --project-file cabal.project.Werror --enable-tests --enable-benchmarks all"
114ghc_prime_doctests () {
116 --argstr compiler "$GHC_PRIME_NIX" \
117 --run "cabal build $CABAL_BUILD_OPTIONS --jobs=$JOBS --project-file cabal.project.doctest all && cabal-docspec --timeout 60"
120#------------------------------------------------------------------------------
122#------------------------------------------------------------------------------
124# To upload the results to coveralls.io using hpc-coveralls
125# hpc-coveralls --repo-token="$REPO_TOKEN" --coverage-mode=StrictlyFullLines
127ghc_prime_coverage () {
129 --argstr compiler "$GHC_PRIME_NIX" \
130 --run "bin/test-runner --cabal-build-options \"--jobs=$JOBS\" --coverage"
133#------------------------------------------------------------------------------
135#------------------------------------------------------------------------------
137ghc_prime_dev_test () {
139 --argstr compiler "$GHC_PRIME_NIX" \
141 bin/test-runner --cabal-build-options \
142 \"--jobs=$JOBS --flag dev\""
145ghc_prime_dev_perf () {
147 --argstr compiler "$GHC_PRIME_NIX" \
149 bin/bench-runner --cabal-build-options \
150 \"--jobs=$JOBS --flag dev $PERF_FLAGS\" --quick --raw"
155 --argstr compiler "$GHC_PRIME_NIX" \
156 --run "bin/test-runner --cabal-build-options \"--jobs=$JOBS --flag debug\""
159#------------------------------------------------------------------------------
161#------------------------------------------------------------------------------
168 --argstr compiler "ghc$1" \
170 packcheck.sh cabal-v2 \
172 CABAL_BUILD_OPTIONS=\"$CABAL_BUILD_OPTIONS --jobs=$JOBS\" \
173 CABAL_DISABLE_DEPS=y \
174 CABAL_CHECK_RELAX=y \
175 DISABLE_SDIST_BUILD=y \
180ghc901 () { ghc 901 9.0.1; }
181ghc884 () { ghc 884 8.8.4; }
183#------------------------------------------------------------------------------
185#------------------------------------------------------------------------------
189 --argstr compiler "ghcHEAD" \
191 packcheck.sh cabal-v2 \
193 CABAL_BUILD_OPTIONS="$CABAL_BUILD_OPTIONS --jobs=$JOBS" \
194 CABAL_CHECK_RELAX=y \
195 DISABLE_SDIST_BUILD=y \
196 CABAL_BUILD_OPTIONS=\"--allow-newer --project-file cabal.project.ghc-head"
199#------------------------------------------------------------------------------
201#------------------------------------------------------------------------------
203# Use the following nix expression for ghcjs
204# nix-env -f https://github.com/composewell/nixpkgs/archive/refs/tags/22.05-composewell.tar.gz -iA pkgs.haskell.compiler.ghcjs
206 # We don't pass 'CABAL_BUILD_OPTIONS="--flag limit-build-mem"' here as
207 # ghcjs requires more memory to build. Adding a conditional for ghcjs in
208 # the cabal file is a maintainence overhead.
209 packcheck.sh cabal-v2 \
211 CABAL_BUILD_OPTIONS="--jobs=$JOBS" \
212 CABAL_CHECK_RELAX=y \
213 DISABLE_SDIST_BUILD=y \
219#-----------------------------------------------------------------------------
221#-----------------------------------------------------------------------------
225ghc_prime_dist_tests \
238# XXX Include flaky tests flag in manual tests
241ghc_prime_dist_tests_stack \
247 echo "Available targets: all $ALL_TARGETS"
252 echo "$SCRIPT_NAME --targets <space separated target names>"
253 echo "$SCRIPT_NAME --release"
264 -h|--help|help) print_help ;;
265 --release) RELEASE_CI=1; shift; break ;;
266 # options with arguments
267 --targets) shift; TARGETS=$1; shift ;;
269 -*) echo "Unknown flags: $*"; echo; print_help ;;
276 if test "$RELEASE_CI" -eq 1
278 TARGETS="$RELEASE_CI_TARGETS"
280 echo "No targets specified"
284 if test "$RELEASE_CI" -eq 1
286 echo "--targets and --release cannot be used together"
304 if test "$(has_item "$ALL_TARGETS" "$i")" != "$i"
306 echo "Unrecognized target: $i"
311if test "$(has_item "$TARGETS" help)" = "help"
317if test "$(has_item "$TARGETS" all)" = "all"
319 TARGETS="$ALL_TARGETS"
325 echo "--------------------------------------------------"
327 echo "--------------------------------------------------"
333 $i || { echo "$i failed."; exit 1; }
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list