As I'm using GitHub Actions more and more in my daily workflow (pun intended), this post is covering how you can use the Docker Image in Actions.
First create a new workflow file under
.github/workflows/test.yml. Add the following code in your workflow file.
name: tests on: push jobs: phpunit: runs-on: ubuntu-latest container: # Need older releases? Switch out the tag (7.3) to 7.2 or 7.1 image: lorisleiva/laravel-docker:7.3 steps: - uses: actions/checkout@v1 with: fetch-depth: 1 - name: Composer dependencies run: composer install --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist - name: Prepare Laravel Application run: | cp .env.example .env php artisan key:generate - name: Run Testsuite run: vendor/bin/phpunit tests/
The workflow file is straightforward and easy to understand.
- We specify that the workflow should run on a Linux machine by setting
- We tell Actions, to run the
- The steps are pretty standard, but here's the quick summary
- Clone the projects code from GitHub
- Install composer-dependencies
- Prepare the Laravel Application by creating the
.envand setting the application key
- Run your testsuite with