Skip to content

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

Notifications You must be signed in to change notification settings

Kleidukos/diff-package-api

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

diff-package-api

Usage

Install the appropriate version of print-api in your development environment and build your project with GHC environment files enabled:

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

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

$ print-api -p <your-package>

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:

- name: Diff the expected and actual package APIs
  uses: kleidukos/[email protected]
  with:
    package-name: <my-package>
    expected-interface: <the path where you track the canonical interface file>
    ghc: <The GHC version you use in CI>
    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 }}