Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run docspec in CI #53

Closed
wants to merge 1 commit into from
Closed

Conversation

tchoutri
Copy link

@tchoutri tchoutri commented Nov 8, 2021

This PR removes the dependency on cabal-doctest in favour of cabal-docspec.

Fix #52

@tchoutri tchoutri mentioned this pull request Nov 8, 2021
Comment on lines 50 to 57
- name: Fetch cabal-docspec
run: |
wget https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20210111/cabal-docspec-0.0.0.20210111.xz &&
unxz cabal-docspec-0.0.0.20210111.xz && mv cabal-docspec-0.0.0.20210111 cabal-docspec
chmod +x cabal-docspec
- name: Run cabal-docspec
run: ./cabal-docspec --check-properties --timeout=30
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this basically how people are recommended to run cabal-docspec locally as well?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty much, since it's not on Hackage (cf #52 (comment)).

, template-haskell
default-language:
Haskell2010
x-docspec-extra-packages: QuickCheck quickcheck-instances password password-types
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know how cabal-docspec is able to find these libraries? Does it call Cabal under the hood to install the necessary libraries listed here?

Also, does cabal-docspec work when building with stack?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know how cabal-docspec is able to find these libraries? Does it call Cabal under the hood to install the necessary libraries listed here?

The package must exist in the plan.json. It is explained here

Also, does cabal-docspec work when building with stack?

cabal-docspec is looking for a cabal-install plan.json, I don't think stack provides such a thing?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not being able to run doctests with stack or Nix seems pretty unfortunate. I'm not sure if I want to give that up.

I'll have to take a good look at the documentation you've linked to and think about how I feel about this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cdepillabout On my personal CI I use cabal-docspec the same way I use hlint, and I don't expect the results to diverge if Nix or stack is used. If you want I can create a third set of steps that is independent of cabal / stack.

Regarding Nix it's of course a bit more tricky since you need to patch the ELF.

Copy link
Owner

@cdepillabout cdepillabout Nov 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tchoutri Ah, sorry, maybe I don't quite understand because I haven't yet read the cabal-docspec manual.

I was assuming that since cabal-docspec reads the plan.json, and stack doesn't output a plan.json, that people using stack for development can't easily run cabal-docspec. (Same thing with Nix, or, for example, building password in Nixpkgs.)

I don't want to give up easy support for running doctests in stack and Nix. Although, like you say on the issue, if cabal-doctest is no longer being maintained, then maybe I have no choice here...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cdepillabout Okay I was wrong, you indeed need to build with cabal-install (which is the thing that provides plan.json, not necessarily the Cabal library).

I don't want to give up easy support for running doctests in stack and Nix. Although, like you say on the issue, if cabal-doctest is no longer being maintained, then maybe I have no choice here...

Unfortunately as you say, this easy support might disappear one day. :/
The best path forward from here is to team up with the Cabal team so that the library provides enough features that stack and cabal-install can implement lightweight runners on top of it and reach feature parity. I don't know much about how cabal2nix would do it though.

@cdepillabout
Copy link
Owner

There was a recent release of doctest that looks like it can be run directly with cabal repl: cdepillabout/pretty-simple#82 (comment).

@tchoutri tchoutri closed this Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dropping cabal-doctest
2 participants