Skip to content
Merged
Show file tree
Hide file tree
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
19 changes: 19 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ project("github-tools")
haskell_library(
name = "github-tools",
srcs = glob(["src/**/*.*hs"]),
compiler_flags = [
"-j4",
"-Wall",
"-Werror",
"-Wno-unused-imports",
],
prebuilt_dependencies = [
"base",
"bytestring",
Expand Down Expand Up @@ -35,7 +41,20 @@ haskell_library(

haskell_test(
name = "test",
timeout = "long",
srcs = glob(["test/**/*.*hs"]),
args = [
"-j4",
"+RTS",
"-N4",
],
compiler_flags = [
"-threaded",
"-rtsopts",
"-Wall",
"-Werror",
"-Wno-unused-imports",
],
main_file = "test/testsuite.hs",
prebuilt_dependencies = ["base"],
src_strip_prefix = "test",
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cache:
- '%APPDATA%\ghc'

install:
- choco install ghc
- choco install ghc --version 8.2.2
- refreshenv

build_script:
Expand Down
2 changes: 1 addition & 1 deletion src/GitHub/Types/Base/Commit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import GitHub.Types.Base.User
data Commit = Commit
{ commitSha :: Text
, commitUser :: User
, commitRepo :: Repository
, commitRepo :: Maybe Repository
, commitLabel :: Text
, commitRef :: Text
} deriving (Eq, Show, Read)
Expand Down
6 changes: 3 additions & 3 deletions src/GitHub/Types/Base/DeploymentPayload.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module GitHub.Types.Base.DeploymentPayload where

import Control.Applicative ((<$>))
import Data.Aeson (FromJSON (..), ToJSON (..), object)
import Data.Aeson.Types (Value (..), (.:), (.=))
import Data.Aeson.Types (Value (..), (.:?), (.=))
import Data.Text (Text)
import Data.Text.Arbitrary ()
import Test.QuickCheck.Arbitrary (Arbitrary (..))
Expand All @@ -13,12 +13,12 @@ import Test.QuickCheck.Arbitrary (Arbitrary (..))
-- DeploymentPayload

data DeploymentPayload = DeploymentPayload
{ deploymentPayloadWebUrl :: Text
{ deploymentPayloadWebUrl :: Maybe Text
} deriving (Eq, Show, Read)

instance FromJSON DeploymentPayload where
parseJSON (Object x) = DeploymentPayload
<$> x .: "web_url"
<$> x .:? "web_url"

parseJSON _ = fail "DeploymentPayload"

Expand Down
5 changes: 5 additions & 0 deletions src/GitHub/Types/Base/PullRequest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Test.QuickCheck.Arbitrary (Arbitrary (..))

import GitHub.Types.Base.Commit
import GitHub.Types.Base.DateTime
import GitHub.Types.Base.Label
import GitHub.Types.Base.Milestone
import GitHub.Types.Base.PullRequestLinks
import GitHub.Types.Base.Team
Expand Down Expand Up @@ -39,6 +40,7 @@ data PullRequest = PullRequest
, pullRequestHtmlUrl :: Text
, pullRequestId :: Int
, pullRequestIssueUrl :: Text
, pullRequestLabels :: [Label]
, pullRequestLinks :: PullRequestLinks
, pullRequestLocked :: Bool
, pullRequestMaintainerCanModify :: Bool
Expand Down Expand Up @@ -87,6 +89,7 @@ instance FromJSON PullRequest where
<*> x .: "html_url"
<*> x .: "id"
<*> x .: "issue_url"
<*> x .: "labels"
<*> x .: "_links"
<*> x .: "locked"
<*> x .: "maintainer_can_modify"
Expand Down Expand Up @@ -136,6 +139,7 @@ instance ToJSON PullRequest where
, "html_url" .= pullRequestHtmlUrl
, "id" .= pullRequestId
, "issue_url" .= pullRequestIssueUrl
, "labels" .= pullRequestLabels
, "_links" .= pullRequestLinks
, "locked" .= pullRequestLocked
, "maintainer_can_modify" .= pullRequestMaintainerCanModify
Expand Down Expand Up @@ -208,3 +212,4 @@ instance Arbitrary PullRequest where
<*> arbitrary
<*> arbitrary
<*> arbitrary
<*> arbitrary
6 changes: 2 additions & 4 deletions test/GitHub/Types/BaseSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
{-# LANGUAGE Trustworthy #-}
module GitHub.Types.BaseSpec where

import Control.Applicative ((<$>))
import Data.Aeson (FromJSON, ToJSON, decode, encode)
import GHC.Generics (Generic)
import Data.Aeson (decode, encode)
import Test.Hspec
import Test.QuickCheck

Expand All @@ -13,7 +11,7 @@ import GitHub.Types.Base

spec :: Spec
spec =
describe "identity JSON conversion" $ do
describe "identity JSON conversion" $ parallel $ do
it "Author" $ property $ \(x :: Author ) -> decode (encode x) `shouldBe` Just x
it "Branch" $ property $ \(x :: Branch ) -> decode (encode x) `shouldBe` Just x
it "Change" $ property $ \(x :: Change ) -> decode (encode x) `shouldBe` Just x
Expand Down
2 changes: 1 addition & 1 deletion test/GitHub/Types/EventsSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import GitHub.Types.Events

spec :: Spec
spec =
describe "identity JSON conversion" $ do
describe "identity JSON conversion" $ parallel $ do
it "CommitCommentEvent" $ property $ \(x :: CommitCommentEvent ) -> decode (encode x) `shouldBe` Just x
it "CreateEvent" $ property $ \(x :: CreateEvent ) -> decode (encode x) `shouldBe` Just x
it "DeleteEvent" $ property $ \(x :: DeleteEvent ) -> decode (encode x) `shouldBe` Just x
Expand Down