Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kleidukos/diff-package-api

Workflow to have golden tests on your Haskell package's API
https://github.com/kleidukos/diff-package-api

golden-test haskell stability

Last synced: 2 months ago
JSON representation

Workflow to have golden tests on your Haskell package's API

Awesome Lists containing this project

README

        

# diff-package-api

## Usage

Install the appropriate version of [print-api](https://github.com/Kleidukos/print-api) in your development environment and build your project with GHC environment files enabled:

```bash
$ cabal build --write-ghc-environment-files=always
```

Then produce the human-readable API summary with the command:

```bash
$ print-api -p
```

And save the output to a file in the repository. You will track this file so that the workflow may compare
its results during CI with this canonical file.

In your Workflow file, add the `--write-ghc-environment-files=always` option to your `cabal build` line, and after build and tests have passed, add:

```yaml
- name: Diff the expected and actual package APIs
uses: kleidukos/[email protected]
with:
package-name:
expected-interface:
ghc:
version: 0.1.0.1 # This is the version of the print-api tool
```

If you use a job matrix, the value of the `ghc:` parameter may be `${{ matrix.ghc }}`