1

We host our web app source code on GitHub, and whenever something's pushed to the master branch, it's deployed to Heroku via CodeShip.

Currently, we have two environments on Heroku: staging and production (we develop locally).

I've created a test suite for the website in PHPUnit (while using BrowserStack SaaS as a frontend for Selenium), and would now like to integrate that into our deployment pipeline.

How would I do that? Heroku's new Review Apps seem like a good choice, but have in mind that I need to actually deploy the website app first and copy over the environmental variables.

This is how I imagine it should work:

  1. Push to master on GitHub
  2. CodeShip is triggered
  3. PHPUnit tests are executed
  4. A new version of web app is deployed to Heroku if tests pass

TLDR; I'm trying to integrate my PHPUnit tests into our Github -> Heroku pipeline, and only deploy if the tests succeed. How do I integrate the PHPUnit tests ?

The Onin
  • 5,068
  • 2
  • 38
  • 55
  • In most cases you should be able to add the same command that you use locally to run your unit tests to the _Test Commands_ section in your project settings. Codeship will only run the depoloyment if all setup and test steps are successful. – mlocher Feb 28 '17 at 13:09
  • @mlocher The tests are not unit tests. – The Onin Feb 28 '17 at 13:22
  • Sorry, I misjudged based on the framework name. The process should work the same though. The same commands you run locally should be able to get the job done on Codeship as well. You can also create a new ticket on https://helpdesk.codeship.com and include a link to your project so I can look into this in more detail. (Working for Codeship) :) – mlocher Feb 28 '17 at 13:24
  • @mlocher I am aware of the fact that you work for CS, and I appreciate you lurking around codeship tags and trying to help. In my case, I need to first deploy the website, and then test it. I've worked with unit tests before on Travis, and the only thing that I needed to do was hook it up and let Travis run `phpunit` once something got pushed to master or a PR was submitted. This is completely different, but I did found a way using Heroku's review apps. I will post a guide on how I did it once I'm done with it. – The Onin Mar 01 '17 at 10:54
  • 1
    awesome, let me know if you have any further questions, I'd be happy to answer them. – mlocher Mar 02 '17 at 12:56

0 Answers0