-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
143 lines (125 loc) · 4.21 KB
/
build.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
on:
- pull_request
- push
name: build
jobs:
tests:
name: PHP ${{ matrix.php }}-${{ matrix.os }}
env:
extensions: curl, cubrid, mbstring, memcached, dom, intl, json, libxml, pdo, pdo_mysql, pdo_pgsql, pdo_sqlite, xml, xmlwriter, mcrypt
key-php5: cache-v1
key-php7: cache-v2
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
php:
- "5.3"
- "5.4"
- "5.5"
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
services:
mysql:
image: mysql:5.7
env:
MYSQL_USER: test
MYSQL_PASSWORD: test
MYSQL_DATABASE: yii
MYSQL_ROOT_PASSWORD: test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres:9.6
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: yii
ports:
- 5432:5432
options: --name=postgres --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis
ports:
- 6379:6379
options:
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Install service memcached
uses: niden/actions-memcached@v7
- name: Checkout
uses: actions/checkout@v4
- name: Setup cache environment 5.3 - 5.6
if: matrix.php < '7.0'
id: cache-env-php5
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions-php5 }}
key: ${{ env.key-php5 }}
- name: Setup cache environment 7.0 - 8.0
if: matrix.php >= '7.0'
id: cache-env-php7
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions-php7 }}
key: ${{ env.key-php7 }}
- name: Cache extensions 5.3 - 5.6
if: matrix.php < '7.0'
uses: actions/cache@v4
with:
path: ${{ steps.cache-env-php5.outputs.dir }}
key: ${{ steps.cache-env-php5.outputs.key }}
restore-keys: ${{ steps.cache-env-php5.outputs.key }}
- name: Cache extensions 7.0 - 8.0
if: matrix.php >= '7.0'
uses: actions/cache@v4
with:
path: ${{ steps.cache-env-php7.outputs.dir }}
key: ${{ steps.cache-env-php7.outputs.key }}
restore-keys: ${{ steps.cache-env-php7.outputs.key }}
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions }}
ini-values: date.timezone='UTC'
coverage: xdebug
tools: composer:v2, pecl
- name: Determine composer cache directory on Linux
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
- name: Determine composer cache directory on Windows
if: matrix.os == 'windows-latest'
run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Cache dependencies installed with composer
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php }}-composer-
- name: Install dependencies with composer
run: composer update --no-interaction --no-progress --optimize-autoloader --ansi
- name: Run tests with phpunit
run: |
cd tests
../vendor/bin/phpunit --verbose --colors=always --no-globals-backup --exclude-group mssql,oci,cubrid framework
env:
# The hostname used to communicate with the Redis service container
REDIS_HOST: localhost
# The default Redis port
REDIS_PORT: 6379