Skip to content

Commit 46daf81

Browse files
authored
agda-stdlib-utils: drop GHC < 8.6, modernise .cabal file, update CI (#1932)
With Agda-2.6.4 dropping GHC < 8.6, we can follow suit here. This encourages us to also bump the `cabal-version`, which allows us to modernise the `.cabal` file. Update the Haskell-CI to the latest versions. Also insert some `paths` triggers via the patching mechanism, so that this workflow does not run on the usual PRs that just contribute to the Agda code in the library.
1 parent da073f1 commit 46daf81

File tree

5 files changed

+96
-77
lines changed

5 files changed

+96
-77
lines changed

.github/haskell-ci.patch

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
--- workflows/haskell-ci.yml 2022-01-31 17:55:16.000000000 +0100
2-
+++ workflows/haskell-ci.yml-patched 2022-01-31 17:59:20.000000000 +0100
3-
@@ -14,8 +14,14 @@
4-
#
5-
name: Haskell-CI
6-
on:
7-
- - push
8-
- - pull_request
9-
+ push:
10-
+ branches:
11-
+ - master
12-
+ - experimental
13-
+ pull_request:
14-
+ branches:
15-
+ - master
16-
+ - experimental
1+
--- .github/workflows/haskell-ci.yml 2023-02-22 18:05:26.000000000 +0100
2+
+++ .github/workflows/haskell-ci.yml-patched 2023-02-22 18:04:31.000000000 +0100
3+
@@ -18,10 +18,20 @@
4+
branches:
5+
- master
6+
- experimental
7+
+ paths:
8+
+ - .github/workflows/haskell-ci.yml
9+
+ - agda-stdlib-utils.cabal
10+
+ - cabal.haskell-ci
11+
+ - *.hs
12+
pull_request:
13+
branches:
14+
- master
15+
- experimental
16+
+ paths:
17+
+ - .github/workflows/haskell-ci.yml
18+
+ - agda-stdlib-utils.cabal
19+
+ - cabal.haskell-ci
20+
+ - *.hs
1721
jobs:
1822
linux:
1923
name: Haskell-CI - Linux - ${{ matrix.compiler }}

.github/workflows/haskell-ci.yml

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#
99
# For more information, see https://github.com/haskell-CI/haskell-ci
1010
#
11-
# version: 0.14
11+
# version: 0.15.20230217
1212
#
13-
# REGENDATA ("0.14",["github","--no-cabal-check","agda-stdlib-utils.cabal"])
13+
# REGENDATA ("0.15.20230217",["github","--no-cabal-check","agda-stdlib-utils.cabal"])
1414
#
1515
name: Haskell-CI
1616
on:
@@ -25,7 +25,7 @@ on:
2525
jobs:
2626
linux:
2727
name: Haskell-CI - Linux - ${{ matrix.compiler }}
28-
runs-on: ubuntu-18.04
28+
runs-on: ubuntu-20.04
2929
timeout-minutes:
3030
60
3131
container:
@@ -34,9 +34,14 @@ jobs:
3434
strategy:
3535
matrix:
3636
include:
37-
- compiler: ghc-9.2.1
37+
- compiler: ghc-9.4.4
3838
compilerKind: ghc
39-
compilerVersion: 9.2.1
39+
compilerVersion: 9.4.4
40+
setup-method: ghcup
41+
allow-failure: false
42+
- compiler: ghc-9.2.6
43+
compilerKind: ghc
44+
compilerVersion: 9.2.6
4045
setup-method: ghcup
4146
allow-failure: false
4247
- compiler: ghc-9.0.2
@@ -59,21 +64,6 @@ jobs:
5964
compilerVersion: 8.6.5
6065
setup-method: hvr-ppa
6166
allow-failure: false
62-
- compiler: ghc-8.4.4
63-
compilerKind: ghc
64-
compilerVersion: 8.4.4
65-
setup-method: hvr-ppa
66-
allow-failure: false
67-
- compiler: ghc-8.2.2
68-
compilerKind: ghc
69-
compilerVersion: 8.2.2
70-
setup-method: hvr-ppa
71-
allow-failure: false
72-
- compiler: ghc-8.0.2
73-
compilerKind: ghc
74-
compilerVersion: 8.0.2
75-
setup-method: hvr-ppa
76-
allow-failure: false
7767
fail-fast: false
7868
steps:
7969
- name: apt
@@ -82,18 +72,20 @@ jobs:
8272
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
8373
if [ "${{ matrix.setup-method }}" = ghcup ]; then
8474
mkdir -p "$HOME/.ghcup/bin"
85-
curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup"
75+
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
8676
chmod a+x "$HOME/.ghcup/bin/ghcup"
87-
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER"
88-
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
77+
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
78+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
79+
"$HOME/.ghcup/bin/ghcup" install cabal 3.9.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
8980
else
9081
apt-add-repository -y 'ppa:hvr/ghc'
9182
apt-get update
9283
apt-get install -y "$HCNAME"
9384
mkdir -p "$HOME/.ghcup/bin"
94-
curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup"
85+
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
9586
chmod a+x "$HOME/.ghcup/bin/ghcup"
96-
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
87+
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
88+
"$HOME/.ghcup/bin/ghcup" install cabal 3.9.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
9789
fi
9890
env:
9991
HCKIND: ${{ matrix.compilerKind }}
@@ -111,13 +103,13 @@ jobs:
111103
echo "HC=$HC" >> "$GITHUB_ENV"
112104
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
113105
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
114-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
106+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.9.0.0 -vnormal+nowrap" >> "$GITHUB_ENV"
115107
else
116108
HC=$HCDIR/bin/$HCKIND
117109
echo "HC=$HC" >> "$GITHUB_ENV"
118110
echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
119111
echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
120-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
112+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.9.0.0 -vnormal+nowrap" >> "$GITHUB_ENV"
121113
fi
122114
123115
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
@@ -176,7 +168,7 @@ jobs:
176168
chmod a+x $HOME/.cabal/bin/cabal-plan
177169
cabal-plan --version
178170
- name: checkout
179-
uses: actions/checkout@v2
171+
uses: actions/checkout@v3
180172
with:
181173
path: source
182174
- name: initial cabal.project for sdist
@@ -200,8 +192,8 @@ jobs:
200192
touch cabal.project
201193
touch cabal.project.local
202194
echo "packages: ${PKGDIR_agda_stdlib_utils}" >> cabal.project
203-
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package agda-stdlib-utils" >> cabal.project ; fi
204-
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
195+
echo "package agda-stdlib-utils" >> cabal.project
196+
echo " ghc-options: -Werror=missing-methods" >> cabal.project
205197
cat >> cabal.project <<EOF
206198
EOF
207199
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(agda-stdlib-utils)$/; }' >> cabal.project.local
@@ -211,8 +203,8 @@ jobs:
211203
run: |
212204
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
213205
cabal-plan
214-
- name: cache
215-
uses: actions/cache@v2
206+
- name: restore cache
207+
uses: actions/cache/restore@v3
216208
with:
217209
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
218210
path: ~/.cabal/store
@@ -227,7 +219,16 @@ jobs:
227219
- name: build
228220
run: |
229221
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
222+
- name: haddock
223+
run: |
224+
$CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
230225
- name: unconstrained build
231226
run: |
232227
rm -f cabal.project.local
233228
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
229+
- name: save cache
230+
uses: actions/cache/save@v3
231+
if: always()
232+
with:
233+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
234+
path: ~/.cabal/store

HACKING.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,16 @@ Continuous Integration (CI)
267267
Updating the Haskell-CI workflow
268268
--------------------------------
269269

270-
The file `.github/workflows/haskell-ci.yml` is autogenerated by the
271-
tool `haskell-ci` but has some custom modification which need to be
272-
restored after each regeneration of this workflow.
270+
The file `.github/workflows/haskell-ci.yml` tests building the helpers specified in `agda-stdlib-utils.cabal`.
271+
It is autogenerated by the tool [haskell-ci]
272+
but has some custom modification which need to be restored after each regeneration of this workflow.
273273

274-
`haskell-ci` creates the workflow file from the contents of the
275-
`tested-with` field in the `agda-stdlib-utils.cabal` file. After
276-
updating this field, run the following:
274+
[haskell-ci] creates the workflow file from settings in the `cabal.haskell-ci` file
275+
and from the contents of the `tested-with` field in the `agda-stdlib-utils.cabal` file.
276+
After updating this field, run the following:
277277
```
278278
haskell-ci regenerate
279279
patch --input=.github/haskell-ci.patch .github/workflows/haskell-ci.yml
280280
```
281+
282+
[haskell-ci]: https://github.com/haskell-CI/haskell-ci

agda-stdlib-utils.cabal

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,43 @@
1+
cabal-version: 2.4
12
name: agda-stdlib-utils
2-
version: 2.0-dev
3-
cabal-version: >= 1.10
3+
version: 2.0
44
build-type: Simple
5-
description: Helper programs.
5+
description: Helper programs for setting up the Agda standard library.
66
license: MIT
7-
tested-with: GHC == 8.0.2
8-
GHC == 8.2.2
9-
GHC == 8.4.4
10-
GHC == 8.6.5
11-
GHC == 8.8.4
12-
GHC == 8.10.7
13-
GHC == 9.0.2
14-
GHC == 9.2.1
15-
GHC == 9.4.4
7+
8+
tested-with:
9+
GHC == 9.4.4
10+
GHC == 9.2.6
11+
GHC == 9.0.2
12+
GHC == 8.10.7
13+
GHC == 8.8.4
14+
GHC == 8.6.5
15+
16+
common common-build-parameters
17+
default-language:
18+
Haskell2010
19+
default-extensions:
20+
PatternGuards
21+
PatternSynonyms
22+
23+
build-depends:
24+
base >= 4.12.0.0 && < 4.18
25+
, filemanip >= 0.3.6.2 && < 0.4
1626

1727
executable GenerateEverything
28+
import: common-build-parameters
1829
hs-source-dirs: .
1930
main-is: GenerateEverything.hs
20-
default-language: Haskell2010
21-
default-extensions: PatternGuards, PatternSynonyms
22-
build-depends: base >= 4.9.0.0 && < 4.18
23-
, directory >= 1.0.0.0 && < 1.4
24-
, filemanip >= 0.3.6.2 && < 0.4
25-
, filepath >= 1.4.1.0 && < 1.5
26-
, mtl >= 2.2.2 && < 2.4
31+
32+
build-depends:
33+
directory >= 1.0.0.0 && < 1.4
34+
, filepath >= 1.4.1.0 && < 1.5
35+
, mtl >= 2.2.2 && < 2.4
2736

2837
executable AllNonAsciiChars
38+
import: common-build-parameters
2939
hs-source-dirs: .
3040
main-is: AllNonAsciiChars.hs
31-
default-language: Haskell2010
32-
build-depends: base >= 4.9.0.0 && < 4.18
33-
, filemanip >= 0.3.6.2 && < 0.4
34-
, text >= 1.2.3.0 && < 2.1
41+
42+
build-depends:
43+
text >= 1.2.3.1 && < 2.1

cabal.haskell-ci

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
branches: master experimental
2+
haddock-components: all
3+
cabal-check: False

0 commit comments

Comments
 (0)