Skip to content

Commit 9b86cff

Browse files
authored
Merge pull request #332 from phadej/tighten-bounds
Tighten lower bounds
2 parents 6ae6af7 + ec9380c commit 9b86cff

File tree

12 files changed

+115
-125
lines changed

12 files changed

+115
-125
lines changed

.travis.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# runghc make_travis_yml_2.hs '--branch' 'master' '-o' '.travis.yml' 'github.cabal'
44
#
5-
# For more information, see https://github.com/hvr/multi-ghc-travis
5+
# For more information, see https://github.com/haskell-CI/haskell-ci
66
#
77
language: c
88
sudo: false
@@ -64,14 +64,18 @@ install:
6464
- BENCH=${BENCH---enable-benchmarks}
6565
- TEST=${TEST---enable-tests}
6666
- HADDOCK=${HADDOCK-true}
67-
- INSTALLED=${INSTALLED-true}
67+
- UNCONSTRAINED=${UNCONSTRAINED-true}
68+
- NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}
6869
- GHCHEAD=${GHCHEAD-false}
6970
- travis_retry cabal update -v
7071
- "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
7172
- rm -fv cabal.project cabal.project.local
7273
- grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
7374
- "printf 'packages: \".\"\\n' > cabal.project"
74-
- cat cabal.project
75+
- touch cabal.project.local
76+
- "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- github | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
77+
- cat cabal.project || true
78+
- cat cabal.project.local || true
7579
- if [ -f "./configure.ac" ]; then
7680
(cd "." && autoreconf -i);
7781
fi
@@ -90,13 +94,13 @@ script:
9094
- cd ${DISTDIR} || false
9195
- find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
9296
- "printf 'packages: github-*/*.cabal\\n' > cabal.project"
93-
- cat cabal.project
97+
- touch cabal.project.local
98+
- "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- github | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
99+
- cat cabal.project || true
100+
- cat cabal.project.local || true
94101
# this builds all libraries and executables (without tests/benchmarks)
95102
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
96103

97-
# Build with installed constraints for packages in global-db
98-
- if $INSTALLED; then echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks $(${HCPKG} list --global --simple-output --names-only | sed 's/\([a-zA-Z0-9-]\{1,\}\) */--constraint="\1 installed" /g') all | sh; else echo "Not building with installed constraints"; fi
99-
100104
# build & run tests, build benchmarks
101105
- cabal new-build -w ${HC} ${TEST} ${BENCH} all
102106
- if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi
@@ -108,5 +112,8 @@ script:
108112
- rm -rf ./dist-newstyle
109113
- if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
110114

115+
# Build without installed constraints for packages in global-db
116+
- if $UNCONSTRAINED; then rm -f cabal.project.local; echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks all; else echo "Not building without installed constraints"; fi
117+
111118
# REGENDATA ["--branch","master","-o",".travis.yml","github.cabal"]
112119
# EOF

CHANGELOG.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
## Changes for 0.19.1
1+
## Changes for 0.20
22

33
- Add ratelimit endpoint
4-
[#315](https://github.com/phadej/github/pull/315/)
4+
[#315](https://github.com/phadej/github/pull/315)
55
- Add some deployment endoints
6-
[#330](https://github.com/phadej/github/pull/330/)
6+
[#330](https://github.com/phadej/github/pull/330)
77
- Add webhook installation events
8-
[#329](https://github.com/phadej/github/pull/330/)
8+
[#329](https://github.com/phadej/github/pull/330)
9+
- Tigthen lower bounds (also remove aeson-compat dep)
10+
[#332](https://github.com/phadej/github/pull/332)
911

1012
## Changes for 0.19
1113

github.cabal

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: github
2-
version: 0.19
3-
x-revision: 3
2+
version: 0.20
43
synopsis: Access to the GitHub API, v3.
54
description:
65
The GitHub API provides programmatic access to the full
@@ -39,11 +38,6 @@ extra-source-files:
3938
fixtures/user-organizations.json,
4039
fixtures/user.json
4140

42-
flag aeson-compat
43-
description: Whether to use aeson-compat or aeson-extra
44-
default: True
45-
manual: False
46-
4741
source-repository head
4842
type: git
4943
location: git://github.com/phadej/github.git
@@ -140,6 +134,7 @@ Library
140134
-- Packages bundles with GHC, mtl and text are also here
141135
build-depends:
142136
base >=4.7 && <4.12,
137+
binary >=0.7.1.0 && <0.10,
143138
bytestring >=0.10.4.0 && <0.11,
144139
containers >=0.5.5.1 && <0.6,
145140
deepseq >=1.3.0.2 && <1.5,
@@ -150,34 +145,28 @@ Library
150145

151146
-- other packages
152147
build-depends:
153-
aeson >=0.7.0.6 && <1.5,
154-
base-compat >=0.9.1 && <0.11,
148+
aeson >=1.4.0.0 && <1.5,
149+
base-compat >=0.10.4 && <0.11,
155150
base16-bytestring >=0.1.1.6 && <0.2,
156-
binary >=0.7.1.0 && <0.10,
157-
binary-orphans >=0.1.0.0 && <0.2,
151+
binary-orphans >=0.1.8.0 && <0.2,
158152
byteable >=0.1.1 && <0.2,
159-
cryptohash >=0.11 && <0.12,
160-
deepseq-generics >=0.1.1.2 && <0.3,
161-
exceptions >=0.8.0.2 && <0.11,
162-
hashable >=1.2.3.3 && <1.3,
163-
http-client >=0.4.8.1 && <0.6,
164-
http-client-tls >=0.2.2 && <0.4,
165-
http-link-header >=1.0.1 && <1.1,
153+
cryptohash >=0.11.9 && <0.12,
154+
deepseq-generics >=0.2.0.0 && <0.3,
155+
exceptions >=0.10.0 && <0.11,
156+
hashable >=1.2.7.0 && <1.3,
157+
http-client >=0.5.12 && <0.6,
158+
http-client-tls >=0.3.5.3 && <0.4,
159+
http-link-header >=1.0.3.1 && <1.1,
166160
http-types >=0.12.1 && <0.13,
167-
iso8601-time >=0.1.4 && <0.2,
168-
network-uri >=2.6.0.3 && <2.7,
169-
semigroups >=0.16.2.2 && <0.19,
170-
transformers-compat >=0.4.0.3 && <0.7,
171-
unordered-containers >=0.2 && <0.3,
172-
vector >=0.10.12.3 && <0.13,
173-
vector-instances >=3.3.0.1 && <3.5,
161+
iso8601-time >=0.1.5 && <0.2,
162+
network-uri >=2.6.1.0 && <2.7,
163+
semigroups >=0.18.5 && <0.19,
164+
transformers-compat >=0.6 && <0.7,
165+
unordered-containers >=0.2.9.0 && <0.3,
166+
vector >=0.12.0.1 && <0.13,
167+
vector-instances >=3.4 && <3.5,
174168

175-
tls >=1.3.5
176-
177-
if flag(aeson-compat)
178-
build-depends: aeson-compat >=0.3.0.0 && <0.4
179-
else
180-
build-depends: aeson-extra >=0.2.0.0 && <0.3
169+
tls >=1.4.1
181170

182171
test-suite github-test
183172
default-language: Haskell2010
@@ -188,28 +177,25 @@ test-suite github-test
188177
other-modules:
189178
GitHub.ActivitySpec
190179
GitHub.CommitsSpec
191-
GitHub.OrganizationsSpec
180+
GitHub.EventsSpec
192181
GitHub.IssuesSpec
193-
GitHub.PullRequestsSpec
182+
GitHub.OrganizationsSpec
194183
GitHub.PullRequestReviewsSpec
184+
GitHub.PullRequestsSpec
185+
GitHub.RateLimitSpec
195186
GitHub.ReleasesSpec
196187
GitHub.ReposSpec
197188
GitHub.SearchSpec
198189
GitHub.UsersSpec
199-
GitHub.EventsSpec
200190
main-is: Spec.hs
201191
ghc-options: -Wall
202-
build-tool-depends: hspec-discover:hspec-discover
192+
build-tool-depends: hspec-discover:hspec-discover >=2.5.6 && <2.6
203193
build-depends: base,
204194
base-compat,
195+
aeson,
205196
bytestring,
206197
github,
207198
vector,
208199
unordered-containers,
209200
file-embed,
210-
hspec
211-
if flag(aeson-compat)
212-
build-depends: aeson-compat
213-
else
214-
build-depends: aeson-extra
215-
201+
hspec >= 2.5.6 && <2.6

spec/GitHub/OrganizationsSpec.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,18 @@
33
module GitHub.OrganizationsSpec where
44

55
import GitHub.Auth (Auth (..))
6-
import GitHub.Data (SimpleOrganization (..),
7-
SimpleOwner (..),
8-
SimpleTeam (..))
6+
import GitHub.Data
7+
(SimpleOrganization (..), SimpleOwner (..), SimpleTeam (..))
98
import GitHub.Endpoints.Organizations (publicOrganizationsFor')
109
import GitHub.Endpoints.Organizations.Members (membersOf')
1110

12-
import Data.Aeson.Compat (eitherDecodeStrict)
11+
import Data.Aeson (eitherDecodeStrict)
1312
import Data.Either.Compat (isRight)
1413
import Data.FileEmbed (embedFile)
1514
import Data.String (fromString)
1615
import System.Environment (lookupEnv)
17-
import Test.Hspec (Spec, describe, it, pendingWith, shouldBe,
18-
shouldSatisfy)
16+
import Test.Hspec
17+
(Spec, describe, it, pendingWith, shouldBe, shouldSatisfy)
1918

2019
fromRightS :: Show a => Either a b -> b
2120
fromRightS (Right b) = b

spec/GitHub/PullRequestReviewsSpec.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
module GitHub.PullRequestReviewsSpec where
33

44
import qualified GitHub
5-
import GitHub.Data.Id (Id(Id))
5+
import GitHub.Data.Id (Id (Id))
66

77
import Prelude ()
88
import Prelude.Compat
99

10-
import Data.Either.Compat (isRight)
11-
import Data.Foldable (for_)
12-
import Data.String (fromString)
13-
import System.Environment (lookupEnv)
14-
import Test.Hspec (Spec, describe, it, pendingWith, shouldSatisfy)
10+
import Data.Either.Compat (isRight)
11+
import Data.Foldable (for_)
12+
import Data.String (fromString)
13+
import System.Environment (lookupEnv)
14+
import Test.Hspec (Spec, describe, it, pendingWith, shouldSatisfy)
1515

1616
withAuth :: (GitHub.Auth -> IO ()) -> IO ()
1717
withAuth action = do

spec/GitHub/PullRequestsSpec.hs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@
33
module GitHub.PullRequestsSpec where
44

55
import qualified GitHub
6-
import GitHub.Data.Id (Id(Id))
6+
import GitHub.Data.Id (Id (Id))
77

88
import Prelude ()
99
import Prelude.Compat
1010

11-
import Data.Aeson.Compat (eitherDecodeStrict)
12-
import Data.ByteString (ByteString)
13-
import Data.Either.Compat (isRight)
14-
import Data.FileEmbed (embedFile)
15-
import Data.Foldable (for_)
16-
import Data.String (fromString)
17-
import qualified Data.Vector as V
18-
import System.Environment (lookupEnv)
19-
import Test.Hspec (Spec, describe, it, pendingWith, shouldBe, shouldSatisfy)
11+
import Data.Aeson (eitherDecodeStrict)
12+
import Data.ByteString (ByteString)
13+
import Data.Either.Compat (isRight)
14+
import Data.FileEmbed (embedFile)
15+
import Data.Foldable (for_)
16+
import Data.String (fromString)
17+
import qualified Data.Vector as V
18+
import System.Environment (lookupEnv)
19+
import Test.Hspec
20+
(Spec, describe, it, pendingWith, shouldBe, shouldSatisfy)
2021

2122
fromRightS :: Show a => Either a b -> b
2223
fromRightS (Right b) = b

spec/GitHub/RateLimitSpec.hs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
module GitHub.RateLimitSpec where
3+
4+
import qualified GitHub
5+
6+
import Prelude ()
7+
import Prelude.Compat
8+
9+
import Data.Either.Compat (isRight)
10+
import Data.Foldable (for_)
11+
import Data.String (fromString)
12+
import System.Environment (lookupEnv)
13+
import Test.Hspec (Spec, describe, it, pendingWith, shouldSatisfy)
14+
15+
fromRightS :: Show a => Either a b -> b
16+
fromRightS (Right b) = b
17+
fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a
18+
19+
withAuth :: (GitHub.Auth -> IO ()) -> IO ()
20+
withAuth action = do
21+
mtoken <- lookupEnv "GITHUB_TOKEN"
22+
case mtoken of
23+
Nothing -> pendingWith "no GITHUB_TOKEN"
24+
Just token -> action (GitHub.OAuth $ fromString token)
25+
26+
spec :: Spec
27+
spec = describe "rateLimitR" $
28+
it "works" $ withAuth $ \auth -> do
29+
cs <- GitHub.executeRequest auth GitHub.rateLimitR
30+
cs `shouldSatisfy` isRight

spec/GitHub/SearchSpec.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
{-# LANGUAGE TemplateHaskell #-}
33
module GitHub.SearchSpec where
44

5-
import Prelude ()
5+
import Prelude ()
66
import Prelude.Compat
77

8-
import Data.Aeson.Compat (eitherDecodeStrict)
8+
import Data.Aeson (eitherDecodeStrict)
99
import Data.FileEmbed (embedFile)
1010
import Data.Proxy (Proxy (..))
1111
import Data.String (fromString)
@@ -14,7 +14,7 @@ import Test.Hspec (Spec, describe, it, pendingWith, shouldBe)
1414

1515
import qualified Data.Vector as V
1616

17-
import GitHub.Data (Auth (..), Issue (..), mkId, IssueState (..))
17+
import GitHub.Data (Auth (..), Issue (..), IssueState (..), mkId)
1818
import GitHub.Endpoints.Search (SearchResult (..), searchIssues')
1919

2020
fromRightS :: Show a => Either a b -> b

spec/GitHub/UsersSpec.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
{-# LANGUAGE TemplateHaskell #-}
33
module GitHub.UsersSpec where
44

5-
import Data.Aeson.Compat (eitherDecodeStrict)
5+
import Data.Aeson (eitherDecodeStrict)
66
import Data.Either.Compat (isLeft, isRight)
77
import Data.FileEmbed (embedFile)
88
import Data.String (fromString)
99
import System.Environment (lookupEnv)
10-
import Test.Hspec (Spec, describe, it, pendingWith, shouldBe,
11-
shouldSatisfy)
10+
import Test.Hspec
11+
(Spec, describe, it, pendingWith, shouldBe, shouldSatisfy)
1212

1313
import qualified GitHub
1414

15-
import GitHub.Data (Auth (..), Organization (..),
16-
User (..), fromOwner)
17-
import GitHub.Endpoints.Users (ownerInfoForR, userInfoCurrent',
18-
userInfoFor')
15+
import GitHub.Data
16+
(Auth (..), Organization (..), User (..), fromOwner)
17+
import GitHub.Endpoints.Users
18+
(ownerInfoForR, userInfoCurrent', userInfoFor')
1919
import GitHub.Endpoints.Users.Followers (usersFollowedByR, usersFollowingR)
2020
import GitHub.Request (executeRequest)
2121

src/GitHub/Data/Request.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import qualified Data.Text as T
3737
import qualified Network.HTTP.Types as Types
3838
import qualified Network.HTTP.Types.Method as Method
3939
import Network.URI (URI)
40+
4041
------------------------------------------------------------------------------
4142
-- Auxillary types
4243
------------------------------------------------------------------------------

0 commit comments

Comments
 (0)