-
Notifications
You must be signed in to change notification settings - Fork 13
176 lines (154 loc) · 5.99 KB
/
test.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Test
on:
# Run on all pushes and on all pull requests.
push:
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
#### TEST STAGE ####
test:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
phpunit: ['auto']
coverage: [true]
experimental: [false]
include:
# Test against a version on the low-end of the PHPUnit versions supported for each PHP version.
# On PHP 5.4 and 5.5, only PHPUnit 4.x is supported and the lowest and the
# highest supported version would be the same.
# Using the Composer `--prefer-lowest` option is, unfortunately, not viable, as
# PHPUnit 4.8.36 doesn't have proper PHP restrictions, which means that it
# would always be installed as "low", which would break the builds for PHP 7.2+.
- php: '5.6'
phpunit: '5.7.21'
coverage: true
experimental: false
- php: '7.0'
phpunit: '5.7.27'
coverage: true
experimental: false
- php: '7.1'
phpunit: '5.7.21'
coverage: true
experimental: false
- php: '7.2'
phpunit: '6.3.1'
coverage: true
experimental: false
- php: '7.3'
phpunit: '7.2.7'
coverage: true
experimental: false
- php: '7.4'
phpunit: '8.1.6'
coverage: true
experimental: false
- php: '7.4'
# Specifically set at 9.6.10 to test functioning on 9.x before the 9.6.11 assertObject*() backports came in.
phpunit: '9.6.10'
coverage: true
experimental: false
- php: '8.0'
phpunit: '8.5.16'
# PHPUnit 8.x does not support code coverage on PHP 8.x.
coverage: false
experimental: false
- php: '8.0'
phpunit: '9.3.0'
coverage: true
experimental: false
- php: '8.1'
phpunit: '9.3.0'
coverage: true
experimental: false
- php: '8.2'
phpunit: '9.3.0'
coverage: true
experimental: false
# Experimental builds.
- php: '8.3'
phpunit: 'auto' # PHPUnit 9.x.
coverage: false
experimental: true
- php: '8.1'
phpunit: '^10.0'
coverage: false
experimental: true
- php: '8.2'
phpunit: '^10.0'
coverage: false
experimental: true
name: "Tests: PHP ${{ matrix.php }} - PHPUnit: ${{matrix.phpunit}}"
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
coverage: ${{ matrix.coverage == true && 'xdebug' || 'none' }}
- name: 'Composer: set PHPUnit version for tests'
if: ${{ matrix.phpunit != 'auto' }}
run: composer require --no-update phpunit/phpunit:"${{ matrix.phpunit }}" --no-interaction
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies - normal
if: matrix.php != '8.3'
uses: "ramsey/composer-install@v2"
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
- name: Install Composer dependencies - ignore PHP restrictions
if: matrix.php == '8.3'
uses: "ramsey/composer-install@v2"
with:
composer-options: --ignore-platform-req=php+
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
- name: Run the unit tests
if: ${{ matrix.coverage == false && matrix.phpunit != '^10.0' }}
run: composer test
- name: Run the unit tests with code coverage
if: ${{ matrix.coverage == true && matrix.phpunit != '^10.0' }}
run: composer coverage
- name: Trial run the unit tests against PHPUnit 10.0
if: ${{ matrix.phpunit == '^10.0' }}
continue-on-error: true
run: composer test
# Uploading the results with PHP Coveralls v1 won't work from GH Actions, so switch the PHP version.
- name: Switch to PHP 7.4
if: ${{ success() && matrix.coverage == true && ( matrix.php == '5.4' || startsWith( matrix.php, '8' ) ) }}
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none
# Global install is used to prevent a conflict with the local composer.lock in PHP 8.0+.
- name: Install Coveralls
if: ${{ success() && matrix.coverage == true }}
run: composer global require php-coveralls/php-coveralls:"^2.5.3" --no-interaction
- name: Upload coverage results to Coveralls
if: ${{ success() && matrix.coverage == true }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: php-${{ matrix.php }}-phpunit-${{ matrix.phpunit }}
run: php-coveralls -v -x build/logs/clover.xml
coveralls-finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.COVERALLS_TOKEN }}
parallel-finished: true