Skip to content

Commit 279ca0c

Browse files
authored
Merge pull request #11 from well-typed/edsko/9.8
Support up to GHC 9.8, enable CI
2 parents ee82c22 + a6a9e9d commit 279ca0c

File tree

3 files changed

+218
-4
lines changed

3 files changed

+218
-4
lines changed

.github/workflows/haskell-ci.yml

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
*.hi
55
*.o
66
dist-newstyle/
7+
.envrc

basic-sop.cabal

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ maintainer: [email protected]
1616
category: Generics
1717
build-type: Simple
1818
cabal-version: >=1.10
19-
tested-with: GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5
19+
tested-with: GHC==8.10.7, GHC==9.0.2, GHC==9.2.8, GHC==9.4.7, GHC==9.6.3, GHC==9.8.1
2020

2121
source-repository head
2222
type: git
@@ -30,9 +30,9 @@ library
3030
Generics.SOP.NFData
3131
build-depends: base >= 4.6 && < 5,
3232
generics-sop >= 0.2.3 && < 0.6,
33-
text >= 1.1 && < 1.3,
34-
QuickCheck >= 2.7 && < 2.14,
35-
deepseq >= 1.3 && < 1.5
33+
text >= 1.1 && < 2.2,
34+
QuickCheck >= 2.7 && < 2.15,
35+
deepseq >= 1.3 && < 1.6
3636
hs-source-dirs: src
3737
default-language: Haskell2010
3838
ghc-options: -Wall

0 commit comments

Comments
 (0)