Using Github Actions to setup CI/CD with Laravel (and MySQL)

Luís Dalmolin
Nov 1 · 2 min read

At the time of the writing of this post, Github Actions is out of beta and will be available to everyone on November 13. It is a great option which can automate a lot of things. One of these things is to run your CI/CD pipeline (aka PHPUnit tests).

This blog post will show you how to configure Github actions to run your phpunit tests, how to deploy after your tests pass and a few other things. We'll also show you how to connect to a database (MySQL, Postgres or SQLite) to run your test suite.

The first thing we’ll need is a docker container with PHP installed that is able to run our Laravel test suite. We, at KDG, put together a docker container specifically for this purpose. The docker container can be found at:

  • PHP 7.3: kirschbaumdevelopment/laravel-test-runner:7.3.0
  • PHP 7.2: kirschbaumdevelopment/laravel-test-runner:7.2.0

The Github repository can be found at Laravel Test Runner Container. Please open issues or send pull requests if you find any libraries missing for your needs.

We also created this example repository which is using the setup mentioned below to run the test suite.

Continue reading at https://kirschbaumdevelopment.com/news-articles/using-github-actions-to-setup-ci-cd-with-laravel-and-mysql

Luís Dalmolin

Written by

Full Stack Developer. Laravel and a LOT more.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade