on 8290458 help sign in
257 lines 9.7 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.8.1-Werror
62 - 9.2.8-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.10.1.0
74 cabal_project: cabal.project.ghc-head
75 disable_sdist_build: "y"
76 ignore_error: true
77 # Note: use linux for warning build for convenient dev testing
78 - name: 9.8.1-Werror
79 ghc_version: 9.8.1
80 runner: ubuntu-latest
81 build: cabal
82 cabal_version: 3.10.1.0
83 disable_sdist_build: "y"
84 cabal_project: cabal.project.Werror
85 ignore_error: false
86 - name: 9.8.1-fusion-inspection
87 ghc_version: 9.8.1
88 runner: ubuntu-latest
89 build: cabal
90 cabal_version: 3.10.1.0
91 disable_sdist_build: "y"
92 cabal_project: cabal.project
93 cabal_build_options: "--flag fusion-plugin --flag inspection"
94 ignore_error: false
95 - name: 9.6.3-macos
96 ghc_version: 9.6.3
97 runner: macos-latest
98 build: cabal
99 cabal_version: 3.10.1.0
100 disable_sdist_build: "y"
101 cabal_project: cabal.project
102 ignore_error: false
103 - name: 9.4.7
104 ghc_version: 9.4.7
105 runner: ubuntu-latest
106 build: cabal
107 cabal_version: 3.8.1.0
108 disable_sdist_build: "y"
109 cabal_project: cabal.project
110 ignore_error: false
111 - name: 9.2.8
112 ghc_version: 9.2.8
113 runner: ubuntu-latest
114 build: cabal
115 cabal_project: cabal.project
116 cabal_version: 3.6.2.0
117 disable_sdist_build: "y"
118 ignore_error: false
119 - name: 9.2.8-docspec
120 ghc_version: 9.2.8
121 runner: ubuntu-latest
122 doctest: "y"
123 cabal_version: 3.6.2.0
124 cabal_project: cabal.project
125 disable_sdist_build: "y"
126 ignore_error: false
127 - name: 9.0.2-streamly-sdist
128 ghc_version: 9.0.2
129 runner: ubuntu-latest
130 build: cabal
131 cabal_version: 3.6.2.0
132 cabal_project: cabal.project.streamly
133 ignore_error: true
134 - name: 9.0.2-streamly-core-sdist
135 ghc_version: 9.0.2
136 runner: ubuntu-latest
137 build: cabal
138 cabal_version: 3.6.2.0
139 subdir: core
140 ignore_error: false
141 - name: 8.10.7-streamly-sdist-stack
142 runner: ubuntu-latest
143 build: stack
144 resolver: lts-20.13
145 stack_yaml: stack.yaml
146 sdist_options: "--ignore-check"
147 stack_build_options: "--flag streamly-benchmarks:-opt"
148 cabal_version: 3.6.2.0
149 ignore_error: false
150 # - name: 8.10.7-coverage
151 # ghc_version: 8.10.7
152 # runner: ubuntu-latest
153 # coverage: "y"
154 # cabal_version: 3.6.2.0
155 # ignore_error: false
156 - name: 8.8.4
157 ghc_version: 8.8.4
158 runner: ubuntu-latest
159 build: cabal
160 cabal_version: 3.6.2.0
161 cabal_project: cabal.project
162 disable_sdist_build: "y"
163 ignore_error: false
164 - name: 8.6.5-debug-unoptimized
165 ghc_version: 8.6.5
166 runner: ubuntu-latest
167 build: cabal
168 cabal_version: 3.6.2.0
169 cabal_project: cabal.project
170 cabal_build_options: "--flag debug --flag -opt"
171 disable_sdist_build: "y"
172 ignore_error: false
174 steps:
175 - uses: actions/checkout@v2
177 - uses: actions/cache@v1
178 name: Cache ~/.cabal
179 with:
180 path: ~/.cabal
181 # Bump the key version to clear the cache
182 key: ${{ runner.os }}-${{ matrix.ghc_version }}-cabal-v2
184 - name: Download packcheck
185 run: |
186 # Get packcheck if needed
187 CURL=$(which curl)
188 PACKCHECK_URL=${PACKCHECK_GITHUB_URL}/${PACKCHECK_GITHUB_COMMIT}/packcheck.sh
189 if test ! -e "$PACKCHECK_LOCAL_PATH"; then $CURL -sL -o "$PACKCHECK_LOCAL_PATH" $PACKCHECK_URL; fi;
190 chmod +x $PACKCHECK_LOCAL_PATH
192 os=$(uname -s -m)
193 case "$os" in
194 "Linux x86_64") GHCUP_ARCH="x86_64-linux" ;;
195 "Darwin x86_64") GHCUP_ARCH="x86_64-apple-darwin" ;;
196 *) echo "Unknown OS/Arch: $os"; exit 1;;
197 esac
199 # Check available versions here: https://downloads.haskell.org/~ghcup/
200 GHCUP_VER=0.1.18.0
201 $CURL -sL -o ./ghcup https://downloads.haskell.org/~ghcup/$GHCUP_VER/${GHCUP_ARCH}-ghcup-$GHCUP_VER
202 chmod +x ./ghcup
203 if test "$GHCVER" = "head"
204 then
205 # The URL may change, to find a working URL go to https://gitlab.haskell.org/ghc/ghc/-/jobs/
206 # Find a debian10 job, click on a passed/failed job, at the
207 # end of the output you will find the tar.xz name, put that after
208 # "raw/", and put the job name after "job=".
209 # Also see https://github.com/mpickering/ghc-artefact-nix/blob/master/gitlab-artifact.nix
210 ./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
211 else
212 ./ghcup install ghc $GHCVER
213 fi
214 ./ghcup install cabal $CABALVER
215 ./ghcup set ghc $GHCVER
216 ./ghcup set cabal $CABALVER
218 - name: Run tests
219 run: |
220 if test -n "$DOCTEST"
221 then
222 mkdir -p $HOME/.cabal/bin
223 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
224 echo '0829bd034fba901cbcfe491d98ed8b28fd54f9cb5c91fa8e1ac62dc4413c9562 cabal-docspec.xz' | sha256sum -c -
225 xz -d < cabal-docspec.xz > $HOME/.cabal/bin/cabal-docspec
226 rm -f cabal-docspec.xz
227 chmod a+x $HOME/.cabal/bin/cabal-docspec
228 cabal update
229 cabal build --project-file cabal.project.doctest all
230 $HOME/.cabal/bin/cabal-docspec --version
231 $HOME/.cabal/bin/cabal-docspec --timeout 60 --check-properties --property-variables xs
232 elif test -n "$COVERAGE"
233 then
234 # Run tests with coverage
235 cabal update
236 # Build hpc-coveralls if needed
237 sudo apt-get install -y libcurl4-gnutls-dev
238 export PATH=$HOME/.cabal/bin:$PATH
239 which hpc-coveralls 2>/dev/null || cabal install --project-file cabal.project.hpc-coveralls hpc-coveralls
240 # Run tests and upload results to coveralls.io
241 bin/test.sh --coverage --raw
242 # XXX Uncomment this and fix it properly later
243 # hpc-coveralls --repo-token="$COVERALLS_TOKEN" --coverage-mode=StrictlyFullLines
244 else
245 export TOOLS_DIR=/opt
246 # /usr/local/opt/curl/bin for macOS
247 export PATH=$HOME/.local/bin:$HOME/.ghcup/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/opt/curl/bin
248 if test -n "$SUBDIR"
249 then
250 mv "$PACKCHECK_LOCAL_PATH" "$SUBDIR/packcheck.sh"
251 # This is required as dist-newstyle will be created on the top level
252 # directory as it is considered the working dir.
253 rm cabal.project
254 cd "$SUBDIR"
255 fi
256 bash -c "$PACKCHECK_LOCAL_PATH $BUILD"
257 fi