-
-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1735 from haskell-servant/migration-servant-quick…
…check
- Loading branch information
Showing
34 changed files
with
3,351 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake . -Lv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: haskell ci | ||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
jobs: | ||
generate-matrix: | ||
name: "Generate matrix from cabal" | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Extract the tested GHC versions | ||
id: set-matrix | ||
uses: kleidukos/[email protected] | ||
with: | ||
cabal-file: servant-quickcheck.cabal | ||
ubuntu-version: latest | ||
macos-version: latest | ||
windows-version: latest | ||
version: 0.1.7.0 | ||
tests: | ||
name: ${{ matrix.ghc }} on ${{ matrix.os }} | ||
needs: generate-matrix | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: haskell-actions/setup@v2 | ||
id: setup-haskell | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
- name: Cache | ||
uses: actions/[email protected] | ||
with: | ||
path: ${{ steps.setup-haskell.outputs.cabal-store }} | ||
key: ${{ matrix.os }}-ghc-${{ matrix.ghc }}-cabal-${{ hashFiles('**/plan.json') }} | ||
restore-keys: ${{ matrix.os }}-ghc-${{ matrix.ghc }}- | ||
- run: cabal test all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: nix ci | ||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
permissions: | ||
contents: read | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: DeterminateSystems/nix-installer-action@main | ||
- uses: DeterminateSystems/magic-nix-cache-action@main | ||
- run: nix -L flake check | ||
- run: nix -L build .#servant-quickcheck | ||
- run: nix -L build .#ghc94-servant-quickcheck | ||
- run: nix -L build .#ghc98-servant-quickcheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
doc/_build/ | ||
scripts/ | ||
samples/ | ||
test-servers/ | ||
/doc/ | ||
.stack-work/ | ||
.pre-commit-config.yaml | ||
.direnv | ||
dist* | ||
result* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
releases: | ||
- version: "0.1.0.0" | ||
changes: | ||
- description: "Support servant{-server,-client} up to 0.20, support base up to 4.19, drop support for some older servant and base versions, drop support for stack, drop testing for some older ghc versions" | ||
authors: mangoiv | ||
date: 2024-04-02 | ||
- version: "0.0.9.0" | ||
changes: | ||
- description: "Support servant-0.15 (#65)" | ||
authors: fizruk | ||
date: 2020-06-25 | ||
|
||
- description: "Relax constraints for GHC 8.10 (#70)" | ||
authors: felixmulder | ||
date: 2020-06-20 | ||
|
||
- version: "0.0.8.0" | ||
changes: | ||
- description: Support for servant-0.17 | ||
authors: phadej | ||
date: 2019-01-23 | ||
|
||
- version: "0.0.7.3" | ||
changes: | ||
- description: Support for servant-0.14 | ||
issue: 53 | ||
authors: phadej | ||
date: 2018-06-12 | ||
|
||
- description: Fix a failure from OnlyJsonObjects when there is no content-type. | ||
issue: 55 | ||
authors: Phenitei | ||
date: 2018-08-27 | ||
|
||
- description: A bug fix where notAllowedContainsAllowHeader would print the initial request alongside the failure instead of the request causing the failure when it failed. | ||
issue: 57 | ||
authors: Phenitei | ||
date: 2018-08-29 | ||
|
||
- description: QuickCheck 2.12 compatibility | ||
issue: 58 | ||
authors: parsonsmatt | ||
date: 2018-10-12 | ||
|
||
- description: GHC 8.6 compatibility | ||
issue: 59 | ||
authors: phadej | ||
date: 2018-10-15 | ||
|
||
- version: "0.0.7.2" | ||
changes: | ||
|
||
- description: Allow client to pass an HTTP Manager in to functions | ||
issue: 47 | ||
authors: parsonsmatt | ||
date: 2018-05-10 | ||
|
||
- description: Fix "should not happen" error when exceptions are thrown | ||
issue: 48 | ||
authors: parsonsmatt | ||
date: 2018-05-10 | ||
|
||
- version: "0.0.7.0" | ||
changes: | ||
|
||
- description: Support for base-compat-0.10 | ||
issue: none | ||
authors: phadej | ||
date: 2018-04-12 | ||
|
||
- version: "0.0.7.0" | ||
changes: | ||
|
||
- description: Support for GHC-8.4.1 | ||
issue: none | ||
authors: phadej | ||
date: 2018-03-23 | ||
|
||
- description: Requires hspec-2.5 | ||
issue: none | ||
authors: phadej | ||
date: 2018-03-23 | ||
|
||
- version: "0.0.6.0" | ||
changes: | ||
|
||
- description: Support for servant-0.12 | ||
issue: none | ||
authors: phadej | ||
date: 2018-02-09 | ||
|
||
- version: "0.0.5.0" | ||
changes: | ||
|
||
- description: Export forgotten predicates | ||
issue: none | ||
pr: 40 | ||
authors: Phenitei | ||
date: 2017-12-14 | ||
|
||
- version: "0.0.4" | ||
changes: | ||
|
||
- description: Support for Servant 0.12 | ||
issue: none | ||
authors: phadej | ||
date: 2017-11-07 | ||
|
||
- description: Support for Servant 0.11 | ||
issue: none | ||
pr: 32 | ||
authors: adinapoli-iohk | ||
date: 2017-10-18 | ||
notes: Includes 0-weighted instance for EmptyAPI | ||
|
||
- version: "0.0.3.0" | ||
changes: | ||
|
||
- description: Add jsonEquality | ||
issue: 2 | ||
pr: 30 | ||
authors: erewok | ||
date: 2017-10-15 | ||
|
||
- description: Support hspec >= 2.4 | ||
issue: 27 | ||
pr: 29 | ||
authors: erewok, jkarni | ||
date: 2017-10-15 | ||
|
||
- version: "0.0.2.4" | ||
changes: | ||
|
||
- description: Don't append slashes to paths | ||
issue: 22 | ||
authors: declension | ||
date: 2017-03-11 | ||
|
||
- version: "0.0.2.3" | ||
changes: | ||
|
||
- description: Fix QueryParam and QueryFlag requests | ||
issue: 23 | ||
authors: declension | ||
date: 2017-03-10 | ||
|
||
- version: "0.0.2.2" | ||
changes: | ||
|
||
- description: Make onlyJsonObjects succeed in non-JSON endpoints | ||
issue: 20 | ||
authors: jkarni | ||
date: 2016-10-18 | ||
|
||
|
||
- version: "0.0.2.1" | ||
changes: | ||
|
||
- description: Add notLongerThan predicate | ||
pr: 17 | ||
authors: jkarni | ||
date: 2016-10-05 | ||
|
||
- description: Add getsHaveLastModifiedHeader predicate | ||
pr: none | ||
authors: jkarni | ||
date: 2016-10-03 | ||
|
||
- description: Raise upper bounds | ||
notes: > | ||
For Quickcheck, aeson, http-client, servant, servant-client and | ||
servant-server. | ||
pr: none | ||
authors: jkarni | ||
date: 2016-10-03 | ||
|
||
|
||
- version: "0.0.2.0" | ||
changes: | ||
|
||
- description: Update CHANGELOG to YAML syntax. | ||
pr: 16 | ||
authors: jkarni | ||
date: 2016-09-14 | ||
|
||
- description: Support new CaptureAll combinator | ||
pr: 16 | ||
authors: jkarni | ||
date: 2016-09-14 | ||
|
||
- description: Support GHC 8 | ||
pr: 16 | ||
authors: jkarni | ||
date: 2016-09-14 | ||
|
||
- version: "0.0.1.1" | ||
changes: | ||
|
||
- description: Exclude GHC 7.8 (by bumping base lower bound to 4.8) | ||
pr: none | ||
authors: jkarni | ||
|
||
- description: More generous bounds for other packages. | ||
pr: none | ||
authors: jkarni | ||
|
||
- version: "0.0.1.0" | ||
changes: | ||
|
||
- description: Better error messages. | ||
notes: > | ||
Error messages now contain failing predicate, failing response and | ||
(except for response predicates), failing requests. | ||
pr: none | ||
authors: jkarni | ||
|
||
- description: Signicant changes to RequestPredicate and ResponsePredicate types. | ||
pr: none | ||
authors: jkarni |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# servant-quickcheck | ||
|
||
`servant-quickcheck` provides tools to test properties across entire APIs. | ||
Rather than writing the same tests for each endpoint, with `servant-quickcheck` | ||
you can simply specify properties every endpoint must meet once and for all. | ||
For example: | ||
|
||
``` haskell | ||
followsBestPractices :: Spec | ||
followsBestPractices = describe "my API" $ do | ||
|
||
it "follows best practices" $ do | ||
withServantServer myAPI myServer $ \burl -> | ||
serverSatisfies api burl stdArgs | ||
( not500 | ||
<%> onlyJsonObjects | ||
<%> getsHaveCacheControlHeader | ||
<%> headsHaveCacheControlHeader | ||
<%> mempty) | ||
``` | ||
|
||
Additionally, `servant-quickcheck` provides a `serversEqual` function that | ||
generates arbitrary requests (that conform to the description of an API) and | ||
tests that two servers respond identically to them. This can be useful when | ||
refactoring or rewriting an API that should not change. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
packages: | ||
./. | ||
|
||
-- due to a bug in the nixpkgs haskell infrastructure (or cabal, if you will) | ||
-- it is impossible to provided hspec-discover in a devShell therefore having | ||
-- to resort to downloads from hackage | ||
repository hackage.haskell.org | ||
url: http://hackage.haskell.org/ | ||
|
||
tests: true | ||
|
||
allow-newer: servant-blaze:servant | ||
|
||
test-show-details: direct |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import ServersEqual | ||
|
||
main :: IO () | ||
main = main1 |
Oops, something went wrong.