Ruben Van Assche from Spatie:
When GitHub released its new product: GitHub Actions a whole new world opened for developers. Let’s dive right in and see what it brings for the Laravel community.
In How to set up PHP for use in a GitHub Action I’ve layed out how to use shivammathur/setup-php@v1
in GitHub Actions. This post goes very nicely along with it. Recommended read, even if you don’t write Laravel (like me).
I especially like the part where an extra MySQL service is spun up from within the workflow, and then used in the tests.
// ...
jobs:
tests:
// ...
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: our-awesome-tested-app
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
// ...