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

Possible to build test dependencies without running tests? #462

Closed
dkubb opened this issue Jun 30, 2015 · 4 comments
Closed

Possible to build test dependencies without running tests? #462

dkubb opened this issue Jun 30, 2015 · 4 comments

Comments

@dkubb
Copy link

dkubb commented Jun 30, 2015

I am using stack with CircleCI, and I'd like a way to build the test dependencies up-front without actually running the tests. With CircleCI I am caching the build output so that repeated runs are done more quickly. Here is what I am doing:

Setup:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C5705533DA4F78D8664B5DC0575159689BEFB442
echo 'deb http://download.fpcomplete.com/ubuntu/precise stable main' | sudo tee /etc/apt/sources.list.d/fpco.list
sudo apt-get update
sudo apt-get install stack -y

Build:

# A snapshot of .stack-work and ~/.stack is restored from a previous run (if any)

stack build --no-terminal --install-ghc --jobs 2
stack test --prefetch --dry-run

# A snapshot of .stack-work and ~/.stack is persisted

Test:

stack test

The problem is the stack test still goes through a lengthy build process. I would love to be able to do this in the build phase rather than when the tests run.

Also if there's anything else I could improve in my stack usage please let me know.

@DanBurton
Copy link
Contributor

👍 great feature request, not sure if we have it yet.

@dkubb
Copy link
Author

dkubb commented Jun 30, 2015

Originally my assumption was that stack build would just build all dependencies by default. I was surprised when it didn't.

In the meantime I hacked together something ugly that does compile all the test dependencies:

stack test --prefetch --dry-run \
  | sed -e '1,/^Would build:/d' -e '/^Would test:/,$d' \
  | cut -d":" -f1 \
  | xargs -I{} stack build {} --no-terminal --jobs 2

It seems to work, but is obviously brittle since it will break if the prefetch output changes even slightly.

@snoyberg
Copy link
Contributor

That's what we added the --only-snapshot flag for. Check out #387 and #310

@snoyberg
Copy link
Contributor

snoyberg commented Jul 2, 2015

I'm going to close this as unnecessary based on the --only-snapshot flag. If there's some issue with this, let's discuss (probably in #387).

@snoyberg snoyberg closed this as completed Jul 2, 2015
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

3 participants