Is it possible to deploy only if tests / ci passes
konung opened this issue · comments
I can't seem to find a way to set mina only to deploy if either rake test
or integration with ci
service like GitlabCi or TravisCi returns all green.
I was thinking of just running a run(:local) {'rake test'}
and parse the result, to see if tests are green.
Is there a better way to do it?
P.S.: Thank you for a great tool!
Just FYI that may be useful to someone, this is what I currently have at the top of my task :deploy
task :deploy do
run(:local) do
puts %(
*** RUNNING TESTS ***
)
tests_result = `rake test`
error_message = %(
*** CAN'T DEPLOY ***
*** TESTS ARE NOT PASSING ***
)
raise error_message unless tests_result.include?('0 failures, 0 errors')
end
deploy do
'.....'
end
end
Did you manage to integrate mina with travis/gitlabci by any chance?
Hi.
I dont use a ci for this project. Just running local tests ( it’s enough for now for my purposes )
Having said that, you should be able to do something similar, where you trigger a ci job, and either wait for response or poll periodically for a yay or nay response, or checks o see if the last test job that ran on your branch resulted from failure or not.
I see.. will try some experiments, thanks man! :-)
Report back here for others if you figure something out. :D Good luck
Hi, if you're deploying locally you can always do rake test && mina deploy
. This will run the tests first and, if they pass, it will continue with the deploy command. If they don't pass, it won't deploy.
If you're using a CI it works in a similar way if jobs are sequential. You would have two jobs: rake test
and mina deploy
. If the first job passes (exits with status 0), then the second job will execute.
Hope this answers your question.