-
-
Notifications
You must be signed in to change notification settings - Fork 222
161 lines (138 loc) · 4.98 KB
/
phpunit.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
151
152
153
154
155
156
157
158
159
160
name: PHP Unit
on:
push:
branches:
- "master"
pull_request:
types:
- synchronize
- opened
- edited
- reopened
jobs:
test:
# Setup ubuntu latest
runs-on: ubuntu-latest
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: laravel
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
strategy:
fail-fast: false
matrix:
php: [8.0, 8.1]
laravel: ["8.*", "9.*"]
laravel-require: [8.0]
mysql-version: [8.0]
coverage: [none]
include:
- php: 8.1
laravel: 9.*
laravel-require: 8.0
mysql-version: 8.0
coverage: xdebug
name: "PHP ${{ matrix.php }} / Laravel ${{ matrix.laravel }}"
steps:
- uses: actions/checkout@master
# Configure Mysql
- name: Mysql setup
uses: ankane/setup-mysql@v1
with:
mysql-version: ${{ matrix.mysql-version }}
database: laravel
# Configure PHP
- name: Select PHP version
uses: shivammathur/setup-php@master
with:
php-version: "${{ matrix.php }}"
extensions: mbstring, pdo_sqlite, fileinfo, gd, php_pgsql, json, openssl, php_pcov
coverage: xdebug
# Install legacy factories for Laravel 8/9
- name: Install legacy factories for Laravel
run: composer create-project laravel/laravel:^${{matrix.laravel-require}} laravel
# Display installed laravel version
- name: Show laravel version
run: cd laravel &&
composer show laravel/framework &&
php artisan db:wipe
# Laravel require badaso core
- name: Laravel file configuration
run: git branch &&
cd laravel &&
composer require badaso/core:dev-${GITHUB_HEAD_REF} --ignore-platform-reqs -W &&
composer update --no-interaction -W
# Mysql | Laravel setup
- name: Mysql | Laravel setup
run: cd laravel &&
php artisan badaso:setup --force &&
php artisan badaso-test:setup &&
php artisan db:wipe &&
php artisan migrate &&
php artisan db:seed --class="Database\Seeders\Badaso\BadasoSeeder" &&
key=$(eval "php artisan jwt:secret -s") &&
sed -i 's/JWT_SECRET=/JWT_SECRET="'${key}'"/g' .env
# Mysql | Badaso core test
- name: Mysql | Badaso core test
run: cd laravel && php artisan test
# Sqlite | Laravel configuration
- name: Sqlite | Laravel file configuration
run: cd laravel &&
touch database/database.sqlite &&
sed -i 's/DB_CONNECTION=mysql/DB_CONNECTION=sqlite/g' .env &&
sed -i 's/DB_DATABASE=laravel/DB_DATABASE=database\/database.sqlite/g' .env
# Sqlite | Laravel setup
- name: Sqlite | Laravel setup
run: cd laravel &&
php artisan badaso:setup --force &&
php artisan badaso-test:setup &&
php artisan db:wipe &&
php artisan migrate &&
php artisan db:seed --class="Database\Seeders\Badaso\BadasoSeeder"
# Sqlite | Badaso core test
- name: Sqlite | Badaso core test
run: cd laravel && php artisan test
# Pgsql | Laravel configuration
- name: Pgsql | Laravel file configuration
run: cd laravel &&
sed -i 's/DB_CONNECTION=sqlite/DB_CONNECTION=pgsql/g' .env &&
sed -i 's/DB_DATABASE=database\/database.sqlite/DB_DATABASE=laravel/g' .env &&
sed -i 's/DB_PASSWORD=/DB_PASSWORD=postgres/g' .env &&
sed -i 's/DB_HOST=127.0.0.1/DB_HOST=localhost/g' .env &&
sed -i 's/DB_USERNAME=root/DB_USERNAME=postgres/g' .env &&
sed -i 's/DB_PORT=3306/DB_PORT=5432/g' .env
# Pgsql | Laravel setup
- name: Pgsql | Laravel setup
run: cd laravel &&
php artisan badaso:setup --force &&
php artisan badaso-test:setup &&
php artisan db:wipe &&
php artisan migrate &&
php artisan db:seed --class="Database\Seeders\Badaso\BadasoSeeder"
# Pgsql | Badaso core test
- name: Pgsql | Badaso core test
run: cd laravel && php artisan test
# Running Test
- name: Running Test
if: matrix.coverage == 'xdebug'
run: cd laravel && ./vendor/bin/phpunit --coverage-text --coverage-clover='reports/coverage/coverage.xml'
# Upload coverage
- name: Upload coverage
uses: codecov/codecov-action@v2
if: matrix.coverage == 'xdebug'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: laravel/reports/coverage/coverage.xml