{"id":625,"date":"2016-11-24T13:27:21","date_gmt":"2016-11-24T05:27:21","guid":{"rendered":"https:\/\/woohuiren.me\/blog\/?p=625"},"modified":"2016-11-24T13:27:21","modified_gmt":"2016-11-24T05:27:21","slug":"how-to-laravel-testing-on-gitlab-ci-with-docker","status":"publish","type":"post","link":"https:\/\/woohuiren.me\/blog\/how-to-laravel-testing-on-gitlab-ci-with-docker\/","title":{"rendered":"HOW TO: Laravel testing on Gitlab CI with Docker"},"content":{"rendered":"<p>This is just a quick mini-post sharing some of the nice stuff that I&#8217;ve done with my co-worker, Kheng Hui, while I was working on an A*STAR project. The project used Laravel 5.3 with PHP 7 and MySQL, and needed to have an in-house Gitlab CI environment that tests the code that was committed into the repository. Other than that, we had faced some challenges with the network as it was a little slow. We had to create a Docker image that has the Laravel dependencies packaged so that the build and test could be done at a faster pace.<\/p>\n<p>Kheng Hui dealt mostly with the server parts &#8212; configuring Gitlab, Gitlab CI&#8217;s runners and executors whilst I had to write some configuration files to test Laravel. As a Fedora ambassador, whenever the Gitlab server had issues, I always told Kheng Hui in a very sarcastic manner, &#8220;What OS is the server running? Ubuntu? That&#8217;s the problem! Why aren&#8217;t you running Fedora?&#8221; Of course, the problems wasn&#8217;t an OS issue.<\/p>\n<p>I was also very fortunate as my A*STAR supervisor, Rafael, was a very open minded and friendly person that allowed me to opensource some of the components that I&#8217;ve worked on, as long as they were &#8220;MIT licensed&#8221; (of course!). I&#8217;m going to make some possibly reasonable assumptions about your CI environment &#8211; you have <a href=\"https:\/\/about.gitlab.com\/\">Gitlab<\/a> with <a href=\"https:\/\/docs.gitlab.com\/runner\/install\/linux-repository.html\">CI installed<\/a>, have a <a href=\"https:\/\/docs.gitlab.com\/ce\/ci\/runners\/README.html\">(shared or specific) CI runner configured<\/a>, and have <a href=\"https:\/\/docs.gitlab.com\/runner\/executors\/docker.html\">selected Docker as your executor<\/a> for your runner.<\/p>\n<p>Now, you just have to <a href=\"https:\/\/github.com\/GIANTCRAB\/gitlabby-dockerish-laravel\">copy these files<\/a> that I have uploaded on Github into your Laravel base repository and you&#8217;re all set. From now onwards, every commit you make your Gitlab repository will trigger a build and run the test. That was easy, wasn&#8217;t it? :) If you encounter any issues, please let me know in the comments section below!<\/p>\n<p>If you&#8217;re interested in learning more of the gotchas and experience we had at A*STAR, do watch my presentation about Gitlab:<\/p>\n<div class=\"jetpack-video-wrapper\"><iframe loading=\"lazy\" width=\"840\" height=\"473\" src=\"https:\/\/www.youtube.com\/embed\/Gjk0sNw3FMg?feature=oembed\" frameborder=\"0\" allowfullscreen><\/iframe><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This is just a quick mini-post sharing some of the nice stuff that I&#8217;ve done with my co-worker, Kheng Hui, while I was working on an A*STAR project. The project used Laravel 5.3 with PHP 7 and MySQL, and needed to have an in-house Gitlab CI environment that tests the code that was committed into &hellip; <a href=\"https:\/\/woohuiren.me\/blog\/how-to-laravel-testing-on-gitlab-ci-with-docker\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;HOW TO: Laravel testing on Gitlab CI with Docker&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[2,4,5,29],"tags":[139,140,141,142,143,30,144,145],"class_list":["post-625","post","type-post","status-publish","format-standard","hentry","category-information-technology","category-it-softwares","category-programming","category-tutorials","tag-docker","tag-gitlab","tag-gitlab-ci","tag-gitlab-ci-runner","tag-laravel","tag-php","tag-php-7","tag-php-testing"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/posts\/625"}],"collection":[{"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/comments?post=625"}],"version-history":[{"count":1,"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/posts\/625\/revisions"}],"predecessor-version":[{"id":626,"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/posts\/625\/revisions\/626"}],"wp:attachment":[{"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/media?parent=625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/categories?post=625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/woohuiren.me\/blog\/wp-json\/wp\/v2\/tags?post=625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}