-
Notifications
You must be signed in to change notification settings - Fork 142
85 lines (64 loc) · 2.53 KB
/
php.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
name: Build
on:
push:
pull_request:
types: [opened, reopened, synchronize, edited]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
operating-system: ['ubuntu-latest']
php-versions: ['8.1', '8.0','7.4']
services:
mariadb:
image: mariadb:10
ports:
- 3306:3306
env:
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_DATABASE: yii2-usuario-test
MYSQL_ROOT_PASSWORD: password
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, gd
ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug
- uses: actions/checkout@v2
- name: Verify MariaDB connection
run: |
while ! mysqladmin ping -h"127.0.0.1" --silent; do
sleep 1
done
- name: Validate PHP version
run: php -v
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Verify db connection & databases
run: mysql -e "SHOW DATABASES;" -h127.0.0.1 -uroot -ppassword
- name: Install
run: composer install --prefer-dist --no-interaction
- name: Run migrations
run: php tests/_app/yii.php migrate/up --interactive=0 --migrationPath=@yii/rbac/migrations
- name: Run tests
run: XDEBUG_MODE=coverage php vendor/bin/codecept run --coverage --coverage-xml
- name: Run static code analysis
run: vendor/bin/phpstan analyse
- name: Archive failed tests artifacts - test output & log
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-outputs-php-${{ matrix.php-versions }}
path: tests/_output