Skip to content

Commit 75c6287

Browse files
committed
Move hlint run into a separate CI workflow.
Recent versions of haskell-ci have dropped hlint support.
1 parent f88a6d7 commit 75c6287

File tree

2 files changed

+45
-26
lines changed

2 files changed

+45
-26
lines changed

.github/workflows/haskell-ci.yml

+15-26
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# This GitHub workflow config has been generated by a script via
22
#
3-
# haskell-ci 'github' '--hlint' '--hlint-job=9.4.8' '--doctest' '--doctest-version=^>= 0.22' '--installed=+all -Cabal' 'cabal2spec.cabal'
3+
# haskell-ci '--doctest' '--doctest-version=^>= 0.22' '--installed=+all -Cabal' 'github' 'cabal2spec.cabal'
44
#
55
# To regenerate the script (for example after adjusting tested-with) run
66
#
77
# haskell-ci regenerate
88
#
99
# For more information, see https://github.com/haskell-CI/haskell-ci
1010
#
11-
# version: 0.19.20240316
11+
# version: 0.19.20240708
1212
#
13-
# REGENDATA ("0.19.20240316",["github","--hlint","--hlint-job=9.4.8","--doctest","--doctest-version=^>= 0.22","--installed=+all -Cabal","cabal2spec.cabal"])
13+
# REGENDATA ("0.19.20240708",["--doctest","--doctest-version=^>= 0.22","--installed=+all -Cabal","github","cabal2spec.cabal"])
1414
#
1515
name: Haskell-CI
1616
on:
@@ -23,7 +23,7 @@ jobs:
2323
timeout-minutes:
2424
60
2525
container:
26-
image: buildpack-deps:bionic
26+
image: buildpack-deps:jammy
2727
continue-on-error: ${{ matrix.allow-failure }}
2828
strategy:
2929
matrix:
@@ -55,11 +55,10 @@ jobs:
5555
apt-get update
5656
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
5757
mkdir -p "$HOME/.ghcup/bin"
58-
curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup"
58+
curl -sL https://downloads.haskell.org/ghcup/0.1.30.0/x86_64-linux-ghcup-0.1.30.0 > "$HOME/.ghcup/bin/ghcup"
5959
chmod a+x "$HOME/.ghcup/bin/ghcup"
60-
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml;
6160
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
62-
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
61+
"$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
6362
env:
6463
HCKIND: ${{ matrix.compilerKind }}
6564
HCNAME: ${{ matrix.compiler }}
@@ -77,7 +76,7 @@ jobs:
7776
echo "HC=$HC" >> "$GITHUB_ENV"
7877
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
7978
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
80-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
79+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
8180
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
8281
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
8382
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
@@ -125,9 +124,9 @@ jobs:
125124
run: |
126125
$CABAL v2-update -v
127126
- name: cache (tools)
128-
uses: actions/cache/restore@v3
127+
uses: actions/cache/restore@v4
129128
with:
130-
key: ${{ runner.os }}-${{ matrix.compiler }}-tools-368d1a36
129+
key: ${{ runner.os }}-${{ matrix.compiler }}-tools-1cf0e533
131130
path: ~/.haskell-ci-tools
132131
- name: install cabal-plan
133132
run: |
@@ -142,20 +141,14 @@ jobs:
142141
run: |
143142
$CABAL --store-dir=$HOME/.haskell-ci-tools/store v2-install $ARG_COMPILER --ignore-project -j2 doctest --constraint='doctest ^>=0.22'
144143
doctest --version
145-
- name: install hlint
146-
run: |
147-
if [ $((HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then HLINTVER=$(cd /tmp && (${CABAL} v2-install -v $ARG_COMPILER --dry-run hlint --constraint='hlint >=3.5 && <3.6' | perl -ne 'if (/\bhlint-(\d+(\.\d+)*)\b/) { print "$1"; last; }')); echo "HLint version $HLINTVER" ; fi
148-
if [ $((HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then if [ ! -e $HOME/.haskell-ci-tools/hlint-$HLINTVER/hlint ]; then echo "Downloading HLint version $HLINTVER"; mkdir -p $HOME/.haskell-ci-tools; curl --write-out 'Status Code: %{http_code} Redirects: %{num_redirects} Total time: %{time_total} Total Dsize: %{size_download}\n' --silent --location --output $HOME/.haskell-ci-tools/hlint-$HLINTVER.tar.gz "https://github.com/ndmitchell/hlint/releases/download/v$HLINTVER/hlint-$HLINTVER-x86_64-linux.tar.gz"; tar -xzv -f $HOME/.haskell-ci-tools/hlint-$HLINTVER.tar.gz -C $HOME/.haskell-ci-tools; fi ; fi
149-
if [ $((HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then mkdir -p $CABAL_DIR/bin && ln -sf "$HOME/.haskell-ci-tools/hlint-$HLINTVER/hlint" $CABAL_DIR/bin/hlint ; fi
150-
if [ $((HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then hlint --version ; fi
151144
- name: save cache (tools)
152-
uses: actions/cache/save@v3
145+
uses: actions/cache/save@v4
153146
if: always()
154147
with:
155-
key: ${{ runner.os }}-${{ matrix.compiler }}-tools-368d1a36
148+
key: ${{ runner.os }}-${{ matrix.compiler }}-tools-1cf0e533
156149
path: ~/.haskell-ci-tools
157150
- name: checkout
158-
uses: actions/checkout@v3
151+
uses: actions/checkout@v4
159152
with:
160153
path: source
161154
- name: initial cabal.project for sdist
@@ -183,15 +176,15 @@ jobs:
183176
echo " ghc-options: -Werror=missing-methods" >> cabal.project
184177
cat >> cabal.project <<EOF
185178
EOF
186-
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(Cabal|cabal2spec)$/; }' >> cabal.project.local
179+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(Cabal|cabal2spec)$/; }' >> cabal.project.local
187180
cat cabal.project
188181
cat cabal.project.local
189182
- name: dump install plan
190183
run: |
191184
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
192185
cabal-plan
193186
- name: restore cache
194-
uses: actions/cache/restore@v3
187+
uses: actions/cache/restore@v4
195188
with:
196189
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
197190
path: ~/.cabal/store
@@ -213,10 +206,6 @@ jobs:
213206
run: |
214207
cd ${PKGDIR_cabal2spec} || false
215208
doctest -XHaskell2010 src
216-
- name: hlint
217-
run: |
218-
if [ $((HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then (cd ${PKGDIR_cabal2spec} && hlint -XHaskell2010 src) ; fi
219-
if [ $((HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then (cd ${PKGDIR_cabal2spec} && hlint -XHaskell2010 cabal2spec) ; fi
220209
- name: cabal check
221210
run: |
222211
cd ${PKGDIR_cabal2spec} || false
@@ -229,7 +218,7 @@ jobs:
229218
rm -f cabal.project.local
230219
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
231220
- name: save cache
232-
uses: actions/cache/save@v3
221+
uses: actions/cache/save@v4
233222
if: always()
234223
with:
235224
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}

.github/workflows/hlint.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# ~/src/cabal2spec/.github/workflows/hlint.yml
2+
3+
name: HLint
4+
on:
5+
- push
6+
- pull_request
7+
jobs:
8+
hlint:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: 'Set up HLint'
16+
uses: haskell-actions/hlint-setup@v2
17+
with:
18+
version: '3.8'
19+
20+
- name: 'Run HLint (src)'
21+
uses: haskell-actions/hlint-run@v2
22+
with:
23+
path: src/
24+
fail-on: suggestion
25+
26+
- name: 'Run HLint (test)'
27+
uses: haskell-actions/hlint-run@v2
28+
with:
29+
path: test/
30+
fail-on: suggestion

0 commit comments

Comments
 (0)