mirror of
https://github.com/haskell-servant/servant-ekg.git
synced 2024-10-31 16:29:42 +01:00
Compare commits
13 commits
Author | SHA1 | Date | |
---|---|---|---|
|
a5ef9c5efd | ||
|
9a87263a1b | ||
|
5b3a85dd85 | ||
|
dcf720db2e | ||
|
8f859fccfe | ||
|
bda075f8f5 | ||
|
638f67facd | ||
|
149dbf8e33 | ||
|
655dd49ed1 | ||
|
b9c1b9fdd1 | ||
|
6dc27930c3 | ||
|
bf287fd7f7 | ||
|
21205ac54a |
7 changed files with 126 additions and 31 deletions
69
.github/workflows/ci.yml
vendored
Normal file
69
.github/workflows/ci.yml
vendored
Normal 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
|
43
.travis.yml
43
.travis.yml
|
@ -1,10 +1,14 @@
|
|||
# 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
|
||||
#
|
||||
# version: 0.9.20200121
|
||||
# version: 0.10.2
|
||||
#
|
||||
version: ~> 1.0
|
||||
language: c
|
||||
|
@ -13,9 +17,6 @@ dist: xenial
|
|||
git:
|
||||
# whether to recursively clone submodules
|
||||
submodules: false
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.cabal/packages
|
||||
|
@ -32,17 +33,23 @@ before_cache:
|
|||
- rm -rfv $CABALHOME/packages/head.hackage
|
||||
jobs:
|
||||
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
|
||||
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
|
||||
- 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
|
||||
- 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
|
||||
- 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
|
||||
before_install:
|
||||
- HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
|
||||
|
@ -92,6 +99,8 @@ install:
|
|||
- touch 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"
|
||||
- cat cabal.project || true
|
||||
|
@ -100,8 +109,8 @@ install:
|
|||
- ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}
|
||||
- "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
|
||||
- rm cabal.project.freeze
|
||||
- ${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 ${TEST} ${BENCH} --dep -j2 all
|
||||
- travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all
|
||||
script:
|
||||
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
|
||||
# Packaging...
|
||||
|
@ -117,6 +126,8 @@ script:
|
|||
- touch 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"
|
||||
- cat cabal.project || true
|
||||
|
@ -136,14 +147,6 @@ script:
|
|||
# Building without installed constraints for packages in global-db...
|
||||
- rm -f cabal.project.local
|
||||
- ${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
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# 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
|
||||
|
||||
|
|
|
@ -11,3 +11,7 @@ constraint-set servant-0.16
|
|||
constraint-set servant-0.17
|
||||
ghc: >= 8.0 && <8.10
|
||||
constraints: servant ==0.17.*
|
||||
|
||||
constraint-set servant-0.18
|
||||
ghc: >= 8.0 && <9.0
|
||||
constraints: servant ==0.18.*
|
||||
|
|
1
cabal.project.local
Normal file
1
cabal.project.local
Normal file
|
@ -0,0 +1 @@
|
|||
tests: True
|
|
@ -117,6 +117,12 @@ instance HasEndpoint (sub :: *) => HasEndpoint (Header' mods h a :> sub) where
|
|||
getEndpoint _ = getEndpoint (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
|
||||
getEndpoint _ = getEndpoint (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)
|
||||
#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
|
||||
getEndpoint _ req = case pathInfo req of
|
||||
[] | requestMethod req == method -> Just (APIEndpoint [] method)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
cabal-version: >=1.10
|
||||
name: servant-ekg
|
||||
version: 0.3.1
|
||||
version: 0.3.2
|
||||
synopsis: Helpers for using ekg with servant
|
||||
description: Helpers for using ekg with servant, e.g.. counters per endpoint.
|
||||
license: BSD3
|
||||
|
@ -13,7 +13,7 @@ maintainer:
|
|||
|
||||
category: Servant, Web, System
|
||||
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
|
||||
|
||||
source-repository HEAD
|
||||
|
@ -25,15 +25,15 @@ library
|
|||
other-modules: Servant.Ekg.Internal
|
||||
hs-source-dirs: lib
|
||||
build-depends:
|
||||
base >=4.9 && <4.13
|
||||
, ekg-core >=0.1.1.4 && <0.2
|
||||
, http-types >=0.12.2 && <0.13
|
||||
, hashable >=1.2.7.0 && <1.4
|
||||
, servant >=0.14 && <0.18
|
||||
, text >=1.2.3.0 && <1.3
|
||||
, time >=1.6.0.1 && <1.9
|
||||
, unordered-containers >=0.2.9.0 && <0.3
|
||||
, wai >=3.2.0 && <3.3
|
||||
base >=4.9 && <4.16
|
||||
, ekg-core >=0.1.1.4 && <0.2
|
||||
, http-types >=0.12.2 && <0.13
|
||||
, hashable >=1.2.7.0 && <1.4
|
||||
, servant >=0.14 && <0.20
|
||||
, text >=1.2.3.0 && <1.3
|
||||
, time >=1.6.0.1 && <1.12
|
||||
, unordered-containers >=0.2.9.0 && <0.3
|
||||
, wai >=3.2.0 && <3.3
|
||||
|
||||
default-language: Haskell2010
|
||||
|
||||
|
|
Loading…
Reference in a new issue