Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
24 changes: 12 additions & 12 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"ghc96"
"ghc98"
"ghc910"
"ghc912"
];
defaultCompiler = "ghc910";
};
Expand Down
3 changes: 1 addition & 2 deletions github-actions.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extra-source-files:
test/golden/configuration-main.hs.txt
test/golden/configuration-main.yml

tested-with: GHC ==9.6.6 || ==9.8.2 || ==9.10.1
tested-with: GHC ==9.6.6 || ==9.8.2 || ==9.10.1 || ==9.12.1

common opts
default-language: Haskell2010
Expand Down Expand Up @@ -82,7 +82,6 @@ test-suite spec
other-modules: Language.Github.Actions.WorkflowTest
build-tool-depends: tasty-discover:tasty-discover ^>=4.2.2
build-depends:
, bytestring ==0.11.5.3 || ==0.12.1.0
, filepath ^>=1.4 || ^>=1.5
, github-actions
, pretty-show ^>=1.10
Expand Down
11 changes: 5 additions & 6 deletions test/Language/Github/Actions/WorkflowTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ module Language.Github.Actions.WorkflowTest where

import qualified Data.Aeson as Aeson
import Data.Bifunctor (first)
import qualified Data.ByteString as BS
import Data.List (isPrefixOf)
import qualified Data.Text as Text
import Data.Text.Encoding (encodeUtf8)
import Data.Text.Encoding (decodeUtf8)
import qualified Data.Yaml as Yaml
import Hedgehog (Gen, Property, forAll, property, tripping)
import Language.Github.Actions.Workflow (Workflow)
Expand Down Expand Up @@ -50,13 +49,13 @@ test_goldenWorkflowFromYaml = do
putStrLn $ "roundtrip " <> takeBaseName testYamlFilePath
eitherWorkflow <- Yaml.decodeFileEither @Workflow testYamlFilePath
either
(BS.writeFile outputFilePath >> (\e -> fail $ "YAML decoding failed: " ++ show e))
(writeFile outputFilePath >> (\e -> fail $ "YAML decoding failed: " ++ show e))
(\workflow -> writeOutputFiles outputFilePath haskellOutputFilePath workflow >> pure workflow)
$ first (encodeUtf8 . Text.pack . Yaml.prettyPrintParseException) eitherWorkflow
$ first Yaml.prettyPrintParseException eitherWorkflow
writeOutputFiles :: FilePath -> FilePath -> Workflow -> IO ()
writeOutputFiles outputFilePath haskellOutputFilePath workflow = do
BS.writeFile outputFilePath (Yaml.encode workflow)
>> BS.writeFile haskellOutputFilePath (encodeUtf8 . Text.pack $ ppShow workflow)
writeFile outputFilePath (Text.unpack . decodeUtf8 $ Yaml.encode workflow)
>> writeFile haskellOutputFilePath (ppShow workflow)

hprop_WorkflowRoundTrip :: Property
hprop_WorkflowRoundTrip =
Expand Down
Loading