Compare commits

..

13 commits

Author SHA1 Message Date
Arian van Putten
a5ef9c5efd
Merge pull request #32 from Simspace/uverb+fragment-support
support UVerb + correctly bound Fragment instance for older servant versions
2023-08-26 08:06:53 +00:00
Devin Lehmacher
9a87263a1b
Merge branch 'master' into uverb+fragment-support 2022-06-01 11:25:42 -07:00
Arian van Putten
5b3a85dd85
Merge pull request #31 from peterbecich/servant-0.19
bump `servant` upper bound
2022-06-01 12:18:13 +02:00
Devin Lehmacher
dcf720db2e support UVerb + Fragment 2022-04-07 16:06:12 -07:00
Peter Becich
8f859fccfe bump servant upper bound
compilation succeeds with `servant-0.19`
2022-03-20 22:40:11 -07:00
Arian van Putten
bda075f8f5
Merge pull request #28 from peterbecich/basic-github-actions
basic GitHub Actions; fix tests; GHC 9 still failing
2022-02-02 12:11:40 +01:00
Peter Becich
638f67facd
no CI coverage for GHC 8.0, 8.2, 8.4, 9.0 2022-01-31 22:43:07 -08:00
Peter Becich
149dbf8e33
provide missing instance to fix tests 2022-01-29 16:36:48 -08:00
Peter Becich
655dd49ed1 fix tests 2022-01-23 23:38:30 -08:00
Peter Becich
b9c1b9fdd1
basic GitHub Actions 2022-01-22 15:19:49 -08:00
Arian van Putten
6dc27930c3
Merge pull request #24 from SamuelSchlesinger/master
Update for servant-0.18 and GHC 8.8 + 8.10
2020-10-25 13:02:20 +01:00
Samuel Schlesinger
bf287fd7f7 Tried to get GHC 8.8 and 8.10 under test 2020-10-18 15:44:34 -04:00
Samuel Schlesinger
21205ac54a Made work with servant-0.18 2020-10-18 14:44:08 -04:00
7 changed files with 126 additions and 31 deletions

69
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,69 @@
# modified from https://github.com/jgm/pandoc/blob/master/.github/workflows/ci.yml
name: CI
on:
push:
branches:
- '**'
paths-ignore: []
pull_request:
paths-ignore: []
jobs:
linux:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
versions:
- ghc: '8.6.5'
cabal: '3.6'
- ghc: '8.8.4'
cabal: '3.6'
- ghc: '8.10.7'
cabal: '3.6'
# - ghc: '9.0.2'
# cabal: '3.6'
steps:
- uses: actions/checkout@v2
# need to install older cabal/ghc versions from ppa repository
- name: Install recent cabal/ghc
uses: haskell/actions/setup@v1
with:
ghc-version: ${{ matrix.versions.ghc }}
cabal-version: ${{ matrix.versions.cabal }}
# declare/restore cached things
# caching doesn't work for scheduled runs yet
# https://github.com/actions/cache/issues/63
- name: Cache cabal global package db
id: cabal-global
uses: actions/cache@v2
with:
path: |
~/.cabal
key: ${{ runner.os }}-${{ matrix.versions.ghc }}-${{ matrix.versions.cabal }}-cabal-global-${{ hashFiles('cabal.project') }}
- name: Cache cabal work
id: cabal-local
uses: actions/cache@v2
with:
path: |
dist-newstyle
key: ${{ runner.os }}-${{ matrix.versions.ghc }}-${{ matrix.versions.cabal }}-cabal-local
- name: Install dependencies
run: |
cabal update
cabal build all --dependencies-only --enable-tests --disable-optimization
- name: Build
run: |
cabal build all --enable-tests --disable-optimization 2>&1 | tee build.log
- name: Test
run: |
cabal test all --disable-optimization

View file

@ -1,10 +1,14 @@
# This Travis job script has been generated by a script via # This Travis job script has been generated by a script via
# #
# haskell-ci '--output=.travis.yml' '--config=cabal.haskell-ci' 'cabal.project' # haskell-ci 'servant-ekg.cabal'
#
# To regenerate the script (for example after adjusting tested-with) run
#
# haskell-ci regenerate
# #
# For more information, see https://github.com/haskell-CI/haskell-ci # For more information, see https://github.com/haskell-CI/haskell-ci
# #
# version: 0.9.20200121 # version: 0.10.2
# #
version: ~> 1.0 version: ~> 1.0
language: c language: c
@ -13,9 +17,6 @@ dist: xenial
git: git:
# whether to recursively clone submodules # whether to recursively clone submodules
submodules: false submodules: false
branches:
only:
- master
cache: cache:
directories: directories:
- $HOME/.cabal/packages - $HOME/.cabal/packages
@ -32,17 +33,23 @@ before_cache:
- rm -rfv $CABALHOME/packages/head.hackage - rm -rfv $CABALHOME/packages/head.hackage
jobs: jobs:
include: include:
- compiler: ghc-8.10.2
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.10.2","cabal-install-3.2"]}}
os: linux
- compiler: ghc-8.8.4
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.4","cabal-install-3.2"]}}
os: linux
- compiler: ghc-8.6.5 - compiler: ghc-8.6.5
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.0"]}} addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.2"]}}
os: linux os: linux
- compiler: ghc-8.4.4 - compiler: ghc-8.4.4
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.0"]}} addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.2"]}}
os: linux os: linux
- compiler: ghc-8.2.2 - compiler: ghc-8.2.2
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.0"]}} addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.2"]}}
os: linux os: linux
- compiler: ghc-8.0.2 - compiler: ghc-8.0.2
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.0"]}} addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.2"]}}
os: linux os: linux
before_install: before_install:
- HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//') - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
@ -92,6 +99,8 @@ install:
- touch cabal.project - touch cabal.project
- | - |
echo "packages: ." >> cabal.project echo "packages: ." >> cabal.project
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package servant-ekg' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- | - |
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(servant-ekg)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(servant-ekg)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
- cat cabal.project || true - cat cabal.project || true
@ -100,8 +109,8 @@ install:
- ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}
- "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'" - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
- rm cabal.project.freeze - rm cabal.project.freeze
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all
script: script:
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
# Packaging... # Packaging...
@ -117,6 +126,8 @@ script:
- touch cabal.project - touch cabal.project
- | - |
echo "packages: ${PKGDIR_servant_ekg}" >> cabal.project echo "packages: ${PKGDIR_servant_ekg}" >> cabal.project
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package servant-ekg' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- | - |
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(servant-ekg)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(servant-ekg)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
- cat cabal.project || true - cat cabal.project || true
@ -136,14 +147,6 @@ script:
# Building without installed constraints for packages in global-db... # Building without installed constraints for packages in global-db...
- rm -f cabal.project.local - rm -f cabal.project.local
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
# Constraint sets
- rm -rf cabal.project.local
# Constraint set servant-0.15
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.15.*' all
# Constraint set servant-0.16
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.16.*' all
# Constraint set servant-0.17
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.17.*' all
# REGENDATA ("0.9.20200121",["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"]) # REGENDATA ("0.10.2",["servant-ekg.cabal"])
# EOF # EOF

View file

@ -1,6 +1,7 @@
# servant-ekg # servant-ekg
[![Build Status](https://travis-ci.org/haskell-servant/servant-ekg.png)](https://travis-ci.org/haskell-servant/servant-ekg) [![Build Status](https://travis-ci.org/haskell-servant/servant-ekg.png)](https://travis-ci.org/haskell-servant/servant-ekg)
[![Build status](https://github.com/haskell-servant/servant-ekg/actions/workflows/ci.yml/badge.svg)](https://github.com/haskell-servant/servant-ekg/actions/workflows/ci.yml)
# Servant Performance Counters # Servant Performance Counters

View file

@ -11,3 +11,7 @@ constraint-set servant-0.16
constraint-set servant-0.17 constraint-set servant-0.17
ghc: >= 8.0 && <8.10 ghc: >= 8.0 && <8.10
constraints: servant ==0.17.* constraints: servant ==0.17.*
constraint-set servant-0.18
ghc: >= 8.0 && <9.0
constraints: servant ==0.18.*

1
cabal.project.local Normal file
View file

@ -0,0 +1 @@
tests: True

View file

@ -117,6 +117,12 @@ instance HasEndpoint (sub :: *) => HasEndpoint (Header' mods h a :> sub) where
getEndpoint _ = getEndpoint (Proxy :: Proxy sub) getEndpoint _ = getEndpoint (Proxy :: Proxy sub)
enumerateEndpoints _ = enumerateEndpoints (Proxy :: Proxy sub) enumerateEndpoints _ = enumerateEndpoints (Proxy :: Proxy sub)
#if MIN_VERSION_servant(0,18,2)
instance HasEndpoint (sub :: *) => HasEndpoint (Fragment a :> sub) where
getEndpoint _ = getEndpoint (Proxy :: Proxy sub)
enumerateEndpoints _ = enumerateEndpoints (Proxy :: Proxy sub)
#endif
instance HasEndpoint (sub :: *) => HasEndpoint (QueryParam' mods (h :: Symbol) a :> sub) where instance HasEndpoint (sub :: *) => HasEndpoint (QueryParam' mods (h :: Symbol) a :> sub) where
getEndpoint _ = getEndpoint (Proxy :: Proxy sub) getEndpoint _ = getEndpoint (Proxy :: Proxy sub)
enumerateEndpoints _ = enumerateEndpoints (Proxy :: Proxy sub) enumerateEndpoints _ = enumerateEndpoints (Proxy :: Proxy sub)
@ -179,6 +185,17 @@ instance ReflectMethod method => HasEndpoint (NoContentVerb method) where
where method = reflectMethod (Proxy :: Proxy method) where method = reflectMethod (Proxy :: Proxy method)
#endif #endif
#if MIN_VERSION_servant(0,18,1)
instance ReflectMethod method => HasEndpoint (UVerb method contentType as) where
getEndpoint _ req = case pathInfo req of
[] | requestMethod req == method -> Just (APIEndpoint [] method)
_ -> Nothing
where method = reflectMethod (Proxy :: Proxy method)
enumerateEndpoints _ = [APIEndpoint mempty method]
where method = reflectMethod (Proxy :: Proxy method)
#endif
instance ReflectMethod method => HasEndpoint (Stream method status framing ct a) where instance ReflectMethod method => HasEndpoint (Stream method status framing ct a) where
getEndpoint _ req = case pathInfo req of getEndpoint _ req = case pathInfo req of
[] | requestMethod req == method -> Just (APIEndpoint [] method) [] | requestMethod req == method -> Just (APIEndpoint [] method)

View file

@ -1,6 +1,6 @@
cabal-version: >=1.10 cabal-version: >=1.10
name: servant-ekg name: servant-ekg
version: 0.3.1 version: 0.3.2
synopsis: Helpers for using ekg with servant synopsis: Helpers for using ekg with servant
description: Helpers for using ekg with servant, e.g.. counters per endpoint. description: Helpers for using ekg with servant, e.g.. counters per endpoint.
license: BSD3 license: BSD3
@ -13,7 +13,7 @@ maintainer:
category: Servant, Web, System category: Servant, Web, System
build-type: Simple build-type: Simple
tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.7
extra-source-files: README.md CHANGELOG.md extra-source-files: README.md CHANGELOG.md
source-repository HEAD source-repository HEAD
@ -25,15 +25,15 @@ library
other-modules: Servant.Ekg.Internal other-modules: Servant.Ekg.Internal
hs-source-dirs: lib hs-source-dirs: lib
build-depends: build-depends:
base >=4.9 && <4.13 base >=4.9 && <4.16
, ekg-core >=0.1.1.4 && <0.2 , ekg-core >=0.1.1.4 && <0.2
, http-types >=0.12.2 && <0.13 , http-types >=0.12.2 && <0.13
, hashable >=1.2.7.0 && <1.4 , hashable >=1.2.7.0 && <1.4
, servant >=0.14 && <0.18 , servant >=0.14 && <0.20
, text >=1.2.3.0 && <1.3 , text >=1.2.3.0 && <1.3
, time >=1.6.0.1 && <1.9 , time >=1.6.0.1 && <1.12
, unordered-containers >=0.2.9.0 && <0.3 , unordered-containers >=0.2.9.0 && <0.3
, wai >=3.2.0 && <3.3 , wai >=3.2.0 && <3.3
default-language: Haskell2010 default-language: Haskell2010