Skip to content

Commit

Permalink
Support for weeder step
Browse files Browse the repository at this point in the history
  • Loading branch information
kostmo committed Jul 18, 2024
1 parent 5e5b27d commit 5d035ba
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cabal.haskell-ci
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ghc-head: False
-- remove cabal noise from test output
-- cabal-noise: False

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

Expand Down
3 changes: 3 additions & 0 deletions src/HaskellCI/Auxiliary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ data Auxiliary = Auxiliary
, anyJobUsesPreviewGHC :: Bool
, runHaddock :: Bool
, haddockFlags :: String
, runWeeder :: Bool
}

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

runWeeder = not (equivVersionRanges C.noVersion cfgWeeder)

extraCabalProjectFields :: FilePath -> [C.PrettyField ()]
extraCabalProjectFields rootdir = buildList $ do
-- generate package fields for URI packages.
Expand Down
2 changes: 2 additions & 0 deletions src/HaskellCI/Config/Grammar.hs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ configGrammar = Config
^^^ metahelp "RANGE" "Haddock step"
<*> optionalFieldDef "haddock-components" (field @"cfgHaddockComponents") defaultConfig
^^^ metahelp "all|libs" "Haddock components"
<*> rangeField "weeder" (field @"cfgWeeder") defaultConfig
^^^ metahelp "RANGE" "Weeder step"
<*> rangeField "no-tests-no-benchmarks" (field @"cfgNoTestsNoBench") defaultConfig
^^^ metahelp "RANGE" "Build without tests and benchmarks"
<*> rangeField "unconstrained" (field @"cfgUnconstrainted") defaultConfig
Expand Down
1 change: 1 addition & 0 deletions src/HaskellCI/Config/Initial.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ initialConfig = Config
, cfgBenchmarks = anyVersion
, cfgHaddock = anyVersion
, cfgHaddockComponents = ComponentsAll
, cfgWeeder = anyVersion
, cfgNoTestsNoBench = anyVersion
, cfgUnconstrainted = anyVersion
, cfgHeadHackage = defaultHeadHackage
Expand Down
1 change: 1 addition & 0 deletions src/HaskellCI/Config/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ data Config = Config
, cfgBenchmarks :: !VersionRange
, cfgHaddock :: !VersionRange
, cfgHaddockComponents :: !Components
, cfgWeeder :: !VersionRange
, cfgNoTestsNoBench :: !VersionRange
, cfgUnconstrainted :: !VersionRange
, cfgHeadHackage :: !VersionRange
Expand Down
7 changes: 7 additions & 0 deletions src/HaskellCI/GitHub.hs
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,13 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
-- disable-documentation disables docs in deps: https://github.com/haskell/cabal/issues/7462
sh_if range $ "$CABAL v2-haddock --disable-documentation" ++ haddockFlags ++ " $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all"

when runWeeder $
for_ pkgs $ \Pkg{pkgName} -> do
githubUses "weeder" "freckle/weeder-action@v2" $ buildList $ do
item ("ghc-version", "${{ matrix.compilerVersion }}")
item ("weeder-arguments", "--config $GITHUB_WORKSPACE/source/weeder.toml")
item ("working-directory", pkgNameDirVariable pkgName)

-- unconstrained build
unless (equivVersionRanges C.noVersion cfgUnconstrainted) $ githubRun "unconstrained build" $ do
let range = Range cfgUnconstrainted
Expand Down

0 comments on commit 5d035ba

Please sign in to comment.