Skip to content

Commit 7c28f8b

Browse files
committed
Add separate HLint workflow
1 parent 6861cee commit 7c28f8b

File tree

3 files changed

+48
-29
lines changed

3 files changed

+48
-29
lines changed

.github/workflows/haskell-ci.yml

+5-27
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.19.20240416
11+
# version: 0.19.20240420
1212
#
13-
# REGENDATA ("0.19.20240416",["--config=cabal.haskell-ci","cabal.project"])
13+
# REGENDATA ("0.19.20240420",["--config=cabal.haskell-ci","cabal.project"])
1414
#
1515
name: Haskell-CI
1616
on:
@@ -178,11 +178,6 @@ jobs:
178178
- name: update cabal index
179179
run: |
180180
$CABAL v2-update -v
181-
- name: cache (tools)
182-
uses: actions/cache/restore@v3
183-
with:
184-
key: ${{ runner.os }}-${{ matrix.compiler }}-tools-d3d4cc06
185-
path: ~/.haskell-ci-tools
186181
- name: install cabal-plan
187182
run: |
188183
mkdir -p $HOME/.cabal/bin
@@ -201,20 +196,8 @@ jobs:
201196
rm -f cabal-docspec.xz
202197
chmod a+x $HOME/.cabal/bin/cabal-docspec
203198
cabal-docspec --version
204-
- name: install hlint
205-
run: |
206-
if [ $((HCNUMVER >= 90800 && HCNUMVER < 91000)) -ne 0 ] ; then HLINTVER=$(cd /tmp && (${CABAL} v2-install -v $ARG_COMPILER --dry-run hlint --constraint='hlint >=3.8 && <3.9' | perl -ne 'if (/\bhlint-(\d+(\.\d+)*)\b/) { print "$1"; last; }')); echo "HLint version $HLINTVER" ; fi
207-
if [ $((HCNUMVER >= 90800 && HCNUMVER < 91000)) -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
208-
if [ $((HCNUMVER >= 90800 && HCNUMVER < 91000)) -ne 0 ] ; then mkdir -p $CABAL_DIR/bin && ln -sf "$HOME/.haskell-ci-tools/hlint-$HLINTVER/hlint" $CABAL_DIR/bin/hlint ; fi
209-
if [ $((HCNUMVER >= 90800 && HCNUMVER < 91000)) -ne 0 ] ; then hlint --version ; fi
210-
- name: save cache (tools)
211-
uses: actions/cache/save@v3
212-
if: always()
213-
with:
214-
key: ${{ runner.os }}-${{ matrix.compiler }}-tools-d3d4cc06
215-
path: ~/.haskell-ci-tools
216199
- name: checkout
217-
uses: actions/checkout@v3
200+
uses: actions/checkout@v4
218201
with:
219202
path: source
220203
- name: initial cabal.project for sdist
@@ -265,7 +248,7 @@ jobs:
265248
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
266249
cabal-plan
267250
- name: restore cache
268-
uses: actions/cache/restore@v3
251+
uses: actions/cache/restore@v4
269252
with:
270253
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
271254
path: ~/.cabal/store
@@ -284,11 +267,6 @@ jobs:
284267
run: |
285268
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all
286269
cabal-docspec $ARG_COMPILER
287-
- name: hlint
288-
run: |
289-
if [ $((HCNUMVER >= 90800 && HCNUMVER < 91000)) -ne 0 ] ; then (cd ${PKGDIR_lens} && hlint -XHaskell2010 src) ; fi
290-
if [ $((HCNUMVER >= 90800 && HCNUMVER < 91000)) -ne 0 ] ; then (cd ${PKGDIR_lens_examples} && hlint -XHaskell2010 .) ; fi
291-
if [ $((HCNUMVER >= 90800 && HCNUMVER < 91000)) -ne 0 ] ; then (cd ${PKGDIR_lens_properties} && hlint -XHaskell2010 src) ; fi
292270
- name: cabal check
293271
run: |
294272
cd ${PKGDIR_lens} || false
@@ -301,7 +279,7 @@ jobs:
301279
run: |
302280
if [ $((HCNUMVER >= 80800)) -ne 0 ] ; then $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi
303281
- name: save cache
304-
uses: actions/cache/save@v3
282+
uses: actions/cache/save@v4
305283
if: always()
306284
with:
307285
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}

.github/workflows/hlint.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: HLint
2+
on:
3+
- push
4+
- pull_request
5+
jobs:
6+
hlint:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v4
12+
13+
- name: 'Set up HLint'
14+
uses: haskell-actions/hlint-setup@v2
15+
with:
16+
version: '3.8'
17+
18+
- name: 'Run HLint (lens)'
19+
uses: haskell-actions/hlint-run@v2
20+
with:
21+
path: src/
22+
fail-on: suggestion
23+
24+
# https://github.com/haskell-actions/hlint-run/issues/12
25+
- name: 'HLint config (lens-properties)'
26+
run: |
27+
cp lens-properties/.hlint.yml .
28+
29+
- name: 'Run HLint (lens-properties)'
30+
uses: haskell-actions/hlint-run@v2
31+
with:
32+
path: lens-properties/src/
33+
fail-on: suggestion
34+
35+
- name: 'HLint config (examples)'
36+
run: |
37+
cp examples/.hlint.yml .
38+
39+
- name: 'Run HLint (examples)'
40+
uses: haskell-actions/hlint-run@v2
41+
with:
42+
path: examples/
43+
fail-on: suggestion

cabal.haskell-ci

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
distribution: jammy
22
no-tests-no-benchmarks: False
33
unconstrained: False
4-
hlint: True
5-
hlint-version: >=3.8 && <3.9
64
apt: freeglut3-dev
75
-- irc-channels: irc.freenode.org#haskell-lens
86
irc-if-in-origin-repo: True

0 commit comments

Comments
 (0)