Skip to content

Commit a31c845

Browse files
authored
Merge pull request #113 from Brain-WP/feature/ghactions-adjust-matrix
GH Actions: mixed bag of improvements
2 parents 48ebfa1 + 843d7cd commit a31c845

File tree

1 file changed

+38
-10
lines changed

1 file changed

+38
-10
lines changed

.github/workflows/php-qa.yml

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
11
name: PHP Quality Assurance
2-
on: [push]
2+
on:
3+
push:
4+
# Allow manually triggering the workflow.
5+
workflow_dispatch:
6+
7+
# Cancels all previous workflow runs for the same branch that have not yet completed.
8+
concurrency:
9+
# The concurrency group contains the workflow name and the branch name.
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
313
jobs:
414
qa:
515
runs-on: ubuntu-latest
616
if: "!contains(github.event.head_commit.message, 'ci skip')"
717
strategy:
818
fail-fast: true
919
matrix:
10-
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
20+
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
21+
dependency-versions: ['lowest', 'highest']
22+
23+
include:
24+
- php-versions: '8.2'
25+
dependency-versions: 'highest'
1126

1227
continue-on-error: ${{ matrix.php-versions == '8.2' }}
1328

@@ -18,32 +33,45 @@ jobs:
1833
uses: shivammathur/setup-php@v2
1934
with:
2035
php-version: ${{ matrix.php-versions }}
21-
ini-values: error_reporting=-1, display_errors=On
36+
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
37+
coverage: ${{ ( matrix.php-versions == '7.4' && 'xdebug' ) || 'none' }}
38+
tools: parallel-lint
2239

2340
- name: Check syntax error in sources
24-
run: find ./src/ ./tests/ -type f -name '*.php' -print0 | xargs -0 -L 1 -P 4 -- php -l
41+
if: ${{ matrix.dependency-versions == 'highest' }}
42+
run: parallel-lint ./src/ ./tests/
2543

2644
- name: Install dependencies - normal
2745
if: ${{ matrix.php-versions != '8.2' }}
28-
run: composer install -q -n -a --no-progress --prefer-dist
46+
uses: "ramsey/composer-install@v1"
47+
with:
48+
dependency-versions: ${{ matrix.dependency-versions }}
2949

3050
- name: Install dependencies - ignore-platform-reqs
3151
if: ${{ matrix.php-versions == '8.2' }}
32-
run: composer install -q -n -a --no-progress --prefer-dist --ignore-platform-reqs
52+
uses: "ramsey/composer-install@v1"
53+
with:
54+
dependency-versions: ${{ matrix.dependency-versions }}
55+
composer-options: "--ignore-platform-reqs"
3356

3457
- name: Check cross-version PHP compatibility
35-
if: ${{ matrix.php-versions == '7.4' }} # results is same across versions, do it once
58+
if: ${{ matrix.php-versions == '7.4' && matrix.dependency-versions == 'highest' }} # results is same across versions, do it once
3659
run: composer phpcompat
3760

3861
- name: Migrate test configuration (>= 7.3)
39-
if: ${{ matrix.php-versions >= 7.3 }}
62+
if: ${{ matrix.php-versions >= 7.3 && matrix.dependency-versions == 'highest' }}
4063
run: ./vendor/bin/phpunit --migrate-configuration
4164

42-
- name: Run unit tests
65+
- name: Run unit tests (without code coverage)
66+
if: ${{ matrix.php-versions != '7.4' || matrix.dependency-versions != 'highest' }}
67+
run: ./vendor/bin/phpunit
68+
69+
- name: Run unit tests with code coverage
70+
if: ${{ matrix.php-versions == '7.4' && matrix.dependency-versions == 'highest' }}
4371
run: ./vendor/bin/phpunit --coverage-clover=coverage.xml
4472

4573
- name: Update codecov.io
4674
uses: codecov/codecov-action@v1
47-
if: ${{ matrix.php-versions == '7.4' }} # upload coverage once is enough
75+
if: ${{ matrix.php-versions == '7.4' && matrix.dependency-versions == 'highest' }} # upload coverage once is enough
4876
with:
4977
file: ./coverage.xml

0 commit comments

Comments
 (0)