1818
1919 strategy :
2020 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
2233 experimental : [false]
2334
2435 include :
2839 name : " Test on PHP ${{ matrix.php }}"
2940 continue-on-error : ${{ matrix.experimental }}
3041
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 }}"
3184 steps :
3285 - name : Checkout code
3386 uses : actions/checkout@v2
@@ -48,29 +101,53 @@ jobs:
48101 with :
49102 php-version : ${{ matrix.php }}
50103 ini-values : ${{ steps.set_ini.outputs.PHP_INI }}
51- coverage : none
104+ coverage : xdebug
52105 tools : cs2pr
53106
54107 # Remove the PHPCS standard as it has a minimum PHP requirements of PHP 5.4 and would block install on PHP 5.3.
55108 - name : ' Composer: remove PHPCS'
56109 if : ${{ matrix.php < 5.4 }}
57110 run : composer remove --dev php-parallel-lint/php-code-style --no-update --no-interaction
58111
59- # Install dependencies and handle caching in one go.
60- # @link https://github.com/marketplace/actions/install-composer-dependencies
61112 - name : Install Composer dependencies - normal
62- if : ${{ matrix.experimental == false }}
63113 uses : " ramsey/composer-install@v2"
64114
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-
72115 - name : Lint
73116 run : composer phplint -- --checkstyle | cs2pr
74117
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