on 9479709 help sign in
265 lines 10 kB history raw
1name: Haskell CI
3on:
4 push:
5 branches:
6 - master
7 pull_request:
9jobs:
10 build:
11 name: GHC ${{matrix.name}}
12 env:
13 # packcheck environment variables
14 LC_ALL: C.UTF-8
15 BUILD: ${{ matrix.build }}
16 GHCVER: ${{ matrix.ghc_version }}
17 CABALVER: ${{ matrix.cabal_version }}
18 DISABLE_DOCS: ${{ matrix.disable_docs }}
19 DISABLE_TEST: ${{ matrix.disable_test }}
20 DISABLE_BENCH: ${{ matrix.disable_bench }}
21 DISABLE_DIST_CHECKS: ${{ matrix.disable_dist_checks }}
22 SDIST_OPTIONS: ${{ matrix.sdist_options }}
23 DISABLE_SDIST_BUILD: ${{ matrix.disable_sdist_build }}
25 # Cabal options
26 CABAL_REINIT_CONFIG: y
27 # Github has machines with 2 CPUS and 6GB memory so the cabal jobs
28 # default (ncpus) is good, this can be checked from the packcheck
29 # output in case it changes.
30 CABAL_BUILD_OPTIONS: ${{ matrix.cabal_build_options }} --flag limit-build-mem
31 CABAL_BUILD_TARGETS: ${{ matrix.cabal_build_targets }}
32 CABAL_PROJECT: ${{ matrix.cabal_project }}
33 CABAL_CHECK_RELAX: y
35 # Stack options
36 STACK_UPGRADE: "y"
37 RESOLVER: ${{ matrix.resolver }}
38 STACK_YAML: ${{ matrix.stack_yaml }}
39 STACK_BUILD_OPTIONS: ${{ matrix.stack_build_options }}
41 # packcheck location and revision
42 PACKCHECK_LOCAL_PATH: "./packcheck.sh"
43 PACKCHECK_GITHUB_URL: "https://raw.githubusercontent.com/composewell/packcheck"
44 PACKCHECK_GITHUB_COMMIT: "a302772c8f3791c477edd1764b82f8d1f5b22fdf"
46 # Pull token from "secrets" setting of the github repo
47 COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
48 COVERAGE: ${{ matrix.coverage }}
49 DOCTEST: ${{ matrix.doctest }}
51 # Subdir
52 SUBDIR: ${{ matrix.subdir }}
54 runs-on: ${{ matrix.runner }}
55 continue-on-error: ${{ matrix.ignore_error }}
56 strategy:
57 fail-fast: true
58 matrix:
59 # The order is important to optimize fail-fast.
60 name:
61 - 9.4.4-Werror
62 - 9.2.7-docspec
63 # - 8.10.7-coverage
65 # Note: if cabal.project is not specified benchmarks and tests won't
66 # run. But we need at least one test where we test without
67 # cabal.project because that is how hackage would build it.
68 include:
69 - name: head
70 ghc_version: head
71 runner: ubuntu-latest
72 build: cabal
73 cabal_version: 3.8.1.0
74 cabal_project: cabal.project.ghc-head
75 disable_sdist_build: "y"
76 ignore_error: true
77 - name: 9.6.1
78 ghc_version: 9.6.1
79 runner: ubuntu-latest
80 build: cabal
81 cabal_version: 3.10.1.0
82 disable_sdist_build: "y"
83 cabal_project: cabal.project
84 ignore_error: true
85 - name: 9.4.4-Werror
86 ghc_version: 9.4.4
87 runner: ubuntu-latest
88 build: cabal
89 cabal_version: 3.8.1.0
90 disable_sdist_build: "y"
91 cabal_project: cabal.project.Werror
92 ignore_error: false
93 - name: 9.4.4-fusion-inspection
94 ghc_version: 9.4.4
95 runner: ubuntu-latest
96 build: cabal
97 cabal_version: 3.8.1.0
98 disable_sdist_build: "y"
99 cabal_project: cabal.project
100 cabal_build_options: "--flag fusion-plugin --flag inspection"
101 ignore_error: false
102 - name: 9.2.7
103 ghc_version: 9.2.7
104 runner: ubuntu-latest
105 build: cabal
106 cabal_project: cabal.project
107 cabal_version: 3.6.2.0
108 disable_sdist_build: "y"
109 ignore_error: false
110 - name: 9.2.7-docspec
111 ghc_version: 9.2.7
112 runner: ubuntu-latest
113 doctest: "y"
114 cabal_version: 3.6.2.0
115 cabal_project: cabal.project
116 disable_sdist_build: "y"
117 ignore_error: false
118 - name: 9.0.2-streamly-sdist
119 ghc_version: 9.0.2
120 runner: ubuntu-latest
121 build: cabal
122 cabal_version: 3.6.2.0
123 cabal_project: cabal.project.streamly
124 ignore_error: true
125 - name: 9.0.2-streamly-core-sdist
126 ghc_version: 9.0.2
127 runner: ubuntu-latest
128 build: cabal
129 cabal_version: 3.6.2.0
130 subdir: core
131 ignore_error: false
132 - name: 8.10.7-streamly-sdist-stack
133 runner: ubuntu-latest
134 build: stack
135 resolver: lts-20.13
136 stack_yaml: stack.yaml
137 sdist_options: "--ignore-check"
138 stack_build_options: "--flag streamly-benchmarks:-opt"
139 cabal_version: 3.6.2.0
140 ignore_error: false
141 - name: 8.10.7-macos
142 ghc_version: 8.10.7
143 runner: macos-latest
144 build: cabal
145 cabal_version: 3.6.2.0
146 cabal_project: cabal.project
147 disable_sdist_build: "y"
148 ignore_error: false
149 # - name: 8.10.7-coverage
150 # ghc_version: 8.10.7
151 # runner: ubuntu-latest
152 # coverage: "y"
153 # cabal_version: 3.6.2.0
154 # ignore_error: false
155 - name: 8.8.4
156 ghc_version: 8.8.4
157 runner: ubuntu-latest
158 build: cabal
159 cabal_version: 3.6.2.0
160 cabal_project: cabal.project
161 disable_sdist_build: "y"
162 ignore_error: false
163 - name: 8.6.5-no-fusion-unoptimized
164 ghc_version: 8.6.5
165 runner: ubuntu-latest
166 build: cabal
167 cabal_version: 3.6.2.0
168 cabal_project: cabal.project
169 cabal_build_options: "--flag no-fusion --flag -opt"
170 disable_sdist_build: "y"
171 ignore_error: false
172 - name: 8.6.5-debug-unoptimized
173 ghc_version: 8.6.5
174 runner: ubuntu-latest
175 build: cabal
176 cabal_version: 3.6.2.0
177 cabal_project: cabal.project
178 cabal_build_options: "--flag debug --flag -opt"
179 disable_sdist_build: "y"
180 ignore_error: false
182 steps:
183 - uses: actions/checkout@v2
185 - uses: actions/cache@v1
186 name: Cache ~/.cabal
187 with:
188 path: ~/.cabal
189 # Bump the key version to clear the cache
190 key: ${{ runner.os }}-${{ matrix.ghc_version }}-cabal-v2
192 - name: Download packcheck
193 run: |
194 # Get packcheck if needed
195 CURL=$(which curl)
196 PACKCHECK_URL=${PACKCHECK_GITHUB_URL}/${PACKCHECK_GITHUB_COMMIT}/packcheck.sh
197 if test ! -e "$PACKCHECK_LOCAL_PATH"; then $CURL -sL -o "$PACKCHECK_LOCAL_PATH" $PACKCHECK_URL; fi;
198 chmod +x $PACKCHECK_LOCAL_PATH
200 os=$(uname -s -m)
201 case "$os" in
202 "Linux x86_64") GHCUP_ARCH="x86_64-linux" ;;
203 "Darwin x86_64") GHCUP_ARCH="x86_64-apple-darwin" ;;
204 *) echo "Unknown OS/Arch: $os"; exit 1;;
205 esac
207 # Check available versions here: https://downloads.haskell.org/~ghcup/
208 GHCUP_VER=0.1.18.0
209 $CURL -sL -o ./ghcup https://downloads.haskell.org/~ghcup/$GHCUP_VER/${GHCUP_ARCH}-ghcup-$GHCUP_VER
210 chmod +x ./ghcup
211 if test "$GHCVER" = "head"
212 then
213 # The URL may change, to find a working URL go to https://gitlab.haskell.org/ghc/ghc/-/jobs/
214 # Find a debian10 job, click on a passed/failed job, at the
215 # end of the output you will find the tar.xz name, put that after
216 # "raw/", and put the job name after "job=".
217 # Also see https://github.com/mpickering/ghc-artefact-nix/blob/master/gitlab-artifact.nix
218 ./ghcup install ghc -u https://gitlab.haskell.org/ghc/ghc/-/jobs/artifacts/master/raw/ghc-x86_64-linux-deb10-int_native-validate.tar.xz?job=x86_64-linux-deb10-int_native-validate head
219 else
220 ./ghcup install ghc $GHCVER
221 fi
222 ./ghcup install cabal $CABALVER
223 ./ghcup set ghc $GHCVER
224 ./ghcup set cabal $CABALVER
226 - name: Run tests
227 run: |
228 if test -n "$DOCTEST"
229 then
230 mkdir -p $HOME/.cabal/bin
231 curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20210111/cabal-docspec-0.0.0.20210111.xz > cabal-docspec.xz
232 echo '0829bd034fba901cbcfe491d98ed8b28fd54f9cb5c91fa8e1ac62dc4413c9562 cabal-docspec.xz' | sha256sum -c -
233 xz -d < cabal-docspec.xz > $HOME/.cabal/bin/cabal-docspec
234 rm -f cabal-docspec.xz
235 chmod a+x $HOME/.cabal/bin/cabal-docspec
236 cabal update
237 cabal build --project-file cabal.project.doctest all
238 $HOME/.cabal/bin/cabal-docspec --version
239 $HOME/.cabal/bin/cabal-docspec --timeout 60 --check-properties --property-variables xs
240 elif test -n "$COVERAGE"
241 then
242 # Run tests with coverage
243 cabal update
244 # Build hpc-coveralls if needed
245 sudo apt-get install -y libcurl4-gnutls-dev
246 export PATH=$HOME/.cabal/bin:$PATH
247 which hpc-coveralls 2>/dev/null || cabal install --project-file cabal.project.hpc-coveralls hpc-coveralls
248 # Run tests and upload results to coveralls.io
249 bin/test.sh --coverage --raw
250 # XXX Uncomment this and fix it properly later
251 # hpc-coveralls --repo-token="$COVERALLS_TOKEN" --coverage-mode=StrictlyFullLines
252 else
253 export TOOLS_DIR=/opt
254 # /usr/local/opt/curl/bin for macOS
255 export PATH=$HOME/.local/bin:$HOME/.ghcup/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/opt/curl/bin
256 if test -n "$SUBDIR"
257 then
258 mv "$PACKCHECK_LOCAL_PATH" "$SUBDIR/packcheck.sh"
259 # This is required as dist-newstyle will be created on the top level
260 # directory as it is considered the working dir.
261 rm cabal.project
262 cd "$SUBDIR"
263 fi
264 bash -c "$PACKCHECK_LOCAL_PATH $BUILD"
265 fi