18
18
19
19
strategy :
20
20
matrix :
21
- php : ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
21
+ php :
22
+ # PHP 5.3 is tested in coverage section
23
+ - ' 5.4'
24
+ - ' 5.5'
25
+ - ' 5.6'
26
+ - ' 7.0'
27
+ - ' 7.1'
28
+ - ' 7.2'
29
+ - ' 7.3'
30
+ - ' 7.4'
31
+ - ' 8.0'
32
+ # PHP 8.1 is tested in coverage section
22
33
experimental : [false]
23
34
24
35
include :
28
39
name : " Test on PHP ${{ matrix.php }}"
29
40
continue-on-error : ${{ matrix.experimental }}
30
41
42
+ steps :
43
+ - name : Checkout code
44
+ uses : actions/checkout@v2
45
+
46
+ - name : Setup PHP
47
+ uses : shivammathur/setup-php@v2
48
+ with :
49
+ php-version : ${{ matrix.php }}
50
+ ini-values : ' zend.assertions=1, error_reporting=-1, display_errors=On'
51
+ coverage : none
52
+ tools : cs2pr
53
+
54
+ # Install dependencies and handle caching in one go.
55
+ # @link https://github.com/marketplace/actions/install-composer-dependencies
56
+ - name : Install Composer dependencies - normal
57
+ if : ${{ matrix.experimental == false }}
58
+ uses : " ramsey/composer-install@v2"
59
+
60
+ # For the PHP "nightly", we need to install with ignore platform reqs as not all dependencies allow it.
61
+ - name : Install Composer dependencies - with ignore platform
62
+ if : ${{ matrix.experimental == true }}
63
+ uses : " ramsey/composer-install@v2"
64
+ with :
65
+ composer-options : --ignore-platform-reqs
66
+
67
+ - name : Lint
68
+ run : composer phplint -- --checkstyle | cs2pr
69
+
70
+ - name : Run unit tests
71
+ run : composer phpunit
72
+
73
+ coverage :
74
+ needs : test
75
+ # Don't run on forks.
76
+ if : github.repository_owner == 'php-parallel-lint' && needs.test.result == 'success'
77
+ runs-on : ubuntu-latest
78
+ strategy :
79
+ matrix :
80
+ include :
81
+ - php : 5.3
82
+ - php : 8.1
83
+ name : " Coverage on PHP ${{ matrix.php }}"
31
84
steps :
32
85
- name : Checkout code
33
86
uses : actions/checkout@v2
@@ -48,29 +101,53 @@ jobs:
48
101
with :
49
102
php-version : ${{ matrix.php }}
50
103
ini-values : ${{ steps.set_ini.outputs.PHP_INI }}
51
- coverage : none
104
+ coverage : xdebug
52
105
tools : cs2pr
53
106
54
107
# Remove the PHPCS standard as it has a minimum PHP requirements of PHP 5.4 and would block install on PHP 5.3.
55
108
- name : ' Composer: remove PHPCS'
56
109
if : ${{ matrix.php < 5.4 }}
57
110
run : composer remove --dev php-parallel-lint/php-code-style --no-update --no-interaction
58
111
59
- # Install dependencies and handle caching in one go.
60
- # @link https://github.com/marketplace/actions/install-composer-dependencies
61
112
- name : Install Composer dependencies - normal
62
- if : ${{ matrix.experimental == false }}
63
113
uses : " ramsey/composer-install@v2"
64
114
65
- # For the PHP "nightly", we need to install with ignore platform reqs as not all dependencies allow it.
66
- - name : Install Composer dependencies - with ignore platform
67
- if : ${{ matrix.experimental == true }}
68
- uses : " ramsey/composer-install@v2"
69
- with :
70
- composer-options : --ignore-platform-reqs
71
-
72
115
- name : Lint
73
116
run : composer phplint -- --checkstyle | cs2pr
74
117
75
- - name : Run unit tests
76
- run : composer phpunit
118
+ - name : Run the unit tests with code coverage
119
+ run : composer coverage
120
+
121
+ # Uploading the results with PHP Coveralls v1 won't work from GH Actions, so switch the PHP version.
122
+ - name : Switch to PHP 8.1
123
+ if : ${{ success() && matrix.php != '8.1' }}
124
+ uses : shivammathur/setup-php@v2
125
+ with :
126
+ php-version : 8.1
127
+ coverage : none
128
+
129
+ # Global installing is used for compatibility with composer.lock in PHP 5.3
130
+ - name : Install Coveralls
131
+ if : ${{ success() }}
132
+ run : composer global require php-coveralls/php-coveralls:"^2.4.2" --no-interaction
133
+
134
+ - name : Upload coverage results to Coveralls
135
+ if : ${{ success() }}
136
+ env :
137
+ COVERALLS_REPO_TOKEN : ${{ secrets.GITHUB_TOKEN }}
138
+ COVERALLS_PARALLEL : true
139
+ COVERALLS_FLAG_NAME : php-${{ matrix.php }}
140
+ run : php-coveralls -v -x build/logs/clover.xml
141
+
142
+
143
+ coveralls-finish :
144
+ needs : coverage
145
+ # Don't run on forks.
146
+ if : github.repository_owner == 'php-parallel-lint' && needs.coverage.result == 'success'
147
+ runs-on : ubuntu-latest
148
+ steps :
149
+ - name : Coveralls Finished
150
+ uses : coverallsapp/github-action@master
151
+ with :
152
+ github-token : ${{ secrets.GITHUB_TOKEN }}
153
+ parallel-finished : true
0 commit comments