Skip to content

Commit 96673e1

Browse files
committed
Remove HLint support
Use separate workflow like in ekmett/lens#1066
1 parent 5a32e94 commit 96673e1

File tree

9 files changed

+19
-342
lines changed

9 files changed

+19
-342
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ jobs:
163163
- name: cache (tools)
164164
uses: actions/cache/restore@v4
165165
with:
166-
key: ${{ runner.os }}-${{ matrix.compiler }}-tools-e27a5680
166+
key: ${{ runner.os }}-${{ matrix.compiler }}-tools-4fd5cdc7
167167
path: ~/.haskell-ci-tools
168168
- name: install cabal-plan
169169
run: |
@@ -191,7 +191,7 @@ jobs:
191191
uses: actions/cache/save@v4
192192
if: always()
193193
with:
194-
key: ${{ runner.os }}-${{ matrix.compiler }}-tools-e27a5680
194+
key: ${{ runner.os }}-${{ matrix.compiler }}-tools-4fd5cdc7
195195
path: ~/.haskell-ci-tools
196196
- name: checkout
197197
uses: actions/checkout@v4

cabal.haskell-ci

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,6 @@ branches: master
6767
-- irc-password: ${{ secrets.MyIrcBotPassword }}
6868
-- irc-if-in-origin-repo: True
6969

70-
-- Sections to fold in the build output
71-
folds: constraint-sets
72-
73-
-- Run HLint
74-
hlint: True
75-
hlint-job: 9.2.4
76-
hlint-yaml: .hlint.yaml
77-
hlint-download-binary: True
78-
-- hlint-version: ==3.1.*
79-
8070
-- Run doctest (on GHC-8.0+ which support .ghc.environment)
8171
doctest: <9
8272
doctest-options: --fast

haskell-ci.cabal

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.2
22
name: haskell-ci
3-
version: 0.19.20240420
3+
version: 0.19.20240421
44
synopsis: Cabal package script generator for Travis-CI
55
description:
66
Script generator (@haskell-ci@) for
@@ -94,8 +94,6 @@ library haskell-ci-internal
9494
HaskellCI.Config.Doctest
9595
HaskellCI.Config.Dump
9696
HaskellCI.Config.Empty
97-
HaskellCI.Config.Folds
98-
HaskellCI.Config.HLint
9997
HaskellCI.Config.Installed
10098
HaskellCI.Config.Jobs
10199
HaskellCI.Config.PackageScope

src/HaskellCI/Config.hs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import HaskellCI.Config.CopyFields
2929
import HaskellCI.Config.Docspec
3030
import HaskellCI.Config.Doctest
3131
import HaskellCI.Config.Empty
32-
import HaskellCI.Config.Folds
33-
import HaskellCI.Config.HLint
3432
import HaskellCI.Config.Installed
3533
import HaskellCI.Config.Jobs
3634
import HaskellCI.Config.PackageScope
@@ -79,7 +77,6 @@ data Config = Config
7977
, cfgIrcIfInOriginRepo :: Bool
8078
, cfgEmailNotifications :: Bool
8179
, cfgProjectName :: Maybe String
82-
, cfgFolds :: S.Set Fold
8380
, cfgGhcHead :: !Bool
8481
, cfgPostgres :: !Bool
8582
, cfgGoogleChrome :: !Bool
@@ -98,7 +95,6 @@ data Config = Config
9895
, cfgErrorMissingMethods :: !PackageScope
9996
, cfgDoctest :: !DoctestConfig
10097
, cfgDocspec :: !DocspecConfig
101-
, cfgHLint :: !HLintConfig
10298
, cfgConstraintSets :: [ConstraintSet]
10399
, cfgRawProject :: [C.PrettyField ()]
104100
, cfgRawTravis :: !String
@@ -118,7 +114,6 @@ emptyConfig = case runEG configGrammar of
118114

119115
configGrammar
120116
:: ( OptionsGrammar c g, Applicative (g Config)
121-
, c (Identity HLintJob)
122117
, c (Identity PackageScope)
123118
, c (Identity TestedWithJobs)
124119
, c (Identity Ubuntu)
@@ -127,11 +122,11 @@ configGrammar
127122
, c (Identity Version)
128123
, c (Identity Natural)
129124
, c (Identity Components)
130-
, c Env, c Folds, c CopyFields, c HeadVersion
125+
, c Env, c CopyFields, c HeadVersion
131126
, c (C.List C.FSep (Identity Installed) Installed)
132127
, Applicative (g DoctestConfig)
133128
, Applicative (g DocspecConfig)
134-
, Applicative (g HLintConfig))
129+
)
135130
=> g Config Config
136131
configGrammar = Config
137132
<$> C.optionalFieldDefAla "cabal-install-version" HeadVersion (field @"cfgCabalInstallVersion") defaultCabalInstallVersion
@@ -200,8 +195,6 @@ configGrammar = Config
200195
^^^ help "Disable email notifications"
201196
<*> C.optionalFieldAla "project-name" C.Token' (field @"cfgProjectName")
202197
^^^ metahelp "NAME" "Project name (used for IRC notifications), defaults to package name or name of first package listed in cabal.project file"
203-
<*> C.monoidalFieldAla "folds" Folds (field @"cfgFolds")
204-
^^^ metahelp "FOLD" "Build steps to fold"
205198
<*> C.booleanFieldDef "ghc-head" (field @"cfgGhcHead") False
206199
^^^ help "Add ghc-head job"
207200
<*> C.booleanFieldDef "postgresql" (field @"cfgPostgres") False
@@ -236,7 +229,6 @@ configGrammar = Config
236229
^^^ metahelp "PKGSCOPE" "Insert -Werror=missing-methods for package scope (none, local, all)"
237230
<*> C.blurFieldGrammar (field @"cfgDoctest") doctestConfigGrammar
238231
<*> C.blurFieldGrammar (field @"cfgDocspec") docspecConfigGrammar
239-
<*> C.blurFieldGrammar (field @"cfgHLint") hlintConfigGrammar
240232
<*> pure [] -- constraint sets
241233
<*> pure [] -- raw project fields
242234
<*> C.freeTextFieldDef "raw-travis" (field @"cfgRawTravis")

src/HaskellCI/Config/Folds.hs

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

src/HaskellCI/Config/HLint.hs

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

src/HaskellCI/GitHub.hs

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import HaskellCI.Config
3535
import HaskellCI.Config.ConstraintSet
3636
import HaskellCI.Config.Docspec
3737
import HaskellCI.Config.Doctest
38-
import HaskellCI.Config.HLint
3938
import HaskellCI.Config.Installed
4039
import HaskellCI.Config.Jobs
4140
import HaskellCI.Config.PackageScope
@@ -310,10 +309,9 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
310309
let toolsConfigHash :: String
311310
toolsConfigHash = take 8 $ BS8.unpack $ Base16.encode $ SHA256.hashlazy $ Binary.runPut $ do
312311
Binary.put cfgDoctest
313-
Binary.put cfgHLint
314312
Binary.put cfgGhcupJobs -- GHC location affects doctest, e.g
315313

316-
when (doctestEnabled || cfgHLintEnabled cfgHLint) $ githubUses "cache (tools)" "actions/cache/restore@v4"
314+
when (doctestEnabled) $ githubUses "cache (tools)" "actions/cache/restore@v4"
317315
[ ("key", "${{ runner.os }}-${{ matrix.compiler }}-tools-" ++ toolsConfigHash)
318316
, ("path", "~/.haskell-ci-tools")
319317
]
@@ -350,31 +348,7 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
350348
sh_if range $ "$CABAL --store-dir=$HOME/.haskell-ci-tools/store v2-install $ARG_COMPILER --ignore-project -j2 doctest" ++ doctestVersionConstraint
351349
sh_if range "doctest --version"
352350

353-
let hlintVersionConstraint
354-
| C.isAnyVersion (cfgHLintVersion cfgHLint) = ""
355-
| otherwise = " --constraint='hlint " ++ prettyShow (cfgHLintVersion cfgHLint) ++ "'"
356-
when (cfgHLintEnabled cfgHLint) $ githubRun "install hlint" $ do
357-
let forHLint = sh_if (hlintJobVersionRange allVersions cfgHeadHackage (cfgHLintJob cfgHLint))
358-
if cfgHLintDownload cfgHLint
359-
then do
360-
-- install --dry-run and use perl regex magic to find a hlint version
361-
-- -v is important
362-
forHLint $ "HLINTVER=$(cd /tmp && (${CABAL} v2-install -v $ARG_COMPILER --dry-run hlint " ++ hlintVersionConstraint ++ " | perl -ne 'if (/\\bhlint-(\\d+(\\.\\d+)*)\\b/) { print \"$1\"; last; }')); echo \"HLint version $HLINTVER\""
363-
forHLint $ "if [ ! -e $HOME/.haskell-ci-tools/hlint-$HLINTVER/hlint ]; then " ++ unwords
364-
[ "echo \"Downloading HLint version $HLINTVER\";"
365-
, "mkdir -p $HOME/.haskell-ci-tools;"
366-
, "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\";"
367-
, "tar -xzv -f $HOME/.haskell-ci-tools/hlint-$HLINTVER.tar.gz -C $HOME/.haskell-ci-tools;"
368-
, "fi"
369-
]
370-
forHLint "mkdir -p $CABAL_DIR/bin && ln -sf \"$HOME/.haskell-ci-tools/hlint-$HLINTVER/hlint\" $CABAL_DIR/bin/hlint"
371-
forHLint "hlint --version"
372-
373-
else do
374-
forHLint $ "$CABAL --store-dir=$HOME/.haskell-ci-tools/store v2-install $ARG_COMPILER --ignore-project -j2 hlint" ++ hlintVersionConstraint
375-
forHLint "hlint --version"
376-
377-
when (doctestEnabled || cfgHLintEnabled cfgHLint) $ githubUsesIf "save cache (tools)" "actions/cache/save@v4" "always()"
351+
when (doctestEnabled) $ githubUsesIf "save cache (tools)" "actions/cache/save@v4" "always()"
378352
[ ("key", "${{ runner.os }}-${{ matrix.compiler }}-tools-" ++ toolsConfigHash)
379353
, ("path", "~/.haskell-ci-tools")
380354
]
@@ -550,24 +524,6 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
550524
sh_if docspecRange' "$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all"
551525
sh_if docspecRange' cabalDocspec
552526

553-
-- hlint
554-
when (cfgHLintEnabled cfgHLint) $ githubRun "hlint" $ do
555-
let "" <+> ys = ys
556-
xs <+> "" = xs
557-
xs <+> ys = xs ++ " " ++ ys
558-
559-
prependSpace "" = ""
560-
prependSpace xs = " " ++ xs
561-
562-
let hlintOptions = prependSpace $ maybe "" ("-h ${GITHUB_WORKSPACE}/source/" ++) (cfgHLintYaml cfgHLint) <+> unwords (cfgHLintOptions cfgHLint)
563-
564-
for_ pkgs $ \Pkg{pkgName,pkgGpd,pkgJobs} -> do
565-
for_ (hlintArgs pkgGpd) $ \args -> do
566-
let args' = unwords args
567-
unless (null args) $
568-
sh_if (hlintJobVersionRange allVersions cfgHeadHackage (cfgHLintJob cfgHLint) /\ RangePoints pkgJobs) $
569-
"(cd " ++ pkgNameDirVariable pkgName ++ " && hlint" ++ hlintOptions ++ " " ++ args' ++ ")"
570-
571527
-- cabal check
572528
when cfgCheck $ githubRun "cabal check" $ do
573529
for_ pkgs $ \Pkg{pkgName,pkgJobs} -> do

0 commit comments

Comments
 (0)