-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (122 loc) · 3.95 KB
/
Copy pathphpunit.yml
File metadata and controls
138 lines (122 loc) · 3.95 KB
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
name: PHPUnit
on:
push:
pull_request:
concurrency:
group: phpunit-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: PHP ${{ matrix.php }} PHPUnit ${{ matrix.phpunit }}
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
phpunit: [9, 10, 11, 12, 13]
exclude:
# PHPUnit 10 requires PHP >= 8.1
- php: '7.4'
phpunit: 10
- php: '7.4'
phpunit: 11
- php: '7.4'
phpunit: 12
- php: '7.4'
phpunit: 13
- php: '8.0'
phpunit: 10
- php: '8.0'
phpunit: 11
- php: '8.0'
phpunit: 12
- php: '8.0'
phpunit: 13
# PHPUnit 11 requires PHP >= 8.2
- php: '8.1'
phpunit: 11
- php: '8.1'
phpunit: 12
- php: '8.1'
phpunit: 13
# PHPUnit 12 requires PHP >= 8.3
- php: '8.2'
phpunit: 12
- php: '8.2'
phpunit: 13
# PHPUnit 13 requires PHP >= 8.4
- php: '8.3'
phpunit: 13
services:
mysql:
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: test
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1"
--health-interval=10s
--health-timeout=5s
--health-retries=10
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
extensions: dom, json, pdo, pdo_mysql, mbstring, tokenizer, xml, xmlwriter
coverage: none
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache Composer dependencies
uses: actions/cache@v5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
restore-keys: |
php-${{ matrix.php }}-composer-
- name: Install Composer dependencies
run: composer install --no-interaction --prefer-dist --no-dev
- name: Cache PHPUnit PHAR
id: phpunit-phar-cache
uses: actions/cache@v5
with:
path: test/tools/phpunit-phars/phpunit${{ matrix.phpunit }}.phar
key: phpunit-${{ matrix.phpunit }}-phar
- name: Download PHPUnit PHAR
if: steps.phpunit-phar-cache.outputs.cache-hit != 'true'
run: |
mkdir -p test/tools/phpunit-phars
curl -fsSL -o "test/tools/phpunit-phars/phpunit${{ matrix.phpunit }}.phar" \
"https://phar.phpunit.de/phpunit-${{ matrix.phpunit }}.phar"
- name: Wait for MySQL
run: |
for i in $(seq 1 30); do
if php -r "new PDO('mysql:host=127.0.0.1', 'root', '');" 2>/dev/null; then
echo "MySQL is ready"
exit 0
fi
sleep 2
done
echo "MySQL did not become ready in time"
exit 1
- name: Patch MySQL DSNs for TCP
run: |
# Linux resolves host-less mysql DSNs via Unix socket; the service listens on TCP.
find test/fixtures \( -name 'build.properties' -o -name 'runtime-conf.xml' \) -print0 \
| xargs -0 sed -i 's|mysql:dbname=|mysql:host=127.0.0.1;dbname=|g'
- name: Prepare test fixtures
run: |
chmod +x ../generator/bin/propel-gen
./reset_tests.sh
working-directory: test
- name: Run PHPUnit
run: |
php "test/tools/phpunit-phars/phpunit${{ matrix.phpunit }}.phar" \
--configuration phpunit.xml.dist