-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (75 loc) · 2.26 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
name: ci
on:
schedule:
- cron: "0 16 * * *"
push:
pull_request:
jobs:
phpunit:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
php:
- 7.4
- 8.0
- 8.1
- 8.2
- 8.3
prefer-lowest: [false]
experimental: [false]
# include:
# - php: 8.4
# prefer-lowest: false
# experimental: true
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: testing
ports:
- 13306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: pdo, pdo_mysql, mbstring #optional, setup extensions
coverage: none #optional, setup coverage driver
tools: phpunit:9
- name: Check Version
run: |
php -v
php -m
composer -V
- name: Validate composer.json and composer.lock
run: composer validate
- name: Get composer cache directory
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache vendor
uses: actions/cache@v4
env:
cache-name: composer-cache
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-build-${{ env.cache-name }}
- name: Install dependencies (composer.lock)
if: false == matrix.prefer-lowest
run: composer install --prefer-dist --no-progress
- name: Install dependencies (prefer-lowest)
if: true == matrix.prefer-lowest
run: composer update --prefer-dist --no-progress --no-suggest --prefer-lowest
- name: Run test suite
run: phpunit -v
env:
TESTS_DB_MYSQL_HOST: 127.0.0.1
TESTS_DB_MYSQL_PORT: 13306
TESTS_DB_MYSQL_USERNAME: root
TESTS_DB_MYSQL_PASSWORD: password
TESTS_DB_MYSQL_DATABASE: testing