-
Notifications
You must be signed in to change notification settings - Fork 317
Add Testpack API implementation to support Heroku CI #92
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
Conversation
@@ -61,7 +61,7 @@ function export_mix_env() { | |||
if [ -d $env_path ] && [ -f $env_path/MIX_ENV ]; then | |||
export MIX_ENV=$(cat $env_path/MIX_ENV) | |||
else | |||
export MIX_ENV=prod | |||
export MIX_ENV=${1:-prod} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I am not very familiar with bash syntax. How does this ensure we build in the test
environment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just means use the 1st argument provided to the function, or if there wasn't a first argument, use 'prod'.
That leaves the original usage (export_mix_env
) unchanged, but you can now provide a fallback other than prod with export_mix_env 'test'
.
What's nice here is that if a user did specify something like MIX_ENV=dev for a test run (albeit that would be weird), this wouldn't overwrite it.
This looks very interesting, I am excited to try this feature out. I would appreciate it if you can flip the beta flag for me. Should I create an heroku app from your example app? Are there any instructions on how to enable and run the CI? Do you have any example apps that are using the TAP output? I would be interested in seeing how it compares to |
Cool, I just enabled ci for your publicly displayed email. You should get an email soon with directions. I'll collaborate you onto the example app too so you can check it out. As far as TAP output goes, I haven't seen an Elixir project using it yet. Here's some TAP output from one of my Ruby projects:
It looks like ex_unit has support for custom formatters, which may make supporting TAP feasible. |
@joshwlewis This is very cool. Can I try it out too? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@ericmj Going y the TestPack API doc, TAP output isn't mandatory. So we can merge this right away unless you have something in mind. We can suggest a list of TAP formatters on the readme. @Stratus3D has a TAP implementation for ExUnit https://github.com/Stratus3D/spout. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ~! 🖖
Yeah, I just wanted to see an example of how Heroku diplays the TAP output so I know if it's something worth working on for ExUnit :) |
Thank you @joshwlewis! |
Thanks, y'all. @HashNuke, I've flipped the bit for you too, expect an email soon. I also collaborated you on the example app, so you can check it out. |
@ericmj, @HashNuke -- Regarding TAP formatters, I wasn't able to get Stratus3D/spout working. Additionally, it seems to be dumping the output to a file at the end, rather than using STDOUT streaming (streaming output is one of the strongest features of TAP over say JUnit). I've got my own formatter in progress at joshwlewis/tapex. Though, maybe it's something that would fit in ExUnit itself? |
@joshwlewis That's great. I will talk with the rest of the core team about what they think of additional formatters in ExUnit. It should be straight-forward to use as a dependency also. |
@ericmj @joshwlewis I got hung up on the best way to test the formatter and never completed spout. I've got a whole bunch of uncommitted changes locally that I'll sort though tomorrow. I started the project because we were going to need TAP formatters for Erlang and Elixir for something at work, but things changed and we didn't need them so I haven't had any motivation to finish it. |
@joshwlewis - I've recently been added to the beta and I'm attempting to get my tests running using this awesome new feature!
I believe I am receiving this error due to my application being an Umbrella app, I can't seem to figure out or diagnose why this is. If remove
it works fine :( |
@cbarratt Can you share your project or create a project that reproduces? |
@ericmj - Apologies for stirring this conversation up. I've managed to fix it! Turns out that I have the |
No worries, thanks for updating us. |
I'm glad you got it fixed @cbarratt. If you have any additional problems or feedback, you can ask the Heroku CI team here: heroku-ci-feedback@heroku.com. |
Has anyone been using this buildpack with Heroku CI recently? I was able to get everything setup in a fresh elixir/phoenix project today, but I can't seem to get the tests to run under Heroku CI.
The error above occurs when the tests go to run, after setup, but when looking into the test setup, there are various errors along the way such as:
When attempting to debug with Any insight? I'm in the middle of writing an email to the heroku-ci team, since @joshwlewis was gracious enough to add that here, but thought I'd post first. |
hey @jah2488 |
@cblavier Yep, I needed to change my |
Ok, thanks, didn't know it was your post! I had already read it, but unfortunately it's not helping :/ Did you manage to get |
@cblavier From the error you posted on SO, it looks like your test DB is trying to connect directly to your prod DB. I got that error once, because I had copied over my database_url from production to the testing pipeline, which was the wrong approach. The only env vars I have setup for CI are It may be worth checking out the example app that heroku has up. https://github.com/joshwlewis/giphy-mcgiface/blob/master/config/test.exs |
* Add scripts required for Heroku CI * Don't overwrite existing MIX_ENV * bin/test and bin/test-compile should be executable * export_mix_env should fallback without an argument * No need to specify MIX_ENV, it's already set
Heroku CI is supporting a new Testpack API, which will allow buildpack users to have their tests compiled and ran with minimal configuration (hopefully none).
This PR implements that API so that
mix test
is runYou can see a passing test run on this example app.
Heroku CI is in private beta right now, but I can certainly flag buildpack maintainers in.