-
Notifications
You must be signed in to change notification settings - Fork 4
74 lines (74 loc) · 2.73 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
name: PHPUnit
on: [push, pull_request]
jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
# windows-latest, macOS-latest
operating-system: [ubuntu-latest]
php-version: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
name: PHP ${{ matrix.php-version }} Test on ${{ matrix.operating-system }}
# services:
# mysql:
# image: mysql:5.7
# env:
# MYSQL_ALLOW_EMPTY_PASSWORD: yes
# MYSQL_DATABASE: test
# ports:
# - 3306
# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
env:
MYSQL_DATABASE: test
MYSQL_USERNAME: root
MYSQL_PASSWORD: root
steps:
- name: Set up MySQL
continue-on-error: true
run: |
sudo /etc/init.d/mysql start --default-auth=mysql_native_password
mysql -e 'CREATE DATABASE ${{ env.MYSQL_DATABASE }};' -u${{ env.MYSQL_USERNAME }} -p${{ env.MYSQL_PASSWORD }}
mysqld --version
- name: Checkout
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2 # https://github.com/marketplace/actions/setup-php-action
with:
php-version: ${{ matrix.php-version }}
extensions: intl, mysqli, oauth
ini-values: error_reporting=-1, memory_limit=512M, post_max_size=256M, xdebug.mode="debug,coverage,develop"
coverage: xdebug #optional
- name: Check PHP Version
run: |
php -v
php -r 'echo "curl version: " . curl_version()["version"] . "\n";'
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache composer packages
uses: actions/cache@v4
id: composer-cache
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: |
composer --version
composer install --prefer-dist --no-progress
- name: Unit test
run: composer run test
- name: Publish code coverage
if: ${{ matrix.php-version == '8.2' && github.ref_name == 'master' }}
uses: paambaati/[email protected]
continue-on-error: true
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
debug: false
coverageCommand: vendor/bin/phpunit --coverage-clover coverage/clover.xml
coverageLocations: coverage/clover.xml:clover
- name: Coverage summary
if: ${{ matrix.php-version == '8.2' && github.ref_name == 'master' }}
continue-on-error: true
run: php -f vendor/bdk/devutil/src/coverageChecker.php -- coverage/clover.xml