Skip to content

Commit ceb0081

Browse files
authored
Use haskell-ci to generate CI workflow (#91)
* Switch from an apparently hand-written workflow (which no longer works) to one generated by `haskell-ci`. * Add GHC 9.6.1 to the `Tested-With` list, and update recent GHC versions to use the latest minor releases.
1 parent 3a45033 commit ceb0081

File tree

3 files changed

+260
-24
lines changed

3 files changed

+260
-24
lines changed

.github/workflows/haskell-ci.yml

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

.github/workflows/haskell.yaml

Lines changed: 0 additions & 23 deletions
This file was deleted.

pqueue.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ homepage: https://github.com/lspitzner/pqueue
1515
bug-reports: https://github.com/lspitzner/pqueue/issues
1616
build-type: Simple
1717
cabal-version: >= 1.10
18-
tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.7, GHC == 9.0.2, GHC == 9.2.4, GHC == 9.4.2
18+
tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.4,
19+
GHC == 8.10.7, GHC == 9.0.2, GHC == 9.2.7, GHC == 9.4.4, GHC == 9.6.1
1920
extra-source-files:
2021
CHANGELOG.md
2122
README.md

0 commit comments

Comments
 (0)