Skip to content

Commit 5d035ba

Browse files
committed
Support for weeder step
1 parent 5e5b27d commit 5d035ba

File tree

6 files changed

+15
-1
lines changed

6 files changed

+15
-1
lines changed

cabal.haskell-ci

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ghc-head: False
2323
-- remove cabal noise from test output
2424
-- cabal-noise: False
2525

26-
-- Build tests. In addition to True and False you may specify
26+
-- Build tests. Alternatively to True and False you may specify
2727
-- a version range, e.g. >= 8.0 to build tests only in some jobs.
2828
tests: True
2929

src/HaskellCI/Auxiliary.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ data Auxiliary = Auxiliary
4949
, anyJobUsesPreviewGHC :: Bool
5050
, runHaddock :: Bool
5151
, haddockFlags :: String
52+
, runWeeder :: Bool
5253
}
5354

5455
auxiliary :: Config -> Project URI Void Package -> JobVersions -> Auxiliary
@@ -84,6 +85,8 @@ auxiliary Config {..} prj JobVersions {..} = Auxiliary {..}
8485
ComponentsAll -> " --haddock-all"
8586
ComponentsLibs -> ""
8687

88+
runWeeder = not (equivVersionRanges C.noVersion cfgWeeder)
89+
8790
extraCabalProjectFields :: FilePath -> [C.PrettyField ()]
8891
extraCabalProjectFields rootdir = buildList $ do
8992
-- generate package fields for URI packages.

src/HaskellCI/Config/Grammar.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ configGrammar = Config
9090
^^^ metahelp "RANGE" "Haddock step"
9191
<*> optionalFieldDef "haddock-components" (field @"cfgHaddockComponents") defaultConfig
9292
^^^ metahelp "all|libs" "Haddock components"
93+
<*> rangeField "weeder" (field @"cfgWeeder") defaultConfig
94+
^^^ metahelp "RANGE" "Weeder step"
9395
<*> rangeField "no-tests-no-benchmarks" (field @"cfgNoTestsNoBench") defaultConfig
9496
^^^ metahelp "RANGE" "Build without tests and benchmarks"
9597
<*> rangeField "unconstrained" (field @"cfgUnconstrainted") defaultConfig

src/HaskellCI/Config/Initial.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ initialConfig = Config
3737
, cfgBenchmarks = anyVersion
3838
, cfgHaddock = anyVersion
3939
, cfgHaddockComponents = ComponentsAll
40+
, cfgWeeder = anyVersion
4041
, cfgNoTestsNoBench = anyVersion
4142
, cfgUnconstrainted = anyVersion
4243
, cfgHeadHackage = defaultHeadHackage

src/HaskellCI/Config/Type.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ data Config = Config
4242
, cfgBenchmarks :: !VersionRange
4343
, cfgHaddock :: !VersionRange
4444
, cfgHaddockComponents :: !Components
45+
, cfgWeeder :: !VersionRange
4546
, cfgNoTestsNoBench :: !VersionRange
4647
, cfgUnconstrainted :: !VersionRange
4748
, cfgHeadHackage :: !VersionRange

src/HaskellCI/GitHub.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,13 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
536536
-- disable-documentation disables docs in deps: https://github.com/haskell/cabal/issues/7462
537537
sh_if range $ "$CABAL v2-haddock --disable-documentation" ++ haddockFlags ++ " $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all"
538538

539+
when runWeeder $
540+
for_ pkgs $ \Pkg{pkgName} -> do
541+
githubUses "weeder" "freckle/weeder-action@v2" $ buildList $ do
542+
item ("ghc-version", "${{ matrix.compilerVersion }}")
543+
item ("weeder-arguments", "--config $GITHUB_WORKSPACE/source/weeder.toml")
544+
item ("working-directory", pkgNameDirVariable pkgName)
545+
539546
-- unconstrained build
540547
unless (equivVersionRanges C.noVersion cfgUnconstrainted) $ githubRun "unconstrained build" $ do
541548
let range = Range cfgUnconstrainted

0 commit comments

Comments
 (0)