Skip to content

Commit 35aee45

Browse files
committed
Allow base < 4.22, Haskell CI for GHC 9.2 - 9.12.0
1 parent 1020c59 commit 35aee45

File tree

5 files changed

+263
-2
lines changed

5 files changed

+263
-2
lines changed

.github/workflows/haskell-ci.yml

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

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist-newstyle/
2+
.stack-work/
3+

cabal.haskell-ci

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
branches: master

demo/demo.cabal

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@ cabal-version: 3.0
33
name: demo
44
version: 0
55

6+
tested-with:
7+
GHC == 9.12.0
8+
GHC == 9.10.1
9+
GHC == 9.8.2
10+
GHC == 9.6.6
11+
GHC == 9.4.8
12+
GHC == 9.2.8
13+
614
common base
715
default-language: GHC2021
816
ghc-options: -Wall
917
build-depends:
10-
, base ^>= 4.16 || ^>= 4.17 || ^>= 4.18
18+
, base ^>= 4.16 || ^>= 4.17 || ^>= 4.18 || ^>= 4.19 || ^>= 4.20 || ^>= 4.21
1119
, monads-tf
1220
default-extensions:
1321
TypeFamilies

monads-tf/monads-tf.cabal

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ description:
1616

1717
extra-source-files: *.md
1818

19+
tested-with:
20+
GHC == 9.12.0
21+
GHC == 9.10.1
22+
GHC == 9.8.2
23+
GHC == 9.6.6
24+
GHC == 9.4.8
25+
GHC == 9.2.8
26+
1927
library
2028
exposed-modules:
2129
Control.Monad.Cont
@@ -39,7 +47,7 @@ library
3947
Control.Monad.Writer.Lazy
4048
Control.Monad.Writer.Strict
4149
build-depends:
42-
, base ^>= 4.16 || ^>= 4.17 || ^>= 4.18
50+
, base ^>= 4.16 || ^>= 4.17 || ^>= 4.18 || ^>= 4.19 || ^>= 4.20 || ^>= 4.21
4351
, transformers ^>= 0.5.6 || ^>= 0.6
4452
default-extensions:
4553
TypeFamilies

0 commit comments

Comments
 (0)