Skip to content

Commit 248d375

Browse files
committed
Haskell CI for GHC 8.4 - 9.8; restrict to base >= 4.11 (GHC 8.4)
Building this CI revealed that `http-streams` no longer builds with GHC 8.2 or lower, because of missing imports. Thus, I corrected the `base` lower bound accordingly.
1 parent 81f94af commit 248d375

File tree

3 files changed

+291
-3
lines changed

3 files changed

+291
-3
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 271 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
# This GitHub workflow config has been generated by a script via
2+
#
3+
# haskell-ci 'github' 'http-streams.cabal'
4+
#
5+
# To regenerate the script (for example after adjusting tested-with) run
6+
#
7+
# haskell-ci regenerate
8+
#
9+
# For more information, see https://github.com/andreasabel/haskell-ci
10+
#
11+
# version: 0.17.20231002
12+
#
13+
# REGENDATA ("0.17.20231002",["github","http-streams.cabal"])
14+
#
15+
name: Haskell-CI
16+
on:
17+
push:
18+
branches:
19+
- main
20+
pull_request:
21+
branches:
22+
- main
23+
jobs:
24+
linux:
25+
name: Haskell-CI - Linux - ${{ matrix.compiler }}
26+
runs-on: ubuntu-20.04
27+
timeout-minutes:
28+
60
29+
container:
30+
image: buildpack-deps:focal
31+
continue-on-error: ${{ matrix.allow-failure }}
32+
strategy:
33+
matrix:
34+
include:
35+
- compiler: ghc-9.8.0.20230929
36+
compilerKind: ghc
37+
compilerVersion: 9.8.0.20230929
38+
setup-method: ghcup
39+
allow-failure: true
40+
- compiler: ghc-9.6.3
41+
compilerKind: ghc
42+
compilerVersion: 9.6.3
43+
setup-method: ghcup
44+
allow-failure: false
45+
- compiler: ghc-9.4.7
46+
compilerKind: ghc
47+
compilerVersion: 9.4.7
48+
setup-method: ghcup
49+
allow-failure: false
50+
- compiler: ghc-9.2.8
51+
compilerKind: ghc
52+
compilerVersion: 9.2.8
53+
setup-method: ghcup
54+
allow-failure: false
55+
- compiler: ghc-9.0.2
56+
compilerKind: ghc
57+
compilerVersion: 9.0.2
58+
setup-method: ghcup
59+
allow-failure: false
60+
- compiler: ghc-8.10.7
61+
compilerKind: ghc
62+
compilerVersion: 8.10.7
63+
setup-method: ghcup
64+
allow-failure: false
65+
- compiler: ghc-8.8.4
66+
compilerKind: ghc
67+
compilerVersion: 8.8.4
68+
setup-method: hvr-ppa
69+
allow-failure: false
70+
- compiler: ghc-8.6.5
71+
compilerKind: ghc
72+
compilerVersion: 8.6.5
73+
setup-method: hvr-ppa
74+
allow-failure: false
75+
- compiler: ghc-8.4.4
76+
compilerKind: ghc
77+
compilerVersion: 8.4.4
78+
setup-method: hvr-ppa
79+
allow-failure: false
80+
fail-fast: false
81+
steps:
82+
- name: apt
83+
run: |
84+
apt-get update
85+
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
86+
if [ "${{ matrix.setup-method }}" = ghcup ]; then
87+
mkdir -p "$HOME/.ghcup/bin"
88+
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
89+
chmod a+x "$HOME/.ghcup/bin/ghcup"
90+
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
91+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
92+
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
93+
else
94+
apt-add-repository -y 'ppa:hvr/ghc'
95+
apt-get update
96+
apt-get install -y "$HCNAME"
97+
mkdir -p "$HOME/.ghcup/bin"
98+
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
99+
chmod a+x "$HOME/.ghcup/bin/ghcup"
100+
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
101+
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
102+
fi
103+
env:
104+
HCKIND: ${{ matrix.compilerKind }}
105+
HCNAME: ${{ matrix.compiler }}
106+
HCVER: ${{ matrix.compilerVersion }}
107+
- name: Set PATH and environment variables
108+
run: |
109+
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
110+
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
111+
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
112+
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
113+
HCDIR=/opt/$HCKIND/$HCVER
114+
if [ "${{ matrix.setup-method }}" = ghcup ]; then
115+
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
116+
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
117+
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
118+
echo "HC=$HC" >> "$GITHUB_ENV"
119+
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
120+
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
121+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
122+
else
123+
HC=$HCDIR/bin/$HCKIND
124+
echo "HC=$HC" >> "$GITHUB_ENV"
125+
echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
126+
echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
127+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
128+
fi
129+
130+
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
131+
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
132+
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
133+
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
134+
if [ $((HCNUMVER >= 90800)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi
135+
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
136+
echo "GHCJSARITH=0" >> "$GITHUB_ENV"
137+
env:
138+
HCKIND: ${{ matrix.compilerKind }}
139+
HCNAME: ${{ matrix.compiler }}
140+
HCVER: ${{ matrix.compilerVersion }}
141+
- name: env
142+
run: |
143+
env
144+
- name: write cabal config
145+
run: |
146+
mkdir -p $CABAL_DIR
147+
cat >> $CABAL_CONFIG <<EOF
148+
remote-build-reporting: anonymous
149+
write-ghc-environment-files: never
150+
remote-repo-cache: $CABAL_DIR/packages
151+
logs-dir: $CABAL_DIR/logs
152+
world-file: $CABAL_DIR/world
153+
extra-prog-path: $CABAL_DIR/bin
154+
symlink-bindir: $CABAL_DIR/bin
155+
installdir: $CABAL_DIR/bin
156+
build-summary: $CABAL_DIR/logs/build.log
157+
store-dir: $CABAL_DIR/store
158+
install-dirs user
159+
prefix: $CABAL_DIR
160+
repository hackage.haskell.org
161+
url: http://hackage.haskell.org/
162+
EOF
163+
if $HEADHACKAGE; then
164+
cat >> $CABAL_CONFIG <<EOF
165+
repository head.hackage.ghc.haskell.org
166+
url: https://ghc.gitlab.haskell.org/head.hackage/
167+
secure: True
168+
root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
169+
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
170+
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
171+
key-threshold: 3
172+
active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override
173+
EOF
174+
fi
175+
cat >> $CABAL_CONFIG <<EOF
176+
program-default-options
177+
ghc-options: $GHCJOBS +RTS -M3G -RTS
178+
EOF
179+
cat $CABAL_CONFIG
180+
- name: versions
181+
run: |
182+
$HC --version || true
183+
$HC --print-project-git-commit-id || true
184+
$CABAL --version || true
185+
- name: update cabal index
186+
run: |
187+
$CABAL v2-update -v
188+
- name: install cabal-plan
189+
run: |
190+
mkdir -p $HOME/.cabal/bin
191+
curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > cabal-plan.xz
192+
echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c -
193+
xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
194+
rm -f cabal-plan.xz
195+
chmod a+x $HOME/.cabal/bin/cabal-plan
196+
cabal-plan --version
197+
- name: checkout
198+
uses: actions/checkout@v4
199+
with:
200+
path: source
201+
- name: initial cabal.project for sdist
202+
run: |
203+
touch cabal.project
204+
echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project
205+
cat cabal.project
206+
- name: sdist
207+
run: |
208+
mkdir -p sdist
209+
$CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist
210+
- name: unpack
211+
run: |
212+
mkdir -p unpacked
213+
find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
214+
- name: generate cabal.project
215+
run: |
216+
PKGDIR_http_streams="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/http-streams-[0-9.]*')"
217+
echo "PKGDIR_http_streams=${PKGDIR_http_streams}" >> "$GITHUB_ENV"
218+
rm -f cabal.project cabal.project.local
219+
touch cabal.project
220+
touch cabal.project.local
221+
echo "packages: ${PKGDIR_http_streams}" >> cabal.project
222+
echo "package http-streams" >> cabal.project
223+
echo " ghc-options: -Werror=missing-methods" >> cabal.project
224+
cat >> cabal.project <<EOF
225+
EOF
226+
if $HEADHACKAGE; then
227+
echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1,/g')" >> cabal.project
228+
fi
229+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(http-streams)$/; }' >> cabal.project.local
230+
cat cabal.project
231+
cat cabal.project.local
232+
- name: dump install plan
233+
run: |
234+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
235+
cabal-plan
236+
- name: restore cache
237+
uses: actions/cache/restore@v3
238+
with:
239+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
240+
path: ~/.cabal/store
241+
restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
242+
- name: install dependencies
243+
run: |
244+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
245+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
246+
- name: build w/o tests
247+
run: |
248+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
249+
- name: build
250+
run: |
251+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
252+
- name: tests
253+
run: |
254+
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct
255+
- name: cabal check
256+
run: |
257+
cd ${PKGDIR_http_streams} || false
258+
${CABAL} -vnormal check
259+
- name: haddock
260+
run: |
261+
if [ $((HCNUMVER >= 80600)) -ne 0 ] ; then $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi
262+
- name: unconstrained build
263+
run: |
264+
rm -f cabal.project.local
265+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
266+
- name: save cache
267+
uses: actions/cache/save@v3
268+
if: always()
269+
with:
270+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
271+
path: ~/.cabal/store

cabal.haskell-ci

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
branches: main
2+
3+
haddock: >= 8.6

http-streams.cabal

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ author: Andrew Cowie <istathar@gmail.com>
1717
maintainer: Andrew Cowie <istathar@gmail.com>
1818
copyright: © 2012-2023 Athae Eredh Siniath and Others
1919
category: Web, IO-Streams
20-
tested-with: GHC == 8.10.7, GHC == 9.2.7, GHC == 9.4.5
2120
stability: experimental
2221
homepage: https://github.com/aesiniath/http-streams/
2322
bug-reports: https://github.com/aesiniath/http-streams/issues
@@ -39,6 +38,21 @@ extra-source-files: README.md CHANGELOG.md
3938

4039
build-type: Simple
4140

41+
tested-with:
42+
GHC == 9.8.0
43+
GHC == 9.6.3
44+
GHC == 9.4.7
45+
GHC == 9.2.8
46+
GHC == 9.0.2
47+
GHC == 8.10.7
48+
GHC == 8.8.4
49+
GHC == 8.6.5
50+
GHC == 8.4.4
51+
-- Build errors with GHC < 8.4
52+
-- GHC == 8.2.2
53+
-- GHC == 8.0.2
54+
-- GHC == 7.10.3
55+
4256
flag network-uri
4357
description: Get Network.URI from the network-uri package
4458
default: True
@@ -47,7 +61,7 @@ library
4761
default-language: Haskell2010
4862

4963
build-depends: attoparsec,
50-
base >= 4.5 && <5,
64+
base >= 4.11 && <5,
5165
directory,
5266
base64-bytestring,
5367
blaze-builder >= 0.4,
@@ -142,7 +156,7 @@ test-suite check
142156

143157
source-repository head
144158
type: git
145-
location: git://github.com/aesiniath/http-streams.git
159+
location: https://github.com/aesiniath/http-streams.git
146160

147161

148162
-- vim: set tabstop=21 expandtab:

0 commit comments

Comments
 (0)