Skip to content

Commit

Permalink
Separate examples from the normal stack builds for better CI tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
kvanbere committed Oct 17, 2019
1 parent a475f44 commit 05b1a85
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 71 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ cabal.project.local
cabal.project.local~
.HTF/
.ghc.environment.*
*.yaml.lock
!stack.yaml.lock
12 changes: 1 addition & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ matrix:
include:
# Previous lts releases
- os: linux
env: STACK_YAML=stack-ghc-7.8.yaml STACK_PKG_URL=https://www.stackage.org/stack/linux-x86_64
env: STACK_YAML=stack-ghc-7.8.yaml STACK_PKG_URL=https://github.com/commercialhaskell/stack/releases/download/v1.9.3/stack-1.9.3-linux-x86_64-static.tar.gz
- os: linux
env: STACK_YAML=stack-ghc-7.10.yaml STACK_PKG_URL=https://www.stackage.org/stack/linux-x86_64
- os: linux
Expand All @@ -23,9 +23,6 @@ matrix:
env: STACK_YAML=stack-nightly.yaml STACK_PKG_URL=https://www.stackage.org/stack/linux-x86_64
allow_failures:
# These are not stable yet
- env: STACK_YAML=stack-ghc-7.8.yaml STACK_PKG_URL=https://www.stackage.org/stack/linux-x86_64
- env: STACK_YAML=stack-ghc-7.10.yaml STACK_PKG_URL=https://www.stackage.org/stack/linux-x86_64
- env: STACK_YAML=stack-ghc-8.0.yaml STACK_PKG_URL=https://www.stackage.org/stack/linux-x86_64
- env: STACK_YAML=stack-nightly.yaml STACK_PKG_URL=https://www.stackage.org/stack/linux-x86_64

cache:
Expand All @@ -41,10 +38,3 @@ script:
- source .ci-scripts/travis/run-hlint.sh
- travis_wait 45 stack --no-terminal --skip-ghc-check test --flag github-webhooks:ci --haddock --no-haddock-deps
- source .ci-scripts/travis/run-weeder.sh

# Build the integration examples
- travis_wait 45 stack --no-terminal --skip-ghc-check build
github-webhooks-scotty-example
github-webhooks-servant-simple-example
github-webhooks-servant-example

25 changes: 13 additions & 12 deletions github-webhooks.cabal
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
-- This file has been generated from package.yaml by hpack version 0.21.2.
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.31.2.
--
-- see: https://github.com/sol/hpack
--
-- hash: 53e392c223a6c9b9667f45cd1fdac1ee1588fb5b1b31d7789bd9d10de1151de6
-- hash: 1a0d06526485495c6980a45d68f584ba73282c28be0394d5530961bd0e0f0de2

cabal-version: >= 1.10
name: github-webhooks
version: 0.11.0
synopsis: Aeson instances for GitHub Webhook payloads.
Expand All @@ -22,8 +23,14 @@ copyright: (c) 2017-2019 ONROCK
license: MIT
license-file: LICENSE
build-type: Simple

extra-source-files:
package.yaml
stack.yaml
stack-examples.yaml
stack-ghc-7.10.yaml
stack-ghc-7.8.yaml
stack-ghc-8.0.yaml
stack-nightly.yaml
CHANGELOG.md
fixtures/commit-comment-event.json
fixtures/create-event.json
Expand Down Expand Up @@ -58,12 +65,6 @@ extra-source-files:
fixtures/team-add-event.json
fixtures/team-event.json
fixtures/watch-event.json
package.yaml
stack-ghc-7.10.yaml
stack-ghc-7.8.yaml
stack-ghc-8.0.yaml
stack-nightly.yaml
stack.yaml

source-repository head
type: git
Expand Down Expand Up @@ -91,7 +92,7 @@ library
, time
, vector
if flag(ci)
ghc-options: -Wall -Werror -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -ddump-to-file -ddump-hi
ghc-options: -Wall -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -ddump-to-file -ddump-hi
exposed-modules:
GitHub.Data.Webhooks.Events
GitHub.Data.Webhooks.Payload
Expand All @@ -115,7 +116,7 @@ test-suite spec
, text
, vector
if flag(ci)
ghc-options: -Wall -Werror -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -ddump-to-file -ddump-hi
ghc-options: -Wall -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -ddump-to-file -ddump-hi
other-modules:
DecodeEventsSpec
Paths_github_webhooks
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ flags:

when:
- condition: flag(ci)
ghc-options: -Wall -Werror -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -ddump-to-file -ddump-hi
ghc-options: -Wall -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -ddump-to-file -ddump-hi

default-extensions:
- DeriveDataTypeable
Expand Down
3 changes: 3 additions & 0 deletions src/GitHub/Data/Webhooks/Events.hs
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,12 @@ module GitHub.Data.Webhooks.Events
) where

import Data.Aeson (FromJSON(..), withObject, withText, (.:), (.:?), (.!=))
import Control.Applicative ((<*>), pure)
import Control.DeepSeq (NFData(..))
import Control.DeepSeq.Generics (genericRnf)
import Data.Data (Data, Typeable)
import Data.Functor ((<$>))
import Data.Monoid (mempty)
import Data.Time (UTCTime)
import Data.Text (Text)
import Data.Vector (Vector)
Expand Down
9 changes: 5 additions & 4 deletions src/GitHub/Data/Webhooks/Payload.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ module GitHub.Data.Webhooks.Payload
import Data.Aeson (FromJSON(..), withObject, withText, (.!=), (.:), (.:?))
import Control.DeepSeq (NFData (..))
import Control.DeepSeq.Generics (genericRnf)
import Control.Applicative ((<|>))
import Control.Applicative ((<|>), (<*>), pure)
import Data.Data (Data, Typeable)
import Data.Functor ((<$>))
import Data.Time (UTCTime)
import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
import Data.Text (Text)
Expand Down Expand Up @@ -723,9 +724,9 @@ instance FromJSON HookRepository where
<*> o .: "labels_url"
<*> o .: "releases_url"
-- FIXME: Wrap optional number/stringified UTCTime in a helper function? See PushEvent fixture
<*> ((o .: "created_at") <|> (posixSecondsToUTCTime <$> o .: "created_at"))
<*> ((o .: "updated_at") <|> (posixSecondsToUTCTime <$> o .: "updated_at"))
<*> ((o .: "pushed_at") <|> (posixSecondsToUTCTime <$> o .: "pushed_at"))
<*> ((o .: "created_at") <|> (posixSecondsToUTCTime . fromInteger <$> o .: "created_at"))
<*> ((o .: "updated_at") <|> (posixSecondsToUTCTime . fromInteger <$> o .: "updated_at"))
<*> ((o .: "pushed_at") <|> (posixSecondsToUTCTime . fromInteger <$> o .: "pushed_at"))
<*> o .: "git_url"
<*> o .: "ssh_url"
<*> o .: "clone_url"
Expand Down
3 changes: 3 additions & 0 deletions src/GitHub/Data/Webhooks/Secure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import Crypto.MAC.HMAC (HMAC(..), hmac)
import Control.Monad (unless)
import Control.Exception (Exception, throwIO)
import Data.ByteArray (convert, constEq)
import Data.Data (Typeable)
import Data.Monoid ((<>))
import Data.Functor ((<$>))
import Data.ByteString (ByteString)
import Data.Text (Text)
import qualified Data.ByteString.Base16 as B16
Expand All @@ -38,6 +40,7 @@ isSecurePayload secret shaOpt payload = maybe False (constEq ourSig) theirSig

-- | An exception indicating that the given payload is not secure.
data PayloadNotSecure = PayloadNotSecure
deriving (Typeable)

instance Exception PayloadNotSecure

Expand Down
9 changes: 9 additions & 0 deletions stack-examples.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resolver: lts-11.5
packages:
- .
- examples/scotty
- examples/servant
- examples/servant-simple
extra-deps:
# Needed for servant examples
- servant-github-webhook-0.4.1.0
7 changes: 0 additions & 7 deletions stack-ghc-7.10.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
resolver: lts-6.35
extra-deps:
# Needed for servant examples
- servant-github-webhook-0.4.1.0
# Examples
- ./examples/servant-simple
- ./examples/servant
- ./examples/scotty
7 changes: 1 addition & 6 deletions stack-ghc-7.8.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
resolver: lts-2.22
extra-deps:
# Needed for servant examples
- servant-github-webhook-0.4.1.0
# Examples
- ./examples/servant-simple
- ./examples/servant
- ./examples/scotty
- cryptonite-0.6
7 changes: 0 additions & 7 deletions stack-ghc-8.0.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
resolver: lts-7.24
extra-deps:
# Needed for servant examples
- servant-github-webhook-0.4.1.0
# Examples
- ./examples/servant-simple
- ./examples/servant
- ./examples/scotty
9 changes: 1 addition & 8 deletions stack-nightly.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
resolver: nightly
extra-deps:
# Needed for servant examples
- servant-github-webhook-0.4.1.0
# Examples
- ./examples/servant-simple
- ./examples/servant
- ./examples/scotty
resolver: nightly-2019-10-15 # Overriden by --resolver nightly on CI matrix
7 changes: 0 additions & 7 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
resolver: lts-11.5
extra-deps:
# Needed for servant examples
- servant-github-webhook-0.4.1.0
# Examples
- ./examples/servant-simple
- ./examples/servant
- ./examples/scotty
9 changes: 1 addition & 8 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files

packages:
- completed:
hackage: servant-github-webhook-0.4.1.0@sha256:6ac456ccc6a2a96b30a7b80cd91b121f1b7e9bd33635641a6afbd6137700a753,2754
pantry-tree:
size: 576
sha256: f00112fb96ffe1caa7076a466868af0b47eed0ffea92792b3cde5a5e369a7005
original:
hackage: servant-github-webhook-0.4.1.0
packages: []
snapshots:
- completed:
size: 507344
Expand Down

0 comments on commit 05b1a85

Please sign in to comment.