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

Development Workflow #733

Closed
gdevanla opened this issue Oct 13, 2019 · 11 comments
Closed

Development Workflow #733

gdevanla opened this issue Oct 13, 2019 · 11 comments

Comments

@gdevanla
Copy link
Contributor

gdevanla commented Oct 13, 2019

One challenge I have had while making incremental changes to the code base was that running stack build or stack test takes a while. What is the workflow other contributors follow in these scenarios?

At the least, when I run stack test, I would like to have a way to just run specific tests or just tests within a particular scope. Currently, when I run stack test,a lot of time is spent in building libraries like criterion and 'statistics`. Is there a way to turn them off as needed.

Overall, I would like to contribute to a document (assuming this is not there already) that describes a development workflow which other contributors could use. Can someone point me to any resources or share their workflow. I can create a document by compiling those.

@Lysxia
Copy link
Collaborator

Lysxia commented Oct 13, 2019

I also wonder about this. criterion takes a loooong time to build. However it's only used by benchmarks. Does your stack.yaml mention the benchmarks/ directory? If so, it should be okay to remove it.

If you do want to build benchmarks, there is still a hacky way to avoid rebuilding criterion, which is to rename the version of aeson you're working on so that criterion doesn't depend on it. I don't know whether there is a more principled solution.

+1 to having this documented somewhere.

@bergmark
Copy link
Collaborator

I usually use ghci while developing. For stack: stack ghci --stack-yaml stack-nightly.yaml --test
which doesn't include benchmarks. :r to reload and main to run the test suite. Speeds things up a lot!

The tests are run with tasty, I forget how you filter which tests to run, but it seems to be possible e.g. using --pattern.

It think CONTRIBUTING.md is a good place for this info.

Thanks in advance

@bergmark
Copy link
Collaborator

You can apply cmd line args inside ghci using withArgs args main

@phadej
Copy link
Collaborator

phadej commented Oct 14, 2019

@bergmark also

:main --pattern Foo

@bergmark
Copy link
Collaborator

oh, nice!

@phadej
Copy link
Collaborator

phadej commented Oct 14, 2019

Also adding historyDuplicates: IgnoreConsecutive to ~/.haskeline would reduce the :r s in your history, improves GHCi driven development experience hugely. https://github.com/judah/haskeline/wiki/UserPreferences

gdevanla added a commit to gdevanla/aeson that referenced this issue Oct 15, 2019
Summarize notes discussed at haskell#733
@gdevanla
Copy link
Contributor Author

gdevanla commented Oct 16, 2019

With the latest changes on master, I am currently seeing this error. Any tips on how to handle this would be appreciated!

$ stack ghci --stack-yaml stack-nightly.yaml --test
Using main module: 1. Package `aeson' component aeson:test:tests with main-is file: ~/fsf/aeson/tests/Tests.hs

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for aeson-1.4.5.0(+fast):
    Diff-0.3.4 from stack configuration does not match >=0.4 && <0.5  (latest matching version is 0.4.0)
needed since aeson is a build target.

Some different approaches to resolving this:

  * Set 'allow-newer: true' in ~/.stack/config.yaml to ignore all version constraints and build anyway.

  * Recommended action: try adding the following to your extra-deps in ~/fsf/aeson/stack-nightly.yaml:

- Diff-0.4.0@sha256:b5cfbeed498f555a18774ffd549bbeff7a24bdfe5984154dcfc9f4328a3c2847,1275


Error: Plan construction failed.

@bergmark
Copy link
Collaborator

Ah sorry, I forgot that i updated it locally. Try this:

resolver: nightly-2019-10-14
packages:
- '.'
- attoparsec-iso8601
flags:
  aeson:
    fast: true
  attoparsec-iso8601:
    fast: true
extra-deps:
- generic-deriving-1.12.4

@gdevanla
Copy link
Contributor Author

Thanks, that works. Shouldn't this change be on master?

@bergmark
Copy link
Collaborator

Indeed it should

bergmark added a commit that referenced this issue Feb 6, 2020
* Add section on Development Workflow

* Referenced issue #773 to provide additional context,

* Add section on Development Workflow

Summarize notes discussed at #733

* clean up CONTRIBUTING.md

* Update stack-nightly

The update required to accommodate changes to version of Diff packages.

* rollback changes to stack nightly

* update stack-nightly.yaml. Required to be compatible with changes done on issue PR #729

* update CONTRIBUTING.md with accurate listing the yaml files, clarify instructions

* add command line details in CONTRIBUTING.md

* Add cabal-install instructions

Co-authored-by: Adam Bergmark <adam@bergmark.nl>
@bergmark
Copy link
Collaborator

Resolved by #736

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

No branches or pull requests

4 participants