-
Notifications
You must be signed in to change notification settings - Fork 94
150 lines (130 loc) · 4.92 KB
/
ci.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: default
on:
push:
branches: [ main, next ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: [ '8.0', '8.1', '8.2' ]
laravel-version: [ '^6.0', '^7.0', '^8.0', '^9.0', '^10.0' ]
database: [ 'sqlite', 'mysql', 'pgsql' ]
exclude:
- php-version: '8.1'
laravel-version: '^6.0'
database: 'sqlite'
- php-version: '8.1'
laravel-version: '^6.0'
database: 'mysql'
- php-version: '8.1'
laravel-version: '^6.0'
database: 'pgsql'
- php-version: '8.1'
laravel-version: '^7.0'
database: 'sqlite'
- php-version: '8.1'
laravel-version: '^7.0'
database: 'mysql'
- php-version: '8.1'
laravel-version: '^7.0'
database: 'pgsql'
- php-version: '8.2'
laravel-version: '^6.0'
database: 'sqlite'
- php-version: '8.2'
laravel-version: '^6.0'
database: 'mysql'
- php-version: '8.2'
laravel-version: '^6.0'
database: 'pgsql'
- php-version: '8.2'
laravel-version: '^7.0'
database: 'sqlite'
- php-version: '8.2'
laravel-version: '^7.0'
database: 'mysql'
- php-version: '8.2'
laravel-version: '^7.0'
database: 'pgsql'
name: Tests on PHP ${{ matrix.php-version }} with Laravel ${{ matrix.laravel-version }} and ${{ matrix.database }}
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: orion
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
pgsql:
image: postgres:10.8
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: orion
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php-version }}-laravel-${{ matrix.laravel-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-version }}-laravel-${{ matrix.laravel-version }}-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer update --with "illuminate/contracts=${{ matrix.laravel-version }}" --prefer-dist --no-progress
- name: Install orchestra/testbench=^4.0 only for Laravel 6.0
if: matrix.laravel-version == '^6.0'
run: composer update --with "orchestra/testbench=^4.0" --prefer-dist --no-progress
- name: Install orchestra/testbench=^5.0 only for Laravel 7.0
if: matrix.laravel-version == '^7.0'
run: composer update --with "orchestra/testbench=^5.0" --prefer-dist --no-progress
- name: Install laravel/legacy-factories only for Laravel >= 8.0
if: matrix.laravel-version == '^8.0' || matrix.laravel-version == '^9.0'
run: composer require "laravel/legacy-factories" --prefer-dist --no-progress
- name: Upgrade to PHPUnit 9 for PHP >= 8.0
if: matrix.laravel-version == '^8.0' || matrix.laravel-version == '^9.0'
run: composer update --with "phpunit/phpunit=^9.0" --prefer-dist --no-progress
- name: Upgrade PHPUnit Config for Laravel >= 8.0
if: matrix.laravel-version == '^8.0' || matrix.laravel-version == '^9.0'
run: vendor/bin/phpunit -c phpunit.xml.dist --migrate-configuration
- name: Run test suite with Sqlite
if: matrix.database == 'sqlite'
run: vendor/bin/phpunit --debug
env:
DB_CONNECTION: sqlite
DB_DATABASE: ':memory:'
- name: Run test suite with MySQL
if: matrix.database == 'mysql'
run: vendor/bin/phpunit --debug
env:
DB_CONNECTION: mysql
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_DATABASE: orion
DB_USERNAME: root
- name: Run test suite with PostgreSQL
if: matrix.database == 'pgsql'
run: vendor/bin/phpunit --debug
env:
DB_CONNECTION: pgsql
DB_PORT: ${{ job.services.pgsql.ports[5432] }}
DB_DATABASE: orion
DB_USERNAME: postgres
DB_PASSWORD: postgres