-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (62 loc) · 1.97 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Test
on:
pull_request:
paths:
- '**.php'
- '**.yml'
push:
paths:
- '**.php'
- '**.yml'
jobs:
laravel:
name: Laravel ${{ matrix.laravel }} (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
env:
DB_DATABASE: laravel
DB_USERNAME: root
DB_PASSWORD: password
BROADCAST_DRIVER: log
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: laravel
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis
ports:
- 6379/tcp
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
matrix:
php: ['8.2', '8.3']
laravel: ['9.*', '10.*']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php }}
extension: mbstring, dom, fileinfo, mysql, zip
coverage: xdebug #optional
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Install Composer dependencies
run: |
composer require --dev "laravel/framework:${{ matrix.laravel }}" --no-update
composer update --no-progress --no-suggest --prefer-dist --optimize-autoloader
- name: Prepare the application
run: |
php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Test
run: ./vendor/bin/phpunit --coverage-text --coverage-clover=build/logs/clover.xml
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}