Skip to content

Commit 01990bd

Browse files
committed
CI: bump to latest Haskell-CI and GHC versions (9.6.0, 9.4.4, 9.2.5)
Also: - Restrict CI to PRs and dedicated branches (avoid duplicate CI runs). - Describe in DEVELOPER.md how to update the CI.
1 parent 24ab083 commit 01990bd

File tree

5 files changed

+113
-26
lines changed

5 files changed

+113
-26
lines changed

Diff for: .github/haskell-ci.patch

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
--- .github/workflows/haskell-ci.yml 2021-06-15 15:05:48.000000000 +0200
2-
+++ .github/workflows/haskell-ci.yml.patched 2021-06-15 15:05:35.000000000 +0200
3-
@@ -162,10 +162,23 @@
1+
--- .github/workflows/haskell-ci.yml 2023-02-08 20:09:03.000000000 +0100
2+
+++ .github/workflows/haskell-ci.yml-patched 2023-02-08 20:08:57.000000000 +0100
3+
@@ -226,10 +226,23 @@
44
rm -f cabal-plan.xz
55
chmod a+x $HOME/.cabal/bin/cabal-plan
66
cabal-plan --version
@@ -10,7 +10,7 @@
1010
+ $CABAL v2-install $ARG_COMPILER alex happy
1111
+
1212
- name: checkout
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v3
1414
with:
1515
path: source
1616
+
@@ -24,7 +24,7 @@
2424
- name: initial cabal.project for sdist
2525
run: |
2626
touch cabal.project
27-
@@ -208,15 +221,21 @@
27+
@@ -275,15 +288,21 @@
2828
run: |
2929
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
3030
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all

Diff for: .github/workflows/haskell-ci.yml

+62-18
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,26 @@
88
#
99
# For more information, see https://github.com/haskell-CI/haskell-ci
1010
#
11-
# version: 0.14.1
11+
# version: 0.15.20230203
1212
#
13-
# REGENDATA ("0.14.1",["github","alex.cabal"])
13+
# REGENDATA ("0.15.20230203",["github","alex.cabal"])
1414
#
1515
name: Haskell-CI
1616
on:
17-
- push
18-
- pull_request
17+
push:
18+
branches:
19+
- master
20+
- ci-*
21+
- release-*
22+
pull_request:
23+
branches:
24+
- master
25+
- ci-*
26+
- release-*
1927
jobs:
2028
linux:
2129
name: Haskell-CI - Linux - ${{ matrix.compiler }}
22-
runs-on: ubuntu-18.04
30+
runs-on: ubuntu-20.04
2331
timeout-minutes:
2432
60
2533
container:
@@ -28,9 +36,19 @@ jobs:
2836
strategy:
2937
matrix:
3038
include:
31-
- compiler: ghc-9.2.1
39+
- compiler: ghc-9.6.0.20230128
3240
compilerKind: ghc
33-
compilerVersion: 9.2.1
41+
compilerVersion: 9.6.0.20230128
42+
setup-method: ghcup
43+
allow-failure: true
44+
- compiler: ghc-9.4.4
45+
compilerKind: ghc
46+
compilerVersion: 9.4.4
47+
setup-method: ghcup
48+
allow-failure: false
49+
- compiler: ghc-9.2.5
50+
compilerKind: ghc
51+
compilerVersion: 9.2.5
3452
setup-method: ghcup
3553
allow-failure: false
3654
- compiler: ghc-9.0.2
@@ -101,18 +119,20 @@ jobs:
101119
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
102120
if [ "${{ matrix.setup-method }}" = ghcup ]; then
103121
mkdir -p "$HOME/.ghcup/bin"
104-
curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup"
122+
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
105123
chmod a+x "$HOME/.ghcup/bin/ghcup"
106-
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER"
107-
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
124+
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
125+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
126+
"$HOME/.ghcup/bin/ghcup" install cabal 3.9.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
108127
else
109128
apt-add-repository -y 'ppa:hvr/ghc'
110129
apt-get update
111130
apt-get install -y "$HCNAME"
112131
mkdir -p "$HOME/.ghcup/bin"
113-
curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup"
132+
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
114133
chmod a+x "$HOME/.ghcup/bin/ghcup"
115-
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
134+
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
135+
"$HOME/.ghcup/bin/ghcup" install cabal 3.9.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
116136
fi
117137
env:
118138
HCKIND: ${{ matrix.compilerKind }}
@@ -130,20 +150,20 @@ jobs:
130150
echo "HC=$HC" >> "$GITHUB_ENV"
131151
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
132152
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
133-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
153+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.9.0.0 -vnormal+nowrap" >> "$GITHUB_ENV"
134154
else
135155
HC=$HCDIR/bin/$HCKIND
136156
echo "HC=$HC" >> "$GITHUB_ENV"
137157
echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
138158
echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
139-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
159+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.9.0.0 -vnormal+nowrap" >> "$GITHUB_ENV"
140160
fi
141161
142162
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
143163
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
144164
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
145165
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
146-
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
166+
if [ $((HCNUMVER >= 90600)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi
147167
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
148168
echo "GHCJSARITH=0" >> "$GITHUB_ENV"
149169
env:
@@ -172,6 +192,18 @@ jobs:
172192
repository hackage.haskell.org
173193
url: http://hackage.haskell.org/
174194
EOF
195+
if $HEADHACKAGE; then
196+
cat >> $CABAL_CONFIG <<EOF
197+
repository head.hackage.ghc.haskell.org
198+
url: https://ghc.gitlab.haskell.org/head.hackage/
199+
secure: True
200+
root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
201+
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
202+
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
203+
key-threshold: 3
204+
active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override
205+
EOF
206+
fi
175207
cat >> $CABAL_CONFIG <<EOF
176208
program-default-options
177209
ghc-options: $GHCJOBS +RTS -M3G -RTS
@@ -200,7 +232,7 @@ jobs:
200232
$CABAL v2-install $ARG_COMPILER alex happy
201233
202234
- name: checkout
203-
uses: actions/checkout@v2
235+
uses: actions/checkout@v3
204236
with:
205237
path: source
206238

@@ -236,15 +268,18 @@ jobs:
236268
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
237269
cat >> cabal.project <<EOF
238270
EOF
271+
if $HEADHACKAGE; then
272+
echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1,/g')" >> cabal.project
273+
fi
239274
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(alex)$/; }' >> cabal.project.local
240275
cat cabal.project
241276
cat cabal.project.local
242277
- name: dump install plan
243278
run: |
244279
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
245280
cabal-plan
246-
- name: cache
247-
uses: actions/cache@v2
281+
- name: restore cache
282+
uses: actions/cache/restore@v3
248283
with:
249284
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
250285
path: ~/.cabal/store
@@ -272,7 +307,16 @@ jobs:
272307
run: |
273308
cd ${PKGDIR_alex} || false
274309
${CABAL} -vnormal check
310+
- name: haddock
311+
run: |
312+
$CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
275313
- name: unconstrained build
276314
run: |
277315
rm -f cabal.project.local
278316
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
317+
- name: save cache
318+
uses: actions/cache/save@v3
319+
if: always()
320+
with:
321+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
322+
path: ~/.cabal/store

Diff for: DEVELOPER.md

+36
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,39 @@ When new GHC versions become available, CI can be updated by
2323
This should work as long as `haskell-ci` does not change its generated
2424
workflow too much. Otherwise, the patch might not apply cleanly and
2525
the workflow has to be patched manually.
26+
27+
Updating to a new version of Haskell-CI
28+
---------------------------------------
29+
30+
2023-02-08
31+
32+
1. Install Haskell-CI from its source repo:
33+
34+
pushd /tmp
35+
git clone https://github.com/haskell-CI/haskell-ci.git
36+
cd haskell-ci
37+
cabal install
38+
popd
39+
40+
2. Update the `tested-with` fields in the `.cabal` files.
41+
42+
3. Follow the instructions to regenerate the Haskell CI workflow, which are:
43+
44+
haskell-ci regenerate
45+
patch --input=.github/haskell-ci.patch .github/workflows/haskell-ci.yml
46+
47+
If some hunks fail to apply in the last step, the patch as to be updated.
48+
49+
4. Apply the remaining hunks manually.
50+
51+
5. Save the patched workflow, regenerate the original workflow, regenerate the patch
52+
53+
cp .github/workflows/haskell-ci.yml .github/workflows/haskell-ci.yml-patched
54+
haskell-ci regenerate
55+
diff -u .github/workflows/haskell-ci.yml .github/workflows/haskell-ci.yml-patched > .github/haskell-ci.patch
56+
57+
6. Now the patch will apply cleanly.
58+
59+
patch --input=.github/haskell-ci.patch .github/workflows/haskell-ci.yml
60+
61+
7. Commit the updated files (no extra files need to be committed).

Diff for: alex.cabal

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license-file: LICENSE
77
copyright: (c) Chis Dornan, Simon Marlow
88
author: Chris Dornan and Simon Marlow
99
maintainer: Simon Marlow <[email protected]>
10-
bug-reports: https://github.com/simonmar/alex/issues
10+
bug-reports: https://github.com/haskell/alex/issues
1111
stability: stable
1212
homepage: http://www.haskell.org/alex/
1313
synopsis: Alex is a tool for generating lexical analysers in Haskell
@@ -22,7 +22,9 @@ category: Development
2222
build-type: Simple
2323

2424
tested-with:
25-
GHC == 9.2.1
25+
GHC == 9.6.0
26+
GHC == 9.4.4
27+
GHC == 9.2.5
2628
GHC == 9.0.2
2729
GHC == 8.10.7
2830
GHC == 8.8.4
@@ -93,7 +95,7 @@ extra-source-files:
9395

9496
source-repository head
9597
type: git
96-
location: https://github.com/simonmar/alex.git
98+
location: https://github.com/haskell/alex.git
9799

98100
executable alex
99101
hs-source-dirs: src

Diff for: cabal.haskell-ci

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
branches: master ci-* release-*
2+
3+
-- -- For bootstrapping:
4+
-- apt: alex happy
5+
-- alex in the distribution might be too old.

0 commit comments

Comments
 (0)