Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more information to the generated GitHub build matrix #64

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions app/Main.hs
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ import System.Exit
import GetTested.CLI.Types
import GetTested.Extract
import GetTested.Types
import Paths_get_tested (version)
import Paths_get_tested qualified

main :: IO ()
main = do
@@ -57,7 +57,7 @@ parseOptions =
<*> optional (strOption (long "windows-version" <> metavar "VERSION" <> help "Enable the Windows runner with the selected version"))
<*> switch (long "newest" <> help "Enable only the newest GHC version found in the cabal file")
<*> switch (long "oldest" <> help "Enable only the oldest GHC version found in the cabal file")
<**> simpleVersioner (showVersion version)
<**> simpleVersioner (showVersion Paths_get_tested.version)

runOptions :: Options -> Eff [Console, FileSystem, Error ProcessingError, IOE] ByteString
runOptions options = do
@@ -70,10 +70,25 @@ runOptions options = do
processOSFlag MacOS options.macosFlag options.macosVersion
<> processOSFlag Ubuntu options.ubuntuFlag options.ubuntuVersion
<> processOSFlag Windows options.windowsFlag options.windowsVersion
isOldestCompiler =
if Vector.null selectedCompilers
then const False
else \version -> version == Vector.minimum selectedCompilers
isNewestCompiler =
if Vector.null selectedCompilers
then const False
else \version -> version == Vector.maximum selectedCompilers
makePlatformAndVersion os ghc =
PlatformAndVersion
{ os
, ghc
, oldest = isOldestCompiler ghc
, newest = isNewestCompiler ghc
}
if null filteredList
then pure $ Aeson.encode selectedCompilers
else do
let include = PlatformAndVersion <$> filteredList <*> selectedCompilers
let include = makePlatformAndVersion <$> filteredList <*> selectedCompilers
pure $ "matrix=" <> Aeson.encode (ActionMatrix include)

withInfo :: Parser a -> String -> ParserInfo a
2 changes: 2 additions & 0 deletions src/GetTested/Types.hs
Original file line number Diff line number Diff line change
@@ -45,10 +45,10 @@
maybe (fail "Invalid compiler flavor") pure (simpleParsec $ Text.unpack s)

instance Display CompilerFlavor where
displayBuilder = Builder.fromString . Pretty.prettyShow

Check failure on line 48 in src/GetTested/Types.hs

GitHub Actions / 9.10.1 on alpine-3.20

• Couldn't match type ‘Builder.Builder’

Check failure on line 48 in src/GetTested/Types.hs

GitHub Actions / 9.10.1 on ubuntu-latest

• Couldn't match type ‘Builder.Builder’

instance Display VersionRange where
displayBuilder = Builder.fromString . Pretty.prettyShow

Check failure on line 51 in src/GetTested/Types.hs

GitHub Actions / 9.10.1 on alpine-3.20

• Couldn't match type ‘Builder.Builder’

Check failure on line 51 in src/GetTested/Types.hs

GitHub Actions / 9.10.1 on ubuntu-latest

• Couldn't match type ‘Builder.Builder’

instance ToJSON Version where
toJSON = toJSON . Pretty.prettyShow
@@ -66,6 +66,8 @@
data PlatformAndVersion = PlatformAndVersion
{ os :: Text
, ghc :: Version
, oldest :: Bool
, newest :: Bool
}
deriving stock (Eq, Ord, Generic)
deriving anyclass (ToJSON)

Unchanged files with check annotations Beta

Vector.concatMap
( \(f, range) ->
let expandedVersions = expandUnionVersionRange range
in Vector.map (\v -> (f, v)) expandedVersions

Check warning on line 98 in src/GetTested/Extract.hs

GitHub Actions / hlint

Suggestion in expandUnionVersionRanges in module GetTested.Extract: Use tuple-section ▫︎ Found: "\\ v -> (f, v)" ▫︎ Perhaps: "(f,)" ▫︎ Note: may require `{-# LANGUAGE TupleSections #-}` adding to the top of the file
)
ranges