forked from sebastianbergmann/phpunit
-
Notifications
You must be signed in to change notification settings - Fork 4
86 lines (78 loc) · 3 KB
/
tests.yml
File metadata and controls
86 lines (78 loc) · 3 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
name: "Tests"
on:
pull_request: ~
push:
branches:
- "master"
jobs:
test:
name: PHP:${{ matrix.php }} php-invoker:${{ toJSON(matrix.php_invoker) }}${{ matrix.coverage && ' (with coverage)' || '' }}${{ matrix.experimental && ' (allowing failures - php version not supported yet)' || '' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- "5.3"
- "5.4"
- "5.5"
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
- "8.5"
php_invoker: [true, false]
coverage: [false]
experimental: [false]
include:
# run coverage only on PHP 7.4
- php: "7.4"
php_invoker: false
coverage: true
- php: "7.4"
php_invoker: true
coverage: true
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
# setup-php defaults to production ini which excludes E_DEPRECATED,
# override to catch deprecation warnings in tests
ini-values: error_reporting=E_ALL, display_errors=on, log_errors=on
extensions: xdebug, ctype, dom, json, pcre, reflection, spl
tools: composer
env:
# https://github.com/shivammathur/setup-php/issues/407#issuecomment-773675741
fail-fast: true
# PEAR_RunTest is needed for .phpt tests. The composer v2 packagist version
# of pear/pear requires PHP 5.4+, and the PHP 5.3-compatible version that was
# previously installable via composer v1 is no longer available since packagist
# dropped composer v1 support. Install via pear CLI provided by setup-php instead.
#
# pear install without sudo fails on PHP 5.6+ with "php_dir is not writeable"
# because setup-php creates root-owned PEAR directories for those versions.
# pear channel-update is needed to avoid "channel has updated its protocols" warning.
- name: Install PEAR
run: sudo pear channel-update pear.php.net && sudo pear install --force PEAR
- name: Install dependencies
env:
INSTALL_PHP_INVOKER: "${{ matrix.php_invoker == true }}"
run: |
if [ $INSTALL_PHP_INVOKER == true ]; then composer require --dev --prefer-source phpunit/php-invoker:\>=1.1.0,\<1.2.0; else composer install --dev --prefer-source; fi
- name: "Run PHPUnit tests"
env:
FAILURE_ACTION: "${{ matrix.experimental == true }}"
WITH_COVERAGE: "${{ matrix.coverage == true }}"
run: |
export CONFIG_FILE="./build/ci-no-coverage.xml"
if [[ $WITH_COVERAGE == true ]]; then export CONFIG_FILE="./build/ci.xml"; fi
./phpunit.php --configuration "${CONFIG_FILE}" || $FAILURE_ACTION;
# vim:ft=yaml:et:ts=2:sw=2