Closed kamcma closed 7 years ago
So the Vapor slack is informing me the Heroku slug does not contain the Swift toolchain, which is a short answer to my long question, but one that makes sense. Closing this as an issue, but would still love to hear if anyone has any insight about how I still might use the app.json
test
command to get at what I'm after. I see other app.json
s on GitHub which call npm test
, so I feel like it should be possible, somehow ...
Yes that is correct. The source for your application and the Swift tools are not compiled into your Heroku slug.
I can understand why you might want it for testing, but there are some implications to copying these over to the Heroku Slug. The larger the Heroku slug is, the slower your application would boot. There is a 500MB slug size limit which you'd be closer to. It would be around 100-200MB to include the Swift compiler over.
For other scripting languages, the source code and interpreter would already be available in the slug so testing those would be simple and add little overhead. In the case of a compile language like Swift I am not sure it is worth the tradeoff.
It would however be possible, but you would need to make some modifications to the build pack. If you're still interested in doing this. Let me know and I can provide some further guidance.
Ah, interpreted vs compiled, of course. Yeah, that makes it make a lot more sense. I come from compiled world, so that distinction didn't even occur to me.
Well, I'm still thinking about it. Heroku CI testing spins up one-off dynos, they're performance-m size regardless of what size your release dyno is, which means the size limit is 2.5 GB. You don't actually test in the release dyno.
I'll continue to chew over my options, but thanks for the insight.
Hello.
I am wondering if there is any way to manually invoke swift inside the Heroku slug, post-buildpack. I've spent some time studying the scripts, though my Bash is pretty elementary and I also don't know how swiftenv might be complicating this.
What I'm really trying to do is add a test script to the
app.json
manifest as described here. The test script (command, more like) gets run as part of Heroku Continuous Integration. According to Heroku, the test script "is likely the same thing you use in your local environment", i.e.swift test
. But when I try that, when Heroku CI runs that script, the output isbash: swift: command not found
. Which confuses me because clearly, at least somewhere in a prior step, swift was available whenswift build
was invoked.I can run
heroku ci:debug
on my local machine, and I think it basically goes through the process of constructing a slug, but on my local machine and then drops my command line at /app of the slug. Runningwhich swift
returns nothing.echo $PATH
returns/app/.swift-bin:/usr/local/bin:/usr/bin:/bin:/app/.sprettur/bin/:/app/.sprettur/bin/
.I feel like either something is being wiped between the buildpack step and CI test step, or I don't know the proper way to invoke swift after the buildpack has run.
Appreciate any insight you have.