@@ -101,9 +101,9 @@ makeGitHub
101101 -> Either HsCiError GitHub
102102makeGitHub _argv config@ Config {.. } gitconfig prj jobs@ JobVersions {.. } = do
103103 let envEnv = Map. fromList
104- [ (" HCNAME" , " ${{ matrix.compiler }} " ) -- e.g. ghc-8.8.4
105- , (" HCKIND" , " ${{ matrix.compilerKind }} " ) -- ghc
106- , (" HCVER" , " ${{ matrix.compilerVersion }} " ) -- 8.8.4
104+ [ (" HCNAME" , ghWrapExpr " matrix.compiler" ) -- e.g. ghc-8.8.4
105+ , (" HCKIND" , ghWrapExpr " matrix.compilerKind" ) -- ghc
106+ , (" HCVER" , ghWrapExpr " matrix.compilerVersion" ) -- 8.8.4
107107 ]
108108
109109 -- Validity checks
@@ -536,6 +536,15 @@ 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+ let range = RangeGHC /\ Range cfgWeeder in
541+ let ifCond = ghCompilerVersionArithPredicate allVersions range in
542+ for_ pkgs $ \ Pkg {pkgName} -> do
543+ githubUsesIf " weeder" " freckle/weeder-action@v2" ifCond $ buildList $ do
544+ item (" ghc-version" , ghWrapExpr " matrix.compilerVersion" )
545+ item (" weeder-arguments" , " --config $GITHUB_WORKSPACE/source/weeder.toml" )
546+ item (" working-directory" , ghWrapExpr $ ghEnvContext $ pkgNameDirVariable' pkgName)
547+
539548 -- unconstrained build
540549 unless (equivVersionRanges C. noVersion cfgUnconstrainted) $ githubRun " unconstrained build" $ do
541550 let range = Range cfgUnconstrainted
@@ -590,7 +599,7 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
590599 , ghjSteps = steps
591600 , ghjIf = Nothing
592601 , ghjContainer = Just $ " buildpack-deps:" ++ ubuntuVer
593- , ghjContinueOnError = Just " ${{ matrix.allow-failure }} "
602+ , ghjContinueOnError = Just $ ghWrapExpr " matrix.allow-failure"
594603 , ghjServices = mconcat
595604 [ Map. singleton " postgres" postgresService | cfgPostgres ]
596605 , ghjTimeout = max 10 cfgTimeoutMinutes
@@ -764,10 +773,10 @@ ircJob actionName mainJobName projectName cfg gitconfig = item ("irc", GitHubJob
764773 , Just repo <- parseGitHubRepo url
765774
766775 = Just
767- $ " ${{ always() && (github.repository == '" ++ T. unpack repo ++ " ') }} "
776+ $ ghWrapExpr " always() && (github.repository == '" ++ T. unpack repo ++ " ')"
768777
769778 | otherwise
770- = Just " ${{ always() }} "
779+ = Just $ ghWrapExpr " always()"
771780 -- Use always() above to ensure that the IRC job will still run even if
772781 -- the build job itself fails (see #437).
773782
@@ -855,3 +864,13 @@ parseGitHubRepo t =
855864-- runners support.
856865ghcRunsOnVer :: String
857866ghcRunsOnVer = " ubuntu-20.04"
867+
868+ ghWrapExpr :: String -> String
869+ ghWrapExpr expr = " ${{ " ++ expr ++ " }}"
870+
871+ ghEnvContext :: String -> String
872+ ghEnvContext = (" env." ++ )
873+
874+ ghCompilerVersionArithPredicate :: Set CompilerVersion -> CompilerRange -> String
875+ ghCompilerVersionArithPredicate = compilerVersionPredicateImpl $
876+ freeToArith $ ExprConfig ghWrapExpr ghEnvContext
0 commit comments