on master help sign in
Update CI test matrix requirements and the script
f547071Harendra Kumar
.packcheck.ignore+3−1
@@ -1,9 +1,11 @@
1.packcheck.ignore
1.packcheck.ignore
2cabal.project
2cabal.project
3−cabal.project.ci
4cabal.project.coverage
3cabal.project.coverage
5cabal.project.doctest
4cabal.project.doctest
6cabal.project.ghc-head
5cabal.project.ghc-head
7cabal.project.hpc-coveralls
6cabal.project.hpc-coveralls
7+cabal.project.O0
8+cabal.project.Werror
9+cabal.project.Werror-nocode
8hie.yaml
10hie.yaml
9stack.yaml
11stack.yaml
bin/run-ci.sh+147−71
@@ -1,5 +1,7 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2
2
3+# See dev/ci-tests.md
4+
3# TODO: (1) Detect if nix is available otherwise run with plain cabal,
5# TODO: (1) Detect if nix is available otherwise run with plain cabal,
4# (2) Detect the platform and run tests applicable to the platform, (3)
6# (2) Detect the platform and run tests applicable to the platform, (3)
5# add a test for windows/msys
7# add a test for windows/msys
@@ -8,86 +10,122 @@ SCRIPT_DIR=$(cd `dirname $0`; pwd)
8source $SCRIPT_DIR/build-lib.sh
10source $SCRIPT_DIR/build-lib.sh
9
11
10#------------------------------------------------------------------------------
12#------------------------------------------------------------------------------
11−# GHC 8.10
13+# Prime version (GHC 8.10)
12#------------------------------------------------------------------------------
14#------------------------------------------------------------------------------
13
15
16+GHC_PRIME=ghc8104
17+GHC_PRIME_VER="8.10"
18+
19+ghc_prime_dist () {
20+ nix-shell \
21+ --argstr compiler "$GHC_PRIME" \
22+ --run "\
23+ packcheck.sh cabal-v2 \
24+ GHCVER=$GHC_PRIME_VER \
25+ CABAL_DISABLE_DEPS=y \
26+ CABAL_CHECK_RELAX=y"
27+}
28+
14# build-all, Werror, test, inspection, fusion-plugin. Note, inspection
29# build-all, Werror, test, inspection, fusion-plugin. Note, inspection
15# requires fusion-plugin.
30# requires fusion-plugin.
16
31
17−basic () {
32+PERF_FLAGS="--flag inspection --flag fusion-plugin"
33+
34+ghc_prime_perf () {
18 nix-shell \
35 nix-shell \
19− --argstr compiler "ghc8101" \
36+ --argstr compiler "$GHC_PRIME" \
20 --argstr c2nix "--flag inspection" \
37 --argstr c2nix "--flag inspection" \
21 --run "\
38 --run "\
22− packcheck cabal-v2 \
23− GHCVER=8.10.1 \
24− CABAL_DISABLE_DEPS=y \
25− CABAL_CHECK_RELAX=y \
26− DISABLE_SDIST_BUILD=y \
27− CABAL_PROJECT=cabal.project.ci \
28− CABAL_BUILD_OPTIONS=\"--flag inspection --flag fusion-plugin\""
29−# chart deps do not build with ghc-8.10 on nix
30−# nix-shell \
31−# --argstr compiler "ghc8101" \
32−# --argstr c2nix "--flag dev" \
33−# --run "cabal build chart --flag dev"
34−# nix-shell \
35−# --argstr compiler "ghc8101" \
36−# --argstr c2nix "--flag inspection" \
37−# --run "\
38−# bin/bench.sh \
39+ bin/bench.sh --cabal-build-options \
39−# --quick \
40+ \"--project-file cabal.project.Werror $PERF_FLAGS\" --quick --raw;\
40−# --cabal-build-options \"--cabal-project cabal.project.ci --flag inspection --flag fusion-plugin\""
41+ bin/test.sh --cabal-build-options \
42+ \"--project-file cabal.project.Werror $PERF_FLAGS\";"
43+}
44+
45+ghc_prime_O0 () {
46+ nix-shell \
47+ --argstr compiler "$GHC_PRIME" \
48+ --run "\
49+ bin/test.sh --cabal-build-options \
50+ \"--project-file cabal.project.O0\""
41− }
51+}
42
52
43#------------------------------------------------------------------------------
53#------------------------------------------------------------------------------
44−# hlint
54+# Check warnings, docs
45#------------------------------------------------------------------------------
55#------------------------------------------------------------------------------
46
56
47# XXX avoid rebuilding if nothing has changed in the source
57# XXX avoid rebuilding if nothing has changed in the source
48# XXX run hlint only on changed files
58# XXX run hlint only on changed files
49−hlint () {
59+lint () {
50 packcheck cabal \
60 packcheck cabal \
51 HLINT_OPTIONS="lint --cpp-include=src --cpp-include=test" \
61 HLINT_OPTIONS="lint --cpp-include=src --cpp-include=test" \
52 HLINT_TARGETS="src test benchmark"
62 HLINT_TARGETS="src test benchmark"
53}
63}
54
64
65+Werror () {
66+ nix-shell \
67+ --argstr compiler "$GHC_PRIME" \
68+ --run "cabal build --project-file cabal.project.Werror-nocode all"
69+}
70+
71+ghc_prime_werror () {
72+ nix-shell \
73+ --argstr compiler "$GHC_PRIME" \
74+ --run "cabal build --project-file cabal.project.Werror all"
75+}
76+
77+ghc_prime_doctests () {
78+ nix-shell \
79+ --argstr compiler "$GHC_PRIME" \
80+ --run "cabal build --project-file cabal.project.doctest all"
81+ cabal-docspec --timeout 60
82+}
83+
55#------------------------------------------------------------------------------
84#------------------------------------------------------------------------------
56# coverage
85# coverage
57#------------------------------------------------------------------------------
86#------------------------------------------------------------------------------
58
87
59−coverage () {
88+# To upload the results to coveralls.io using hpc-coveralls
89+# hpc-coveralls --repo-token="$REPO_TOKEN" --coverage-mode=StrictlyFullLines
90+
91+ghc_prime_coverage () {
60 nix-shell \
92 nix-shell \
61− --argstr compiler "ghc8101" \
93+ --argstr compiler "$GHC_PRIME" \
62 --run "bin/test.sh --coverage"
94 --run "bin/test.sh --coverage"
63}
95}
64
96
65−# To upload the results to coveralls.io using hpc-coveralls
66−# hpc-coveralls --repo-token="$REPO_TOKEN" --coverage-mode=StrictlyFullLines
67−
68#------------------------------------------------------------------------------
97#------------------------------------------------------------------------------
69−# GHC 8.8
98+# Flags
70#------------------------------------------------------------------------------
99#------------------------------------------------------------------------------
71
100
72−# chart builds from the nix cache for 8.8, 8.10 requires building
101+ghc_prime_dev () {
73−# XXX Use a separate build-dir for this
74−# build-all only, throw in most flags except fusion-plugin, inspection, opt
75−flags () {
76 nix-shell \
102 nix-shell \
77− --argstr compiler "ghc883" \
103+ --argstr compiler "$GHC_PRIME" \
78− --argstr c2nix "--flag dev" \
104+ --run "bin/test.sh --cabal-build-options \"--flag dev\""
79− --run "\
80− packcheck cabal-v2 \
81− GHCVER=8.8.3 \
82− CABAL_DISABLE_DEPS=y \
83− CABAL_CHECK_RELAX=y \
84− DISABLE_SDIST_BUILD=y \
85− DISABLE_TEST=y \
86− DISABLE_DOCS=y \
87− DISABLE_BENCH=y \
88− CABAL_BUILD_OPTIONS=\"--flag streamk --flag debug --flag use-c-malloc --flag dev\""
89}
105}
90
106
107+ghc_prime_c_malloc () {
108+ nix-shell \
109+ --argstr compiler "$GHC_PRIME" \
110+ --run "bin/test.sh --cabal-build-options \"--flag use-c-malloc\""
111+}
112+
113+ghc_prime_debug () {
114+ nix-shell \
115+ --argstr compiler "$GHC_PRIME" \
116+ --run "bin/test.sh --cabal-build-options \"--flag debug\""
117+}
118+
119+ghc_prime_streamk () {
120+ nix-shell \
121+ --argstr compiler "$GHC_PRIME" \
122+ --run "bin/test.sh --cabal-build-options \"--flag streamk\""
123+}
124+
125+#------------------------------------------------------------------------------
126+# Other GHC versions
127+#------------------------------------------------------------------------------
128+
91# build-all only
129# build-all only
92# $1 883
130# $1 883
93# $2 8.8.3
131# $2 8.8.3
@@ -95,43 +133,72 @@ ghc () {
95 nix-shell \
133 nix-shell \
96 --argstr compiler "ghc$1" \
134 --argstr compiler "ghc$1" \
97 --run "\
135 --run "\
98− packcheck cabal-v2 \
136+ packcheck.sh cabal-v2 \
99 GHCVER=$2 \
137 GHCVER=$2 \
100 CABAL_DISABLE_DEPS=y \
138 CABAL_DISABLE_DEPS=y \
101 CABAL_CHECK_RELAX=y \
139 CABAL_CHECK_RELAX=y \
102 DISABLE_SDIST_BUILD=y \
140 DISABLE_SDIST_BUILD=y \
103 DISABLE_TEST=y \
141 DISABLE_TEST=y \
104− DISABLE_DOCS=y "
142+ DISABLE_DOCS=y"
105}
143}
106
144
107−ghc883 () { ghc 883 8.8.3; }
145+ghc901 () { ghc 901 9.0.1; }
108−ghc865 () { ghc 865 8.6.5; }
146+ghc884 () { ghc 884 8.8.4; }
109−ghc844 () { ghc 865 8.4.4; }
147+
148+#------------------------------------------------------------------------------
149+# GHC Head
150+#------------------------------------------------------------------------------
151+
152+ghcHEAD () {
153+ nix-shell \
154+ --argstr compiler "ghcHEAD" \
155+ --run "\
156+ packcheck.sh cabal-v2 \
157+ GHCVER=9.3 \
158+ CABAL_CHECK_RELAX=y \
159+ DISABLE_SDIST_BUILD=y \
160+ CABAL_BUILD_OPTIONS=\"--allow-newer --project-file cabal.project.ghc-head"
161+}
110
162
111#------------------------------------------------------------------------------
163#------------------------------------------------------------------------------
112# ghcjs
164# ghcjs
113#------------------------------------------------------------------------------
165#------------------------------------------------------------------------------
114
166
115−#nix-shell \
167+ghcjs () {
116−# --argstr compiler "ghcjs" \
168+ export PATH=~/.local/bin:/opt/ghc/bin:/opt/ghcjs/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH
117−# --run "\
118−# packcheck cabal-v2 \
169+ packcheck.sh cabal-v2 \
119−# GHCVER=8.6.0 \
170+ GHCVER=8.4.0 \
120−# CABAL_DISABLE_DEPS=y \
121−# CABAL_CHECK_RELAX=y \
171+ CABAL_CHECK_RELAX=y \
122−# DISABLE_SDIST_BUILD=y \
172+ DISABLE_SDIST_BUILD=y \
123−# DISABLE_TEST=y \
173+ DISABLE_TEST=y \
124−# DISABLE_DOCS=y \
174+ DISABLE_DOCS=y \
125−# ENABLE_GHCJS=y " || exit 1
175+ ENABLE_GHCJS=y
176+}
126
177
127#-----------------------------------------------------------------------------
178#-----------------------------------------------------------------------------
128# Read command line
179# Read command line
129#-----------------------------------------------------------------------------
180#-----------------------------------------------------------------------------
130
181
131−ALL_TARGETS="all basic hlint coverage flags ghc883 ghc864 ghc844"
182+ALL_TARGETS="\
183+ghc_prime_dist \
184+ghc_prime_perf \
185+ghc_prime_O0 \
186+ghc_prime_Werror \
187+ghc_prime_doctests \
188+ghc_prime_coverage \
189+ghc_prime_dev \
190+ghc_prime_c_malloc \
191+ghc_prime_debug \
192+ghc_prime_streamk \
193+ghc901 \
194+ghc884 \
195+ghcHEAD \
196+ghcjs \
197+lint \
198+Werror"
132
199
133print_targets () {
200print_targets () {
134− echo "Available targets: $ALL_TARGETS"
201+ echo "Available targets: all $ALL_TARGETS"
135}
202}
136
203
137print_help () {
204print_help () {
@@ -152,22 +219,31 @@ do
152 esac
219 esac
153done
220done
154
221
222+if test -z "$TARGETS"
223+then
224+ print_help
225+fi
226+
227+for i in "$TARGETS"
228+do
229+ if test "$(has_item "$ALL_TARGETS" $i)" != "$i"
230+ then
231+ echo "Unrecognized target: $i"
232+ print_help
233+ fi
234+done
235+
155if test "$(has_item "$TARGETS" help)" = "help"
236if test "$(has_item "$TARGETS" help)" = "help"
156then
237then
157 print_targets
238 print_targets
158 exit
239 exit
159fi
240fi
160
241
161−if test "$(has_item "$TARGETS" help)" = "all"
242+if test "$(has_item "$TARGETS" all)" = "all"
162then
243then
163 TARGETS="$ALL_TARGETS"
244 TARGETS="$ALL_TARGETS"
164fi
245fi
165
246
166−if test -z "$TARGETS"
167−then
168− print_help
169−fi
170−
171for i in $TARGETS
247for i in $TARGETS
172do
248do
173 $i || { echo "$i failed."; exit 1; }
249 $i || { echo "$i failed."; exit 1; }
bin/test.sh+7
@@ -98,6 +98,13 @@ echo "Using targets [$TARGETS]"
98
98
99test_exe_rts_opts () {
99test_exe_rts_opts () {
100 case "$1" in
100 case "$1" in
101+ # XXX Data.Array.* heap requirement increased for GHC-8.10
102+ Data.Array.Foreign) echo -n "-M128M" ;;
103+ Data.Array.Prim) echo -n "-M128M" ;;
104+ Data.Array.Prim.Pinned) echo -n "-M128M" ;;
105+ # For -O0 case writeChunks test fails, maybe we should have a separate flag
106+ # for O0 case?
107+ FileSystem.Handle) echo -n "-K16M" ;;
101 *) if test "$COVERAGE" -eq "1"
108 *) if test "$COVERAGE" -eq "1"
102 then
109 then
103 echo -n "-K8M -M1024M"
110 echo -n "-K8M -M1024M"
cabal.project.O0new file+19
@@ -0,0 +1,19 @@
1+packages:
2+ ./
3+ test
4+ benchmark
5+
6+-- Keep the flags same as cabal.project.doctest because we utilize the
7+-- same build for doctests in CI.
8+
9+package streamly
10+ flags: -opt
11+ ghc-options: -O0 -Werror
12+
13+package streamly-tests
14+ flags: -opt
15+ ghc-options: -O0 -Werror
16+
17+package streamly-benchmarks
18+ flags: -opt
19+ ghc-options: -O0 -Werror
cabal.project.Werror-nocodenew file+13
@@ -0,0 +1,13 @@
1+packages:
2+ ./
3+ benchmark
4+ test
5+
6+package streamly
7+ ghc-options: -Werror -fno-code
8+
9+package streamly-benchmarks
10+ ghc-options: -Werror -fno-code
11+
12+package streamly-tests
13+ ghc-options: -Werror -fno-code
cabal.project.coverage+1−4
@@ -3,11 +3,8 @@ packages:
3 test
3 test
4
4
5package streamly
5package streamly
6− ghc-options: -Werror
7− flag: inspection
8 coverage: true
6 coverage: true
9
7
10−package streamly-tests
8+-- package streamly-tests
11− ghc-options: -Werror
12 -- A few percent lesss coverage for some build speedup
9 -- A few percent lesss coverage for some build speedup
13 -- -DCOVERAGE_BUILD
10 -- -DCOVERAGE_BUILD
cabal.project.doctest+11
@@ -1,2 +1,13 @@
1packages: streamly.cabal
1packages: streamly.cabal
2 , docs/streamly-docs.cabal
2 , docs/streamly-docs.cabal
3+
4+-- Keep the flags same as cabal.project.O0 because we utilize the same build
5+-- for doctest in CI.
6+
7+package streamly
8+ flags: -opt
9+ ghc-options: -O0 -Werror
10+
11+package streamly-docs
12+ flags: -opt
13+ ghc-options: -O0 -Werror
dev/ci-tests.md+46−14
@@ -1,22 +1,54 @@
1+# Continuous integration tests
2+
1This file documents the required CI test matrix so that we do not accidentally
3This file documents the required CI test matrix so that we do not accidentally
2remove or miss any tests when making changes to CI configs:
4remove or miss any tests when making changes to CI configs:
3
5
4−* Last three major versions of GHC (build lib, test, bench, docs), run
5− tests, on Linux platform, using cabal build
6−* Only for prime GHC version:
6+## For prime GHC version:
7− * Run on Windows and MacOS platforms too
7+
8− * stack build
8+Distribution:
9+ * build from source distribution WITHOUT a cabal.project file
10+
11+Performance:
12+ * `--flag inspection` + `--flag fusion-plugin`
9− * Run `bench.sh --quick`
13+ * Run `bin/bench.sh --quick --raw`
14+ * Run `bin/test.sh`
10 * -Werror (for lib, test, bench)
15 * -Werror (for lib, test, bench)
11− * `coverage` build
16+
12− * build from source distribution
17+Lint:
18+ * -Werror (for lib, test, bench) (Need a Werror with default flags)
13 * hlint
19 * hlint
14− * `inspection` flag + `fusion-plugin` flag
20+
15− * --flag streamk
21+Doctests:
22+ * Run cabal-docspec
23+
24+Coverage:
25+ * `coverage` build
26+
27+Debug:
16 * --flag debug
28 * --flag debug
17− * --flag doctests
18−* ghc head version - run inspection-testing + fusion-plugin tests to catch any
19− issues early. Ideally we should also be running perf tests and compare
20− against the prime version.
21
29
30+StreamK:
31+ * --flag streamk
32+
33+Windows:
34+ * Windows + stack
35+
36+MacOS:
37+ * MacOS + stack
38+
39+## Other GHC versions
40+
41+GHC head:
42+ * `--flag inspection` + `--flag fusion-plugin` tests to catch any
43+ issues early.
44+ * Ideally we should also be running perf tests and compare
45+ against the prime version.
46+
47+Other GHC versions:
48+* build lib, test, bench, docs, run tests, on Linux platform, using
49+ cabal build
50+
51+## GHCJS
52+
53+GHCJS:
22* Latest version ghcjs build (lib, test, bench), run tests
54* Latest version ghcjs build (lib, test, bench), run tests
test/Streamly/Test/FileSystem/Handle.hs+1
@@ -169,4 +169,5 @@ main =
169 describe "Write To Handle" $ do
169 describe "Write To Handle" $ do
170 prop "write" $ testWrite Handle.write
170 prop "write" $ testWrite Handle.write
171 prop "writeWithBufferOf" $ testWrite $ Handle.writeWithBufferOf 1024
171 prop "writeWithBufferOf" $ testWrite $ Handle.writeWithBufferOf 1024
172+ -- XXX This test needs a lot of stack when built with -O0
172 prop "writeChunks" testWriteWithChunk
173 prop "writeChunks" testWriteWithChunk